ZX: Host and Use a Private Realm

To set up a private realm you need to run the command zx create realm. This command will prompt you to create a new user and keys for the realm and designate that user as the sysop (root user).

Once the new realm and user are created you will need to decide where to host the realm. If it will be hosted on your local system, you can somply run zx run zomp and you're done -- your realm exists and you can start adding packages. If you will be hosting your realm on a different system (most common for organizational installations) then you will need to export the realm information with the command zx export realm [RealmName] and also export the public user data (the .zpuf file) to import into the realm's prime node with zx export user.

Once you have imported the realm and the user to the system that will be the prime node for the realm you can start adding packages.

To add a package you will, of course, need to run zx init on any projects you want to package for the realm, and once initialized run zx add package realm_name-package_name to register the package with the realm. Once the package is registered with the realm you can perform the submit/approve/accept process for whatever versions of that package you wish to make available for execution or inclusion as dependencies through your realm.

Remember that for other users (or your own internal systems in the case of an organizational deployment) to use packages from your realm they will need to import the realm file, which means you need a method of distributing your realm file. Public realms typically have a website or community home, private realms for server or organizational deployment are typically distributed and imported using a configuration tool like Chef or Puppet (or included in a Docker image).

Because you are the sysop for your own realm you can skip the "review" step, as there is no need to re-sign your packages since they are already signed with the sysop key the first time you package them. In the example below I have a realm called "foo" with a package called "bar" that is version 1.0.0.:

ceverett@okonomiyaki:~/code$ zx add package foo-bar
ceverett@okonomiyaki:~/code$ zx package bar/
Packaging bar/
Writing app file: ebin/bar.app
Wrote archive foo-bar-1.0.0.zsp
ceverett@okonomiyaki:~/code$ zx submit foo-bar-1.0.0.zsp
ceverett@okonomiyaki:~/code$ zx approve foo-bar-1.0.0
ceverett@okonomiyaki:~/code$ zx accept foo-bar-1.0.0.zsp
ceverett@okonomiyaki:~/code$ zx list versions foo-bar

Now foo-bar v1.0.0 is available to be run with zx run foo-bar or included as a dependency in other projects with zx set dep foo-bar-1.0.0.