Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move inventories + Change File Structure #672

Open
wants to merge 2,595 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
2595 commits
Select commit Hold shift + click to select a range
945f255
Updated deploy bucket for marketing.
Mar 2, 2017
6bbbeaf
Added marketing deploy keys
Mar 3, 2017
f821c8e
Merge pull request #607 from CodeNow/updated-deploy-bucket
Myztiq Mar 3, 2017
4708bc3
Change region name
thejsj Mar 4, 2017
e9f6737
Merge pull request #609 from CodeNow/change-region-name
thejsj Mar 7, 2017
74e5df8
Added s3 log bucket to ansible
Mar 9, 2017
53142d6
Merge pull request #610 from CodeNow/SAN-5848-log-streaming
Myztiq Mar 9, 2017
3b1b007
Remove loggly
thejsj Mar 13, 2017
392f95e
Replace local registry with docker hub
thejsj Mar 13, 2017
96d9044
Make sure user is sudo
thejsj Mar 13, 2017
ffd27ad
Push images to docker hub. Not local registry
thejsj Mar 13, 2017
be570dd
Remove registry.runnable.com
thejsj Mar 13, 2017
eeca2c8
Dock should not be bound to any other enviroment. Remove commands tha…
thejsj Mar 13, 2017
e4db52b
Remove docks-psad
thejsj Mar 13, 2017
55f3ff6
Re add roles. Must be run with skip-tags in order to work
thejsj Mar 13, 2017
a7b1a87
Change node service config to tag. Skip tags if running dock
thejsj Mar 13, 2017
e5f2fcb
Remove unused tag
thejsj Mar 13, 2017
c41a0b5
Add primary functions for init
thejsj Mar 13, 2017
425548c
Add vault tokens
thejsj Mar 13, 2017
8df4393
Add tokens
thejsj Mar 13, 2017
982098d
Add tag to ensure_registry
thejsj Mar 13, 2017
eeb98c7
WIP
thejsj Mar 13, 2017
e6f6c84
Add build_and_squash
thejsj Mar 14, 2017
396c655
Add stuff
thejsj Mar 14, 2017
943e869
Uncomment stuff
thejsj Mar 14, 2017
9400c65
Fix vault port. Remove amazon-ssm-agent
thejsj Mar 14, 2017
b3e2942
Remove psad from dock (#613)
anandkumarpatel Mar 14, 2017
58303f2
Small fixes to role
thejsj Mar 14, 2017
936f71b
Add line to run dock-init
thejsj Mar 14, 2017
5b41178
Fix building of images
thejsj Mar 14, 2017
b180571
Fix pip. Remove runnable-angular
thejsj Mar 14, 2017
60bd667
Add vault port
thejsj Mar 14, 2017
3b27d32
Fix script to run on localhost
thejsj Mar 15, 2017
e0023b2
Merge branch 'create-shared-dock-ami' of github.com:CodeNow/devops-sc…
thejsj Mar 15, 2017
b44c6c6
Remove pushing of image
thejsj Mar 15, 2017
c5800a4
Add mongo-clio and clio to services.
Mar 15, 2017
3a007bf
Downgraded to node 4
Mar 15, 2017
c1b64a3
Removed dep on mongo-clio
Mar 15, 2017
8abd3d9
Removed extra host
Mar 15, 2017
8fddb9f
Point to api's db
Mar 15, 2017
76ec750
Make image-builder public
thejsj Mar 15, 2017
f496f27
Added mongo hosts.
Mar 15, 2017
4026e95
Fixed host
Mar 15, 2017
6390ede
Remove logs
thejsj Mar 15, 2017
e2bc685
Remove logs
thejsj Mar 15, 2017
189e2b3
Remove logs
thejsj Mar 15, 2017
f574bcb
Removed quotes
Mar 15, 2017
3ae2295
Remove logs
thejsj Mar 15, 2017
d5abebb
Updated to point clio to the same DB as everyone else :(
Mar 15, 2017
145ac59
Break stuff up
thejsj Mar 15, 2017
14fa6aa
Uncomment code block
thejsj Mar 15, 2017
c3f004f
Added new DB users in gamma/delta
Mar 16, 2017
cb68c89
Added deploy song
Mar 16, 2017
4a6d08e
Merge pull request #614 from CodeNow/SAN-5821-clio-deploy
Myztiq Mar 16, 2017
701150b
Remove mongo certs to run pheidi
Mar 16, 2017
87236a7
Added clio http url env var
Mar 16, 2017
d25615e
Revert "Added clio http url env var"
Mar 16, 2017
e62d97b
Revert "Revert "Added clio http url env var""
Mar 16, 2017
624d93a
Added clio port.
Mar 16, 2017
ae987e2
Updated url
Mar 16, 2017
3020c16
Moved cmd order
Mar 16, 2017
9f95f00
Merge pull request #616 from CodeNow/SAN-5911-fetch-container-history
Myztiq Mar 16, 2017
f94b8e3
Merge remote-tracking branch 'origin/master' into remove-mongo-certs-…
Mar 17, 2017
61a8a46
Merge branch 'master' of github.com:CodeNow/devops-scripts into creat…
thejsj Mar 20, 2017
749ff10
Add aws host for API
Nathan219 Mar 20, 2017
6490e9a
Merge pull request #617 from CodeNow/SAN-5803-aliases
Nathan219 Mar 20, 2017
5089ade
Merge pull request #615 from CodeNow/remove-mongo-certs-pheidi
henrymollman Mar 21, 2017
b1468d0
Merge branch 'master' of github.com:CodeNow/devops-scripts into creat…
thejsj Mar 21, 2017
c76f7a7
split out delta-app to 2 boxes. remove unused configs (#619)
anandkumarpatel Mar 22, 2017
32f4c99
remove redis tls (#620)
anandkumarpatel Mar 23, 2017
7daea34
Remove khronos mongo certs (#621)
anandkumarpatel Mar 23, 2017
02a1845
add clio to worker and socket (#622)
anandkumarpatel Mar 23, 2017
c4ebcba
Update dock images. Add consul_values tag
thejsj Mar 24, 2017
15fee45
Update krain image
thejsj Mar 24, 2017
d1c5bd3
Merge branch 'master' of github.com:CodeNow/devops-scripts into creat…
thejsj Mar 24, 2017
41afba3
Add docker-listener image inspect list
thejsj Mar 24, 2017
0cb5bfd
Add CA certs. Convert to single template. Overwrite existing files
thejsj Mar 24, 2017
cbd2587
Add more comments
thejsj Mar 24, 2017
ed929f7
Update vault port
thejsj Mar 24, 2017
df930de
Add user-local to delta
thejsj Mar 24, 2017
23dda55
Fix host addresses. Remove NODE_ENV from krain (default). Change loca…
thejsj Mar 25, 2017
322902c
Remove unused files
thejsj Mar 25, 2017
6d18554
Change image inspect list. Change author
thejsj Mar 25, 2017
429bb51
Fix sendgrid key
thejsj Mar 25, 2017
0fc2ace
Build images per host
thejsj Mar 27, 2017
7ba71e8
Updated vars for deploy
Mar 27, 2017
53bfbca
Sorted
Mar 27, 2017
25d425e
Merge pull request #624 from CodeNow/moving-keys
Myztiq Mar 27, 2017
a6aca02
Have specific version of pg client
thejsj Mar 27, 2017
cda3859
Merge branch 'master' of github.com:CodeNow/devops-scripts into creat…
thejsj Mar 28, 2017
ce53b11
Delete file
thejsj Mar 28, 2017
245b8db
Ensure tag when node_env is not defined
thejsj Mar 28, 2017
e22b51a
Remove n for node versions
thejsj Mar 28, 2017
9adacc9
Remove unused code. Add clio and egret. Create new role for adding tags
thejsj Mar 28, 2017
012a940
Remove argon as default
thejsj Mar 29, 2017
6eaa72b
Move stuff to secrets directory
thejsj Mar 29, 2017
851fbf4
Create directory
thejsj Mar 29, 2017
4cd6556
Change api-worker iamge name
thejsj Mar 29, 2017
27ee23b
Change role to builder
thejsj Mar 31, 2017
ee5737c
Merge branch 'master' of github.com:CodeNow/devops-scripts into creat…
thejsj Apr 4, 2017
be0ec5f
Re-add restart docker
thejsj Apr 4, 2017
e56c257
Change port to consul_api_port
thejsj Apr 6, 2017
d2b5e7b
Fix api port and echo in launch config
thejsj Apr 7, 2017
e632e45
Re-add image-builder. Change order for Docker startups purposes. Tag
thejsj Apr 7, 2017
bebf0e0
Merge pull request #611 from CodeNow/create-shared-dock-ami
thejsj Apr 7, 2017
f682b45
Merge branch 'master' of github.com:CodeNow/devops-scripts into creat…
thejsj Apr 8, 2017
9054264
Fix if statement
thejsj Apr 8, 2017
221c467
Merge branch 'create-shared-single-host-main-ami' of github.com:CodeN…
thejsj Apr 8, 2017
03064a4
Add fix additional image names
thejsj Apr 9, 2017
35f9124
Fix minor details in builder
thejsj Apr 9, 2017
4516cc5
Add run command to api, big-poppa, cream, and drake
thejsj Apr 9, 2017
edfdab6
Merge pull request #612 from CodeNow/create-shared-single-host-main-ami
thejsj Apr 9, 2017
309bf3f
Add building of container for runnable-angular
thejsj Apr 11, 2017
2bc9566
Add basics for enterprise-sign-in
thejsj Apr 11, 2017
2974c8b
Add enterprise sign-in to single-host-build
thejsj Apr 11, 2017
2334d31
Move enterprise-sign-in
thejsj Apr 11, 2017
8b77bcc
Remove .git directory. Add pushing of images
thejsj Apr 11, 2017
39e1ecd
Change image names from registry.runnable.com/runnable/ to runnable/
thejsj Apr 11, 2017
be8a6bf
Update README.md
anandkumarpatel Apr 11, 2017
0eac047
Update README.md
anandkumarpatel Apr 11, 2017
9125054
Merge pull request #628 from CodeNow/add-back-keys
thejsj Apr 11, 2017
bea28ea
Add enterprise sign in
thejsj Apr 12, 2017
6f7019b
Revert "Add enterprise sign in"
thejsj Apr 12, 2017
d8dfe84
Fix: Add shiva to sign-in form
thejsj Apr 12, 2017
f9b3436
Vault tokens will only be added to the user-data script and then to t…
Apr 13, 2017
31be17c
PR comments
Apr 13, 2017
7777c22
PR comments
Apr 13, 2017
d4c8e67
Merge pull request #631 from CodeNow/conditionally-add-vault-tokens
henrymollman Apr 13, 2017
5cf964a
Add pushing to docker hub
thejsj Apr 13, 2017
871dcfb
Change vars names. Remove unused ENVs
thejsj Apr 14, 2017
5912230
Change variable names for ansible variables in dock launch script
thejsj Apr 14, 2017
955aa8e
Merge pull request #632 from CodeNow/remove-unused-vars
thejsj Apr 14, 2017
9fdb5ca
Merge branch 'master' of github.com:CodeNow/devops-scripts into add-w…
thejsj Apr 15, 2017
528c6ed
use gbase64 which is orignal name from brew (#633)
anandkumarpatel Apr 18, 2017
7f1fedf
Fix squashing of images
thejsj Apr 18, 2017
997ac9a
Remove changing registries
thejsj Apr 18, 2017
bd0be22
Remove changes to pushing images
thejsj Apr 18, 2017
d166e63
Remove changes to image squashing
thejsj Apr 18, 2017
135fe5d
Remove changes to registry
thejsj Apr 18, 2017
677748f
Add wait_for_container_exit role for FE
thejsj Apr 18, 2017
d7e2031
Add dockerignore. Re-add old-stuff
thejsj Apr 18, 2017
24abd76
Fix dockerignore
thejsj Apr 19, 2017
66dffb0
Remove consul
thejsj Apr 19, 2017
82f0687
Revert "Remove changing registries"
thejsj Apr 19, 2017
8688a28
Revert "Remove changes to pushing images"
thejsj Apr 19, 2017
c0c85be
Revert "Remove changes to image squashing"
thejsj Apr 19, 2017
91b1ea9
Revert "Remove changes to registry"
thejsj Apr 19, 2017
a64328b
Switch registries to registry_host
thejsj Apr 19, 2017
8a21b05
Add logic to determine when to build and push images. Add registry va…
thejsj Apr 19, 2017
be41d1d
Add tokens for gamma
thejsj Apr 19, 2017
c8929b4
Merge branch 'master' into add-web-and-enterprise-sign-in
thejsj Apr 19, 2017
910ab1d
Merge pull request #630 from CodeNow/add-web-and-enterprise-sign-in
thejsj Apr 19, 2017
419f97f
Remove debug
thejsj Apr 19, 2017
1bb4d9f
Add image squashing
thejsj Apr 19, 2017
cf6773b
Fix container start
thejsj Apr 19, 2017
d0aa510
Merge pull request #634 from CodeNow/change-registry-for-images
thejsj Apr 20, 2017
341f4ce
Merge pull request #636 from CodeNow/add-web-and-enterprise-sign-in
thejsj Apr 20, 2017
c55b485
Add pulling of image if not present
thejsj Apr 20, 2017
c8b6912
Merge pull request #637 from CodeNow/add-login-in-for-pulling-image
thejsj Apr 20, 2017
f230388
update image builder version
podviaznikov Apr 20, 2017
1109e2f
Merge pull request #638 from CodeNow/update-image-builder-4dot4dot0
podviaznikov Apr 21, 2017
3a1865f
Update README
thejsj Apr 24, 2017
aee4bb0
double amount of api (#640)
anandkumarpatel Apr 26, 2017
7f47620
Merge pull request #639 from CodeNow/update-readme
thejsj Apr 26, 2017
cb3f48f
Nginx stats (#641)
anandkumarpatel Apr 27, 2017
a74b857
only log warn for api (#642)
anandkumarpatel Apr 27, 2017
db1d3c9
make runnable kubernetes (#635)
anandkumarpatel May 3, 2017
f9242a4
Add deploy files (#648)
anandkumarpatel May 3, 2017
8115b6e
RE-implemented starlord + vault
May 3, 2017
8d6e685
Added user-vault.
May 3, 2017
7e84f18
Add datadog (#650)
anandkumarpatel May 3, 2017
578964d
add new buildres
May 3, 2017
ecb7737
Merge pull request #651 from CodeNow/new-gamma-builder
Nathan219 May 3, 2017
9bbc130
Fixed images of vault we use
May 4, 2017
c357d5a
hotfix khronos
May 4, 2017
50e1644
hotfix quote TCP in service
May 4, 2017
519f4bc
San 6253 navi k8 (#652)
anandkumarpatel May 4, 2017
b6631d0
Switch to 4.4.3
Nathan219 May 4, 2017
929ab9f
Merge pull request #653 from CodeNow/api-to-use-4-4-3
Nathan219 May 4, 2017
cde7fff
hostfix prometheus alerts (#654)
anandkumarpatel May 4, 2017
7b9dde0
Anand told me to do this
Nathan219 May 4, 2017
fd76f91
undo gamma
Nathan219 May 4, 2017
424dae8
push navi
May 5, 2017
849872d
add datadog
May 5, 2017
411d4ce
update gamma
May 5, 2017
ace07b0
add datadog port
May 5, 2017
580758b
Fixed ERU startup
May 8, 2017
2cc849b
Merge pull request #655 from CodeNow/hotfix-eru
Myztiq May 8, 2017
084f934
Added configs for new policies.
May 8, 2017
ada2d63
Updated access token.
May 8, 2017
2a90780
Added starlord.yml
May 8, 2017
fa6fdbd
Merge remote-tracking branch 'origin/master' into SAN-6926-starlord-3
May 8, 2017
9163d32
Removed npm_version because it was causing failed builds.
May 8, 2017
daf8b10
Fixed deployment
May 8, 2017
754973d
Fixed deployment
May 8, 2017
53f3a4c
Added deploy song
May 8, 2017
f757a01
words
May 8, 2017
7632b90
Removed registry file
May 8, 2017
d759c1c
Removed container_run_opts
May 8, 2017
79d9e90
Fix status (#657)
anandkumarpatel May 8, 2017
50ccb43
Created an aws_region variable
May 8, 2017
fe44f97
Merge branch 'master' into SAN-6926-starlord-3
Myztiq May 8, 2017
89f0b2f
Added delta-user-vault credentials
May 8, 2017
ee103bd
Updated auth tokens and readme
May 8, 2017
ec5758c
San 6323 fix crons (#656)
anandkumarpatel May 9, 2017
65b6b9e
Remove the bad lines so the deploy works.
damienrunnable May 9, 2017
bf2e0e5
Merge pull request #658 from CodeNow/fix-web
damienrunnable May 9, 2017
4a943d8
pass vault endpoint env
podviaznikov May 9, 2017
6db539a
fix env location
podviaznikov May 9, 2017
ee564dd
rename env
podviaznikov May 9, 2017
ba0bdf4
Merge pull request #649 from CodeNow/SAN-6926-starlord-3
Myztiq May 9, 2017
651a8d9
add datadog to clio (#660)
anandkumarpatel May 9, 2017
e1253e5
Share hostname (#659)
anandkumarpatel May 9, 2017
3fe8b22
fix ssl location (#661)
anandkumarpatel May 10, 2017
e03fe3f
Add graphql port for Eru, add multiple upstreams for services in ngin…
May 15, 2017
5af574c
Update nginx ingress proxy configuration to allow for multiple upstre…
May 16, 2017
b6007f7
Merge pull request #663 from CodeNow/change-ingress-ports
tosih May 16, 2017
11bbd0d
update template and gamma configs
May 16, 2017
83cc52e
Merge pull request #664 from CodeNow/hotfix-ingress-eru
tosih May 16, 2017
8c46953
Update gamma ingres proxy k8 configs.
May 16, 2017
f9148e9
Added keymaker configurations.
May 16, 2017
b9b09b8
Removed installing of postgres client
May 16, 2017
240c225
Added keymaker pg password for gamma
May 16, 2017
c01cc0f
Created password for keymaker on delta
May 16, 2017
dbd504c
Fixed var name
May 16, 2017
ce39231
Added keymaker to localhost
May 16, 2017
68b98ba
Fixed node version
May 16, 2017
303a39d
Merge pull request #665 from CodeNow/gamma-ingress-proxy-k8
tosih May 17, 2017
fa57986
Update k8 deployment for api delta/gamma.
May 17, 2017
4c54ae7
Removed unused postgres strings.
May 17, 2017
0399481
Changed port.
May 17, 2017
4e58cde
Fix tagging of image builder
thejsj May 17, 2017
a2d0363
Added builder role back in so it publishes to quay.
May 17, 2017
7ccf31c
Change way we deploy image-builder
thejsj May 17, 2017
6eb6cc4
We don't need 4 replicas
May 17, 2017
d0eda67
Change host. Add comment
thejsj May 17, 2017
1862b6c
Merge pull request #666 from CodeNow/SAN-6252-keymaker
Myztiq May 18, 2017
691eeb5
update node version to the tested one
podviaznikov May 18, 2017
0bddbc6
Add ability to add default dockerfile
thejsj May 18, 2017
4ee579e
Merge branch 'fix-image-builder-push' of github.com:CodeNow/devops-sc…
thejsj May 18, 2017
b4abbc9
Change role to just use build_with_dockerfile
thejsj May 18, 2017
a44b903
make vault public (#669)
anandkumarpatel May 18, 2017
c580845
Remove unused vars
thejsj May 18, 2017
ba22cc4
Merge branch 'master' into fix-image-builder-push
thejsj May 18, 2017
4d37ce0
Merge pull request #667 from CodeNow/fix-image-builder-push
thejsj May 18, 2017
4c47d0a
Move inventories to inventories directory
thejsj May 19, 2017
8c85f81
Change where k8 files are stored
thejsj May 19, 2017
867c3c5
Move k8 resources file to inventory directories
thejsj May 19, 2017
db13edd
Move inventory directory. Move k8 files
thejsj May 19, 2017
f40c0e3
Update variable. Remove directory
thejsj May 19, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
node_modules
*.pem
pass
.pass
hellorunnable
dump.rdb
erl_crash.dump
npm-debug.log
ca.srl
.DS_Store
ansible/roles/hipache/templates/runnable*
ansible/certs/*
ansible/k8/**/configMaps/*cert*
*.retry
*.tfstate*
terraform/credentials.tfvars
terraform/.build
ansible/secrets/*
.idea
38 changes: 38 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM ubuntu:14.04

RUN apt-get update -y
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y -q unzip build-essential python-pip python-dev python-yaml libxml2-dev libxslt1-dev zlib1g-dev git curl sshpass openssh-client
RUN pip install --upgrade pyyaml jinja2 pycrypto

RUN curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash - && \
apt-get install -y nodejs

RUN curl -O https://releases.hashicorp.com/vault/0.6.3/vault_0.6.3_linux_amd64.zip && \
unzip ./vault_0.6.3_linux_amd64.zip -d /bin && \
chmod +x /bin/vault

RUN git clone git://github.com/ansible/ansible.git --recursive /opt/ansible

RUN cd /opt/ansible && \
git checkout v2.1.3.0-1 && \
git submodule update --init --recursive && \
bash -c 'source ./hacking/env-setup'

ENV PATH /opt/ansible/bin:$PATH
ENV PYTHONPATH /opt/ansible/lib:$PYTHONPATH
ENV MANPATH /opt/ansible/docs/man:$MANPATH

ADD ./ssh /root/.ssh
RUN echo 'eval `ssh-agent`' >> /root/start.sh
RUN echo 'ssh-add /root/.ssh/id_rsa' >> /root/start.sh
RUN echo 'npm start' >> /root/start.sh
RUN chmod +x /root/start.sh

ADD ./ansible/ /ansible
RUN cd /ansible && npm install

ADD ./deployer/ /deployer
RUN cd /deployer && npm install

WORKDIR /deployer
CMD /root/start.sh
23 changes: 23 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
We should treat our k8 files as compiled files, since we don't actually (http://blog.andrewray.me/dealing-with-compiled-files-in-git/). We should probably wait some time until we actually have more confidence in our compilation.

[//]: # (Let's get your best description here about what's happend! Here's a list as well, if you like:)

* I removed this function
* I fixed all these things, etc.

#### Dependencies

- [ ] list dependencies (eg, PR from another branch or repo; tags or versions required prior to deployment)

#### Tests

> Test any modifications on one of our environments.

- [ ] tested on _environment_ by _someone_

#### Deployment (post-merge)

> Ensure that all environments have the given changes.

- [ ] deployed to gamma
- [ ] deployed to delta
148 changes: 147 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,150 @@
devops-scripts
==============

devops-scripts
Scripts for managing our deployments.

# How to Deploy at Runnable
## Setup

Before you can deploy you'll need to install the appropriate tools, scripts, and keys on your local machine.
To do so, execute the following steps:

1. Install Ansible v2.2.0.0 (the deploy automation tool we use to deploy projects to production)
Installation: http://docs.ansible.com/intro_installation.html
Upgrading: `sudo pip install ansible==2.2.1.0` or http://docs.ansible.com/ansible/intro_installation.html#latest-releases-via-pip

2. Get the latest devops-scripts (the recipes that we use to deploy various projects)
https://github.com/CodeNow/devops-scripts

3. Change to the devops scripts repo directory and run the following command:
`ln -s /<local-path-to-devops-scripts>/ssh/config ~/.ssh/config`

4. Obtain the "Ansible Secrets" zip from one password

5. Unzip file obtained above into `devops-scripts/ansible/secrets`

6. Copy the `*.pem` files from `devops-scripts/ansible/secrets` to your `~/.ssh` directory

7. Install two required tools onto your machine:
```bash
brew update && brew install vault daemon
```

At this point you should be capable of deploying; keep reading to find out how to actually perform a deploy!

## Deploying Services
- **IMPORTANT:** always pull latest devopts-scripts (`git pull origin master`)
- **IMPORTANT:** Before you deploy a new version of any project make sure to determine which version of the project is currently deployed. This way you can quickly revert to the last stable release if something goes wrong after pushing a new version.

### Step 1: Determine the Current Deploy Version
To determine the latest deploy tag for a project please check the project's repository on
github and look for the latest release tag (should be in the form `vX.Y.Z`). Once you've located the tag,
copy it down somewhere that is easily and quickly accessible (you may need to use it quickly if something goes wrong).

### Step 2: Deploy the Project via `ansible-playbook`

- **WARNING:** If you were unable to determine the last deploy tag for a project and cannot revert **STOP**.
Ask someone on the team for help before continuing.
- **IMPORTANT:** All commands should be run from the `devops-script/ansible` directory.

#### Ansible Vault

Please note that there are playbook that require encrypted [ansible vault](http://docs.ansible.com/ansible/playbooks_vault.html) files. If you see the following error:

```bash
ERROR: A vault password must be specified to decrypt # snip
```

you will need to re-run the playbook with:

```bash
--ask-vault-pass
```

#### Latest Tag
Build and deploy a service to the latest tag of its repository. This will build
the docker image needed to run the container on our infrastructure.

#### Branch or Tag
Build and deploy a service to a specific branch or tag on its repository. This performs a build
of the docker image needed to run the service on our architecture.

##### Command
```
ansible-playbook -i ./[inventory_dir] [service-playbook] -e git_branch=[branch-or-tag] -t deploy
```

##### Arguments
- `[inventory_dir]` - The environment inventory files (servers and variables). Should be one of the following:
- `stage-hosts` - Runnable sandbox staging environment services
- `gamma-hosts` - Gamma services (internal use only; production mirror)
- `delta-hosts` - Delta services (real production)
- `[service-playbook]` - The playbook for the service you wish to deploy, ex:
- `api.yml` - Deploys both the api and the api-workers services
- `shiva.yml` - Deploys the shiva micro-service
- `charon.yml` - Deploys a specific version of charon DNS to all docks
- `[branch-or-tag]` - The branch or tag you wish to deploy, ex:
- `-e git_branch=v1.9.9` (version tag)
- `-e git_branch=my-feature-branch` (branch)
- `-e git_branch=3928745892364578623` (specific commit)

##### Rebuild and Deploy Tag or Branch (No Cache)
Forces a rebuild of a docker image for the given service at the given branch or tag and then deploys the
newly created image. This is useful when a previously deployed branch has new changes that need to
be deployed to an environment.

Generally this command is only used with `gamma-hosts/` as it is often used to update code
being tested in the production mirror.

##### Command
```
ansible-playbook -i ./[inventory_dir] [service-playbook] -e git_branch=[branch-or-tag] -e build_args=--no-cache
```

##### Arguments
- `[inventory_dir]` - The environment inventory files (servers and variables).
- `[service-playbook]` - The playbook for the service you wish to deploy.
- `[branch-or-tag]` - The branch or tag you wish to deploy.


## Reverting
If, for some reason, the new deploy is not operating as expected you can quickly revert by referencing the tag you collected in Step 1.
Simply run the appropriate deploy command in the previous section with the last release tag and the new deploy will be reverted.

## Deploy Songs

- **IMPORTANT:** Make sure to play the song loud and proud when deploying!

It is the custom at Runnable to play a song to the entire team when deploying. For each of the repositories here are the respective songs:

| Service | Deploy Song Link |
| ------- | ---------------- |
| api / api-workers | [Push it - Rick Ross](https://www.youtube.com/watch?v=qk2jeE1LOn8) |
| arithmancy | [onerepublic - Counting Stars](https://www.youtube.com/watch?v=hT_nvWreIhg) |
| big poppa | [Big Poppa - The Notorious B.I.G.](https://www.youtube.com/watch?v=phaJXp_zMYM) |
| charon | [Enter Sandman - Metallica](https://www.youtube.com/watch?v=CD-E-LDc384) |
| clio | [Billy Joel - We Didn't Start the Fire](https://www.youtube.com/watch?v=eFTLKWw542g) |
| cream | [C.R.E.A.M. - Wu-Tang Clan](https://www.youtube.com/watch?v=PBwAxmrE194) |
| deployer | [Roll our](https://www.youtube.com/watch?v=t21DFnu00Dc) |
| detention | [Unbreakable Kimmy Schmidt](https://youtu.be/CV9xF8CjhJk?t=21s) |
| docker-listener | [Call Me Maybe - Carly Rae Jepsen](https://www.youtube.com/watch?v=fWNaR-rxAic) |
| drake | [Drake - Hotline Bling](https://www.youtube.com/watch?v=uxpDa-c-4Mc)
| filibuster | [He's a Pirate - Pirates Of The Caribbean](https://www.youtube.com/watch?v=yRh-dzrI4Z4) |
| Full Stack Deploy (`all.yml`) | [The Cleveland Orchestra (George Szell conducting) Ludwig von Beethoven Symphony No. 9 "Chorale (Ode To Joy)" Opus 125 IV.] (https://www.youtube.com/watch?v=4g5770gaais) |
| github-proxy | [Proxy - Martin Garrix](https://www.youtube.com/watch?v=NWB6-PJw4Mk) |
| khronos | [Time After Time - Cyndi Lauper](https://www.youtube.com/watch?v=VdQY7BusJNU) |
| krain | [Men at Work - Down Under](https://www.youtube.com/watch?v=XfR9iY5y94s) |
| link | [Zelda Main Theme Song](https://www.youtube.com/watch?v=cGufy1PAeTU) |
| mavis | [Fairy Tail theme song](https://www.youtube.com/watch?v=R4UFCTMrV-o) |
| navi | [Ocarina of Time: Lost Woods The Legend of Zelda](https://www.youtube.com/watch?v=iOGpdGEEcJM) |
| optimus | [Original Transformers Opening Theme](https://www.youtube.com/watch?v=nLS2N9mHWaw) |
| pheidi | [Chariots of Fire Theme](https://www.youtube.com/watch?v=CSav51fVlKU) |
| runnable-angular | [Push it to the limit - Scarface](https://www.youtube.com/watch?v=9D-QD_HIfjA) |
| sauron | [Sauron theme song from LOTR](https://www.youtube.com/watch?v=V_rk9VBrXMY) |
| Security Groups | [Out of the Woods - Tayor Swift](https://www.youtube.com/watch?v=JLf9q36UsBk)
| shiva | [FFXIV Shiva Theme](https://www.youtube.com/watch?v=noJiH8HLZw4) |
| starlord | [Blue Swede - Hooked on a Feeling](https://www.youtube.com/watch?v=NrI-UBIB8Jk) |
| swarm-deamon | [Pink Floyd - Another Brick In The Wall](https://www.youtube.com/watch?v=5IpYOF4Hi6Q) |
| swarm-manager | [Eric Prydz VS Pink Floyd - 'Proper Education'](https://www.youtube.com/watch?v=IttkDYE33aU) |
| varnish | [Karate Kid Theme Song](https://www.youtube.com/watch?v=VIYqtkdMxQg) |
| vault / vault-values | [Seal - Kiss From A Rose](https://www.youtube.com/watch?v=zP3so2hY4CM) |
2 changes: 2 additions & 0 deletions ansible/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_cache
*.pyc
15 changes: 15 additions & 0 deletions ansible/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

Ansible provides a framework for our administration and deployment. It requires an organization for scripts and variables. By design it uses SSH to connect to all hosts before it executes the actions. As such it can be run from any machine. All Ansible provided functionality is idempotent and it strongly encourage custom scripts match that standard.

Here is the organization of the files in `devops-scripts/ansible`

* `*-hosts` - Files naming all the servers
* `*.yml` - The top level ansible actions. These files describe how a host has vars and roles executed on it.
* `/group_vars` - yml files that define variables and values for your ansible scripts. This mostly maps one to one with machine types in AWS. They’re a key value map.
* `/library` - Third party libraries and scripts.
* `/roles` - A set of folders containing the ansible roles. A role defines the executable actions by ansible. The center pieces is the `/tasks/main.yml`. It defines name actions and requirements.
The role can have several sub folders.
* `/handlers` - ???
* `/defaults` - ???
* `/meta` - contains dependencies
* `/template` - templates for any files that need to be generate and delivered.
11 changes: 11 additions & 0 deletions ansible/agreeable-egret.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- hosts: agreeable-egret
vars_files:
- group_vars/alpha-agreeable-egret.yml
roles:
- role: notify

- role: builder

- role: k8-deployment
- role: k8-service
3 changes: 3 additions & 0 deletions ansible/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[defaults]
# Required so `sudo: yes` does not lose the environment variables, which hold the ssh-agent socket
sudo_flags = -HE
14 changes: 14 additions & 0 deletions ansible/api-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
- hosts: api
vars_files:
- group_vars/alpha-api-base.yml
- group_vars/alpha-api.yml
roles:
- role: notify
rollbar_token: "{{ api_rollbar_token }}"

- role: builder

- role: docker_client
- role: k8-deployment
- role: k8-service
3 changes: 3 additions & 0 deletions ansible/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- include: api-core.yml
- include: socket-server.yml
- include: workers.yml
6 changes: 6 additions & 0 deletions ansible/app-services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- include: detention.yml git_branch="{{ detention_branch }}"
- include: drake.yml git_branch="{{ drake_branch }}"
- include: eru.yml git_branch="{{ eru_branch }}"
- include: metis.yml git_branch="{{ astral_branch }}"
- include: shiva.yml git_branch="{{ astral_branch }}"
# run with: `--extra-vars "@current_versions.yml"`
11 changes: 11 additions & 0 deletions ansible/arithmancy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- hosts: arithmancy
vars_files:
- group_vars/alpha-arithmancy.yml
roles:
- role: notify
rollbar_token: "{{ arithmancy_rollbar_token }}"

- role: builder

- role: k8-deployment
23 changes: 23 additions & 0 deletions ansible/base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- hosts: localhost
connection: local
tasks:
- fail: msg="`host` (target host) needs to be defined to run this role"
when: host is not defined

- add_host:
name={{ host }}
groups=dock

- hosts: "{{ host }}"
roles:
- { role: apt_update }
- { role: package-dock, tags: [ dock, package ] }
- { role: package-aws, tags: [ dock, package ] }
- { role: package_ntp }
- { role: build_essential }
- { role: docker, tags: [ docker ] }
- { role: datadog, tags: [ datadog ] }
- { role: ulimits, tags: [ ulimits ] }
- { role: loggly, tags: [ loggly, clean ] }
- { role: node }
9 changes: 9 additions & 0 deletions ansible/bastion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- hosts: bastion
roles:
- role: notify
tags: [ notify ],
app_name: bastion_sshd,
git_branch: latest,
name: bastion_sshd
- { role: bastion_sshd, tags: bastion-sshd }
13 changes: 13 additions & 0 deletions ansible/big-poppa-http.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
- hosts: big-poppa
vars_files:
- group_vars/alpha-big-poppa-base.yml
- group_vars/alpha-big-poppa-http.yml
roles:
- role: notify
rollbar_token: "{{ big_poppa_http_rollbar_token }}"

- role: builder

- role: k8-deployment
- role: k8-service
12 changes: 12 additions & 0 deletions ansible/big-poppa-worker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- hosts: big-poppa
vars_files:
- group_vars/alpha-big-poppa-base.yml
- group_vars/alpha-big-poppa-worker.yml
roles:
- role: notify
rollbar_token: "{{ big_poppa_worker_rollbar_token }}"

- role: builder

- role: k8-deployment
2 changes: 2 additions & 0 deletions ansible/big-poppa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- include: big-poppa-http.yml
- include: big-poppa-worker.yml
7 changes: 7 additions & 0 deletions ansible/cadvisor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- hosts: docks
vars_files:
- "group_vars/alpha-cadvisor.yml"
roles:
- { role: notify, tags: "notify" }
- { role: container_kill_start }
10 changes: 10 additions & 0 deletions ansible/charon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- hosts: "{{ dock | default('docks') }}"
vars_files:
- group_vars/alpha-charon.yml
roles:
- { role: notify, tags: [notify] }
- { role: git_repo }
- { role: node_service }
- { role: loggly }
- { role: consul_value, tags: [consul_value] }
Loading