At a high level, integrating Aptible with your CI platform boils down to the following steps:
- Create a robot User in Aptible for your CI platform.
- Trigger a deploy to Aptible whenever your CI completes. How you'll do this depends on how you're deploying to Aptible:
Creating a Robot User
- Create a "Robots" Role in your Aptible Organization, and grant it "Read" and "Manage" Permissions on the Environment you'd like to automate deployment to.
- Invite a new user to this Robots role. It needs to have a real email address. Most customers use something like
- Log out of your Aptible account, accept the invitation you received for the robot user by email, and create a password for the robot user.
If you're going to use this user to deploy an App using Dockerfile Deploy, you're also going to need a SSH keypair for the deploy user to let them connect to your App's Git Remote:
- Generate a SSH key pair for the deploy user using
ssh-keygen -f deploy.pem. Don't set a password for the key.
- Register the SSH Public Key with Aptible for the robot user.
Triggering a Deploy
Most CI platforms expose some form of "after-success" hook you can use to trigger a deploy to Aptible after your tests have passed. You'll need to use it to trigger a deploy to Aptible by running
git push to work, you'll also need to provide your CI platform with the SSH key you created for your robot user. To that end, most CI platforms let you provide encrypted files to store in your repository.
Direct Docker Image Deploy
To deploy with Direct Docker Image Deploy, you'll need to build and publish a Docker Image when your build succeeds. Then, you can install the Aptible CLI in your CI environment, log in as the robot user, and use
aptible deploy to trigger a deploy to Aptible.
Updated about 1 year ago