This is a collection of tasks executed with the Jake task runner. See http://jakejs.com/
- aws-cli installed and configured
- docker installed
- Correct node installed (
cat .nvmrc, then usenvmto install/use that version)
npm i -g jake- Clone this repo
cdto jakefilesnpm i- copy the
example.envto.envand add appropriate values. Note: Paths must be absolute and may not use~. Example:/Users/USERNAME/PATHTOREPO jake -T
All ephemeral environment tasks can be found in the eph-ephemeral container in ECS in AWS.
See this Confluence document
for more details about ephemeral environments.
- In a terminal window, navigate to the jakefiles repo and run a deployment command in the following format:
Template: jake eph:create['STACK'] Example: jake eph:create['coffee']
- STACK will be used to name all the infrastructure elements that will be created for the environment (ex. task
names like
eph-coffee-console, subdomains likehttps://eph-coffee-console.greenchef.com/, pipelines likecoffee-console, etc.); must be alphanumeric and between 1 and 6 characters long.
- STACK will be used to name all the infrastructure elements that will be created for the environment (ex. task
names like
- Once this process is complete, deploy code to the new environment using one or both of the pipeline deployment methods below
Deploy a Branch to Staging, Production, or an Ephemeral Environment using GitHub and the Deployment Pipeline
See this Confluence document for more details about the pipeline.
- Make sure the branch you want to deploy is fully up to date on GitHub. This method deploys directly from GitHub.
- In a terminal window, navigate to the jakefiles repo and run a deployment command in the following format:
Template: jake pipeline:deploy['ENVIRONMENT','CLUSTER/STACK','REPO','BRANCH'] Example: jake pipeline:deploy['stag','one','app-greenchef','my-branch'] OR jake pipeline:deploy['eph','coffee','app-greenchef','my-branch']
- ENVIRONMENT is either stag (staging), prod (production), or eph (ephemeral)
- CLUSTER names for stag/prod environments can be found in AWS in ECS Clusters; STACK is the name that was chosen when an ephemeral environment was created
- REPO is the name of the repo in GitHub
- BRANCH is the name of the branch to be deployed
- Monitor the progress of your deployment in AWS or via #gc-releases in Slack.
For a staging environment:
Template:
jake pipeline:refresh['CLUSTER']
Example:
jake pipeline:refresh['one']For an ephemeral environment:
Template:
jake pipeline:refresh['eph','STACK']
Example:
jake pipeline:refresh['eph','coffee']According to the official documentation, ZSH users may need to do one of two things to run jake commands:
- Escape brackets or wrap them in single quotes and omit inner quotes:
jake 'deploy:app[stag,uat,console]'
-- OR --
- Permanently deactivate file-globbing for the
jakecommand by adding this line to your.zshrcfile:alias jake="noglob jake"
Everything in this section is deprecated functionality. Use the pipeline methods above whenever possible.
Make sure your .env file is up to date (Example:
PATH_TO_CONSOLE=/Users/bgreene/GreenChef/console-web/)
- Navigate to the folder you want to deploy. (Example:
greenchef/services/server-greenchef)- Check out the branch you want to deploy. (Example:
release/2018-12-04)- View the
appsconstant in thedeploy.jakefile injakelibto find the correct name of the docker image you want to push to (Example:greenchef/services/server-greenchefcan be deployed toconsole-api,web-api,worker, orscheduler)- In a separate terminal tab, open the jakefiles repo, and run the deployment command (Example Below)
Deploy the "console" app to the "stag-uat" ECS cluster. (Staging and Production cluster names can be found on AWS in ECS Clusters)
jake deploy:app['stag','uat','console']
Instead of deploying
console-api,web-api,worker, andschedulerindividually, you can instead use the following with the desired cluster name:jake deploy:core['stag','uat']When using this command, note that
schedulerwill be excluded automatically from deployments to clusters with 'stag' in their names. However, ifscheduleris needed in a staging environment, it can be released individually using thedeploy:appsyntax in the previous example.
To deploy all shipping services, you can use the following with the desired cluster name:
jake deploy:shipping['stag','uat']