For easy deployments we're using flightplan
, install with npm install -g flightplan
.
Before deploying you need to make your computer a friend to the server.
You only need to do these steps once per machine.
We are going to be adding your public key to the remote server for passwordless SSH.
Then we are going to set up your SSH to allow for Agent Forwarding, so that your git commands are tunneled to the server.
When a step says Locally it means you should execute the command on your local machine.
When a step says Remotely it means you should execute the command on the remote server you want to deploy on.
- Locally,
cat ~/.ssh/id_rsa.pub
, copy the output - Remotely,
pico ~/.ssh/authorized_keys
, paste your key, save and exit - (optional) Remotely,
chmod 600 ~/.shh/authorized_keys
, only needs to be done the first time (but it's very important, as the server might be locked completely if not done) - Locally,
echo "Host <HOST IP>\n ForwardAgent yes" >> ~/.ssh/config
, this adds the remote IP to your forwarding agent - Locally
ssh-add
to set up your key for agent forwarding. (NOTE: this needs to be run after each restart)
# Flightplan is a task runner for remote and local tasks
# fly <task>:<target> [--pull/--tag]
# The --pull and --tag commands have been added by us.
# Pull the latest of the current remotely checked out branch
fly deploy:staging --pull
# Reset the branch to a certain release number
# fly deploy:production --tag <tag number>
fly deploy:staging --tag 1.2.5