pro-airgapped-server how-to

How to use the pro-airgapped-server charm

Follow these steps to deploy and use the pro-airgapped-server charm in an airgapped environment:

  1. Choose the Ubuntu Pro contract tokens you will use offline on your Pro dashboard. This is the only action you will do on a non-airgapped machine.

  2. Set up the mirrors of the APT repos inside the airgapped environment. It is beyond the scope of this doc to explain how to do this, but we suggest, without warranty or support of any kind, apt-mirror. After mirrors are set up, spin up the server(s) on the airgapped machine to serve the mirrored repositories. In this how-to, we assume you plan to use esm-infra.

  3. Deploy the charm in the airgapped machine:

    juju deploy pro-airgapped-server
    
  4. The deployed application will expectedly be in the “Blocked” state. If the airgapped machine has access to the Internet at that moment, provide Ubuntu Pro contract tokens which the Pro client will use later:

    juju config pro-airgapped-server pro-tokens=C14LZCAxz36w6Nh5EQDuD6cmNKtwWn
    

    Alternatively, if the machine has no access to the Internet at that moment, you should add the ppa:yellow/ua-airgapped APT repository to your local, non-airgapped, machine, install & run the pro-airgapped command manually and base64-encode the output. This string should be passed as manual-server-config:

    # On non-airgapped machine:
    B64_MANUAL_SERVER_CONFIG=$(echo 'C14LZCAxz36w6Nh5EQDuD6cmNKtwWn:' | pro-airgapped | base64)
    

    Copy the B64_MANUAL_SERVER_CONFIG variable value and run on an airgapped machine:

    # On airgapped machine:
    juju config pro-airgapped-server manual-server-config=$B64_MANUAL_SERVER_CONFIG
    
  5. The application should now be in the “Ready” state. However, the contracts server points to Canonical-hosted entitlements, not the mirrored ones. Suppose you have set up mirrors to serve esm-infra on http://192.168.123.99:9071. To tell the contracts server to point to this mirror, set up the config the following way:

    juju config pro-airgapped-server entitlements-url-map='{"esm-infra": {"aptURL": "http://192.168.123.99:9071"}}'
    
  6. The airgapped Pro backend server charm has been successfully set up! You only need to configure the Pro client to point to the airgapped instance of Pro backend. Update the /etc/ubuntu-advantage/uaclient.conf file’s directive contract_url to use the IP of the pro-airgapped-server unit with the configured port (default :8484).

  7. Run sudo pro refresh to update the Pro client config. And finally, attach the contract token you have configured in the charm:

    sudo pro attach C14LZCAxz36w6Nh5EQDuD6cmNKtwWn
    

    With the proper server config and correctly configured mirrors, attaching succeeds.