Skip to main content
Star us on GitHub Star

Migrate a Controller Installation

Here's an example of migrating an existing controller's configuration to the Linux service's working directory.

  1. Remove the quickstart controller service if you followed the BASH quickstart to create /etc/systemd/system/ziti-controller.service.

  2. Follow the Linux controller deployment guide to install the controller service.

  3. Ensure the controller service is disabled and the state is clean.

    sudo systemctl disable --now ziti-controller.service
    sudo systemctl clean --what=state ziti-controller.service
  4. Copy the controller's configuration to the working directory and rename it config.yml.

    sudo mkdir -pv /var/lib/ziti-controller/
    sudo cp -Rv ./pki ./db /var/lib/ziti-controller/
    sudo cp -v ./ctrl.yaml /var/lib/ziti-controller/config.yml
  5. Correct the file paths in config.yml. Ensure your current working directory matches the existing controller's working directory, e.g. ZITI_HOME, or substitute the old working directory for $PWD. After completing this step, verify the new config.yml has the correct file paths.

    sudo sed -Ei "s|$PWD|/var/lib/ziti-controller|g" /var/lib/ziti-controller/config.yml
  6. Disable bootstrapping. We're migrating a complete controller configuration (PKI, configuration file, and database) so we don't want the bootstrapper to generate a configuration.

    sudo sed -Ei 's|(ZITI_BOOTSTRAP)=.*|\1=false|g' /opt/openziti/etc/controller/service.env
  7. Start the service.

    sudo systemctl enable --now ziti-controller.service
    sudo systemctl status ziti-controller.service
  8. Verify the controller is running and listening on the expected port.

    journalctl -u ziti-controller.service
    sudo lsof -Pnp $(systemctl show -p MainPID --value ziti-controller.service) |& awk '$5~/IP/'
    Output
    ziti    2694474 ziti-controller    8u     IPv6          222078013       0t0       TCP *:1280 (LISTEN)