Aptible PaaS logoDocs

How to synchronize configuration and code changes

Updating the configuration of your app using aptible config:set then deploying your app through Dockerfile Deploy or Direct Docker Image Deploy will deploy your app twice:

This process may be inconvenient when you need to update your configuration and ship new code that depends on the updated configuration simultaneously. To solve this problem, the Aptible CLI lets you deploy and update your app configuration as one atomic operation.

For Dockerfile Deploy

To synchronize a Configuration change and code release when using Dockerfile Deploy:

Step 1: Push your code to a new deploy branch on Aptible. Any name will do, as long as it's not master, but we recommend giving it a random-ish name like in the example below. Pushing to a branch other than master will not trigger a deploy on Aptible. However, the new code will be available for future deploys.

BRANCH="deploy-$(date "+%s")"
git push aptible "master:$BRANCH"

Step 2: Deploy this branch along with the new Configuration variables using the aptible deploy command:

aptible deploy \
  --app "$APP_HANDLE" \
  --git-commitish "$BRANCH" \
  FOO=BAR QUX=

Please note that you can provide some common configuration variables as arguments to CLI commands instead of updating the app configuration. For example, if you need to include Private Registry Authentication credentials to let Aptible pull a source Docker image, you can use this command:

aptible deploy \
  --app "$APP_HANDLE" \
  --git-commitish "$BRANCH" \
  --private-registry-username "$USERNAME" \
  --private-registry-password "$PASSWORD"

For Direct Docker Image Deploy

Please use the aptible deploy CLI command to deploy your app if you are using Direct Docker Image Deploy. If you are not using aptible deploy, please review the Direct Docker Image Deploy instructions. When using aptible deploy with Direct Docker Image Deploy, you may append environment variables to the aptible deploy command:

aptible deploy \
  --app "$APP_HANDLE" \
  --docker-image "$DOCKER_IMAGE" \
  FOO=BAR QUX=
How to synchronize configuration and code changes