GuidesRecipesAPI ReferenceChangelogDiscussions
Log In

modzy-core install

Install Modzy Core as a Systemd service

$ modzy-core install [flags] registers a device with an installation of Modzy.

Modzy Core offers the option of installing the Core binary as a systemd service. This delegates the supervision of the modzy-core process to systemd. Delegation to systemd has the added advantage of having Modzy Core restart in the event that the device reboots, or the service unexpectedly exits.



Pay Careful Attention!

user privileges and storage filesystem paths are very important here

It is important to note when running install :

  1. Core will be writing files to privileged directories, and so this operation must be run as root
  2. The default path for Modzy Core for root users is opt/modzy/. This is important for two reasons:
    1. Unless otherwise specified by the --storage.filesystem.path, this is where Modzy core will look for its registration information before completing the installation when the install command is run.
    2. This is a protected directory. If you intend to utilize the default cache directories, registershould also be run as root

Enter the following code into the terminal after making the following replacements:

Replace <core_run_mode> with the desired mode you wish Core to start up in: direct or server
Replace </path/to/registration/info> with the location of core's registration information , or omit this flag altogether to use Core's defaults

$ ./modzy-core install --mode <core_run_mode> --storage.filesystem.path </path/to/registration/info>

The output is similar to the following:

[INFO]  Downloading binary
[INFO]  Copying binary to /opt/modzy/bin/modzy-core
[INFO]  Creating symlink to /usr/local/bin/modzy-core
[INFO]  Registering edge device with Modzy at
2023-11-14T20:05:06.323Z	INFO	cmd/register.go:36	beginning device registration process
2023-11-14T20:05:07.272Z	INFO	modzy/registration.go:67	registration with Modzy server successful
2023-11-14T20:05:07.273Z	INFO	modzy/registration.go:68	caching registration information
2023-11-14T20:05:07.280Z	INFO	modzy/registration.go:85	registration complete. Core is ready to start in server or direct mode
[INFO]  Installing Modzy Core
2023-11-14T20:05:09.657Z	INFO	cmd/install.go:115	Modzy Core installed on system successfully
2023-11-14T20:05:09.657Z	INFO	cmd/install.go:116	The modzy core binary has been moved to '/opt/modzy/bin' It is recommended that you add /opt/modzy/bin to your $PATH

When successfully run, the install command does a few things

  1. Creates and saves a modzy-core systemd unit file for future ongoing use
  2. enables and starts the new modzy-core systemd service in the specified mode
  3. moves the core binary to /opt/modzy/bin It is important that the binary not be moved from this location, or systemd won't be able to restart the service

Updating your $PATH

While not necessary, we recommend that after a successful run of the install command, you add /opt/modzy/bin to your $PATH variable. This will enable the use of the modzy-core command system wide, without worrying about being in the same directory as the binary.

Running Core Binary After Install

Only a single instance of Modzy Core can be running at one time. After install, core will be running in the background. If you wish to run the core binary after installing, you'll need to ensure that the modzy-core systemd service is stopped. Be aware that this usually requires elevated system permissions.

Register Flags

--modestringspecifies whether modzy core should run in server, or direct model in the background. Defaults to "server"