Deploy Waxx

Waxx includes a very simple deploy system. You are free to use any other deployment mechananism.

Steps to deploy to the stage environment:

  1. Setup the config file for the environment (opt/stage/config.yaml). See Config Waxx.
  2. Add a deploy script in the environment folder (opt/stage/deploy)
  3. Add the stage server(s) and options to opt/deploy.yaml
  4. Run: waxx deploy stage

Deploy Script

The deploy script in opt/stage/deploy is run on each staging server defined in opt/deploy.yaml.

A very simple deploy script could be:

opt/stage/deploy

  cd /usr/home/waxxx/stage && git pull && waxx migrate && waxx restart

This is very simple but it can be any command like make or rake, a Bash script, a Ruby script, etc.

Before Deploy Script

Tag the push and push. You could also update caches, add unique keys, send info to slack or whatever.

bin/before-deploy

#!/usr/bin/env ruby

deploy_to = ARGV[0]  # ARGV[0] is the value of: waxx deploy {deploy_to}
timestamp = Time.new.strftime('%Y-%m-%d.%H.%M')

`git tag #{deploy_to}-#{timestamp}`
`git push`

Deploy Config

Tell Waxx what servers to connect to and what command to run on each server.

opt/deploy.yaml

stage:
  before: /home/waxx/bin/before-deploy
  stage1:
    user: stage-user
    cert: /home/waxx/certs/stage-2017.pem
    host: 34.35.36.10
    command: /home/waxx/stage/opt/active/deploy
  stage2:
    user: stage-user
    cert: /home/waxx/certs/stage-2017.pem
    host: 34.35.36.11
    command: /home/waxx/stage/opt/active/deploy

Deploy

With those three files in place, deploy to the stage servers.

waxx deploy stage

This command will execute bin/before-deploy stage then ssh to 34.35.36.10 and 34.35.36.11 as the user stage-user using the key /home/waxx/certs/stage-2017.pem and execute /home/waxx/stage/opt/active/deploy on each stage server in series.

Initial Deploy

Note that this deploy process only works after you have Waxx setup on the remote server and the waxx/root folder is setup. So you will need to take the following steps before you use this deploy mechanism.

ssh stage-user@34.35.36.10
cd /home/waxx
git clone <pathe-to-your-git-repo> stage

Now you can deploy from your dev box or anwhere else that has the config setup.