Use GitHub Actions, GitLab CI/CD or other pipelines.
- Add deploy public key to
~/authorized_keysfile on servers (usemake terraform applycommand if you haven’t already done so) - Check required apps already installed on servers (use
make ansiblecommand if you haven’t already done so) - Add secrets variables to repo options:
SSH_KEY– Private key from deploy pair that used for servers accessSSH_CONFIG– SSH config for servers with address, port, user, etc. See the exampleCOMPOSER_AUTH– Composer authentication JSON object with Personal Access Token, see Managing your personal access tokens on GitHub
and Personal access tokens on GitLab. For local usage in.env.secretfile use a serialized unescaped JSON object without spaces, for GitHub secrets use escaped JSON object without spaces.
SSH config example:
# SSH_CONFIG
Host *
IdentitiesOnly yes
StrictHostKeyChecking no
# Develop server ssh alias
Host develop.starter-kit.io
HostName 00.00.00.00
User serverusername
Port 22
# Prod server ssh alias
Host starter-kit.io
HostName 00.00.00.00
User serverusername
Port 22
COMPOSER_AUTH example for GitHub secrets:
{\"github-oauth\":{\"github.com\":\"ACCESS_TOKEN_GITHUB\"}}
COMPOSER_AUTH example for local usage:
{"github-oauth":{"github.com":"ACCESS_TOKEN_GITHUB"}}
- Check CI/CD jobs config file, use
./.githubfor GitHub Actions - Push some changes to deployment branch and check pipelines logs