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

moving krain off the docks #345

Open
wants to merge 1,427 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1427 commits
Select commit Hold shift + click to select a range
3d3817a
Moved full stack deploy into table at the bottom.
Jan 25, 2016
1ac57ed
Merge pull request #285 from CodeNow/SAN-3340-consul-sg-changes
und1sk0 Jan 25, 2016
3ac4955
added get-url and unzip
kaushikanurag Jan 25, 2016
f4b8518
Latest master -> latest tag
Jan 26, 2016
02f6167
kill delta-admin
Jan 26, 2016
f069bbd
Merge pull request #290 from CodeNow/no-admin
Jan 26, 2016
afbb314
add unzip for api tool
kaushikanurag Jan 26, 2016
e176e6e
Update to latest branch and move ec2-api-toool to ec2
kaushikanurag Jan 26, 2016
b522846
correct typo
kaushikanurag Jan 26, 2016
b8d0ef7
Merge pull request #289 from CodeNow/readme-updates
bkendall Jan 26, 2016
7046c06
changes to rollbar token from file to variable
kaushikanurag Jan 26, 2016
6d59caa
changes to fix errors
kaushikanurag Jan 26, 2016
60cf613
Delete.
Jan 26, 2016
98c6811
move datadog above git_repo
kaushikanurag Jan 26, 2016
41a6233
Merge branch 'fix-stage-configs' of github.com:CodeNow/devops-scripts…
kaushikanurag Jan 26, 2016
a1c0210
Merge pull request #264 from CodeNow/fix-stage-configs
Jan 27, 2016
8dc1981
Add apt-get update before running any playbook
kaushikanurag Jan 27, 2016
9c2286c
added apt-get update
kaushikanurag Jan 27, 2016
e1abd73
added apt-get update
kaushikanurag Jan 27, 2016
470d3ee
added apt-get update in git_role
kaushikanurag Jan 27, 2016
96c7caa
Add Docker upstart override.
Jan 27, 2016
21e3a83
missed a variable
kaushikanurag Jan 27, 2016
c9658be
Link instead of move.
Jan 27, 2016
2089181
Merge branch 'docker-init-hotfix' of github.com:CodeNow/devops-script…
Jan 27, 2016
80f2e52
Permissions for RSA key.
Jan 27, 2016
98a0316
RSA key is owned by root.
Jan 27, 2016
480e1cb
YAML syntax.
Jan 27, 2016
b3e4582
do not copy docker certs unless you are deploying dock
Jan 27, 2016
bd5b4a7
Merge pull request #292 from CodeNow/hotfix-no-cert-copy
Jan 27, 2016
957351e
modified permission on tokens
kaushikanurag Jan 27, 2016
80ae88b
bake in users
Jan 27, 2016
5115107
remove NCC user and Mr. Flynn, add delete task.
Jan 28, 2016
65aeec7
Syntax error in user delete task.
Jan 28, 2016
42e3801
Merge branch 'master' into docker-init-hotfix
Jan 28, 2016
fe04996
Group permissions must by root.
Jan 28, 2016
eccee07
fscking ssh config
Jan 28, 2016
317ff52
Merge pull request #291 from CodeNow/SAN-3337-apt-get-update
Jan 28, 2016
129aa00
sneaking in the NCC key, remove later.
Jan 28, 2016
9ae99e3
(presto magic, ncc was never here)
Jan 28, 2016
c0b9762
Merge branch 'master' into docker-init-hotfix
Jan 28, 2016
16f9531
removed obliterate dock
kaushikanurag Jan 28, 2016
4f08b80
Merge pull request #294 from CodeNow/SAN-3360-stop-kill-dock
Jan 29, 2016
98c66ad
Merge pull request #293 from CodeNow/docker-init-hotfix
Jan 29, 2016
4554415
update swarm cert
Jan 29, 2016
42b296b
Initial checkin
Feb 1, 2016
e80e2c5
ensure latest versions are used
Feb 1, 2016
fe67899
ensure dock is not defined for consul update
Feb 1, 2016
9b31676
Merge pull request #295 from CodeNow/remove-hardcode
Feb 2, 2016
cd7f8bc
Adding hosts.
Feb 2, 2016
bd2ad31
Merge branch 'master' into epsilon
Feb 2, 2016
0c02221
angular should not allow ssh
Feb 2, 2016
cba55d5
Merge branch 'no-ssh-angular' into epsilon
Feb 2, 2016
c9c45da
This should cover everything.
Feb 2, 2016
d7d0415
Re-use most of "gamma" vars/tokens.
Feb 2, 2016
633724a
Correct SG for Docks.
Feb 2, 2016
8dc22e0
wrong nc command
Feb 2, 2016
88b3646
Merge pull request #296 from CodeNow/epsilon
Feb 2, 2016
2ceea58
update value to work for staging
Feb 2, 2016
84770d9
oops
Feb 2, 2016
32d903e
Merge branch 'no-ssh-angular' into epsilon
Feb 2, 2016
a018be0
Wrong VPC
Feb 2, 2016
971d3b1
Update variables with beta URL, update stack.yml
Feb 2, 2016
ad815c2
Added image for the wiki.
Feb 3, 2016
ab45e8d
Updated wiki news image.
Feb 3, 2016
3243946
Expect a pg_host variable, some versions change.
Feb 3, 2016
e0be4bf
update values
Feb 3, 2016
85ad254
revert
Feb 3, 2016
06c2946
Merge pull request #297 from CodeNow/stage-dock
und1sk0 Feb 3, 2016
3bd7a09
add api socket server
Feb 4, 2016
aed4ea9
add api socket to we
Feb 4, 2016
fe20c9b
Merge branch 'master' into epsilon
Feb 4, 2016
7ab992c
update
Feb 4, 2016
007fce2
add cookie domai
Feb 4, 2016
8933b6d
Version change for API.
Feb 4, 2016
614acfa
pg_host keeps getting clobbered.
Feb 4, 2016
99b9319
Separate the metis project in rollbar.
Feb 5, 2016
b35b856
Merge branch 'master' into epsilon
Feb 5, 2016
b7cfc61
Merge pull request #299 from CodeNow/metis-rollbar
Myztiq Feb 5, 2016
0ad2db6
add cron job for loggly monitor
Feb 5, 2016
3b6e888
github tokens changed
Feb 5, 2016
dca899b
add loggly monitor to all host
Feb 5, 2016
e79d255
loggly monitor
Feb 5, 2016
d769462
Merge pull request #300 from CodeNow/epsilon
Feb 5, 2016
e24ca75
trying other method
Feb 5, 2016
d2af8d2
Merge branch 'master' into api-socket
Feb 5, 2016
7e48e2e
Set correct rollbar key for api-workers
Feb 5, 2016
018ab37
Merge pull request #301 from CodeNow/api-workers-rollbar
bkendall Feb 5, 2016
ff3662f
change order
Feb 5, 2016
88e6ccf
update rollbar key
Feb 5, 2016
2644ca7
Merge pull request #298 from CodeNow/api-socket
und1sk0 Feb 5, 2016
e72adda
Merge pull request #288 from CodeNow/reorder-wrap
und1sk0 Feb 5, 2016
9e8ff9c
add certs
Feb 5, 2016
f62779d
Limit the number of clustered workers for api and sockets to 1.
Feb 6, 2016
1cf4c88
Merge pull request #302 from CodeNow/no-cluster-api
Feb 6, 2016
6e3bd40
Include datadog on full stack deploy, run apt-get update first.
Feb 9, 2016
9d70730
add static message to syslog
Feb 9, 2016
f31148c
adding api-socket-server
Feb 10, 2016
e0fa666
removed the delete cron task and modified the msg
Feb 10, 2016
a13802c
new certs that work for epsilon
Feb 10, 2016
3e0ed27
open all the files
Feb 10, 2016
5e0557d
few hubot updates
Feb 10, 2016
6691a85
also tweak inotify values
Feb 10, 2016
613d378
add ssh port to security group and configure the host ip for epsilon ssh
Feb 10, 2016
d3b0fe2
remove hubot
Feb 10, 2016
f6ee2a1
Merge pull request #306 from CodeNow/hubot-updates
Feb 10, 2016
d1caf5e
money
Feb 10, 2016
1b8fc87
confusing var names make tshooting hard
Feb 10, 2016
d7aa60a
and integration to api
Feb 10, 2016
dd6322d
Only explicitely reboot.
Feb 10, 2016
9f7f676
simplify how role is called
Feb 10, 2016
e03f0bd
removed the socket security group
Feb 11, 2016
f892e9a
finalizing api-socket
Feb 11, 2016
861ae97
Merge pull request #308 from CodeNow/fix_dd_var_name
Feb 11, 2016
5c5e1f7
YAML likes end }
Feb 11, 2016
a45aa9a
Merge pull request #310 from CodeNow/oops
Feb 11, 2016
ba89793
Merge pull request #303 from CodeNow/run_apt_update_first_datadog
und1sk0 Feb 11, 2016
9558501
removed the extra file
Feb 11, 2016
29728e5
Merge pull request #311 from CodeNow/SAN-3491-api-socket-server
kaushikanurag Feb 11, 2016
aba66e8
config host file changes to add new instances
Feb 11, 2016
e9cbb64
Merge pull request #307 from CodeNow/SAN-3510-ubuntu-limits
und1sk0 Feb 11, 2016
c55aa2b
Add ulimits to dock-init.
Feb 11, 2016
e217842
User data for dock AMI.
Feb 11, 2016
d17db80
Merge pull request #313 from CodeNow/add-limits-to-dock-yml
kaushikanurag Feb 11, 2016
2a97ece
Merge pull request #305 from CodeNow/swarm-certs
und1sk0 Feb 11, 2016
401c14b
removed oneoff
Feb 12, 2016
6d0fed8
Initial
Feb 12, 2016
648feca
Merge branch 'master' into SAN-3459-loggly-monitor
Feb 12, 2016
e43a951
Merge pull request #304 from CodeNow/SAN-3459-loggly-monitor
Feb 12, 2016
aabb794
Merge pull request #312 from CodeNow/SAN-3517-config-socket
Feb 12, 2016
9dfca74
needs more lasers
Feb 12, 2016
04ebc0f
still needs more lasers
Feb 12, 2016
e49faac
Change the way containers are started.
Feb 12, 2016
8be2655
first pass
Feb 13, 2016
3905ece
fix some conditional gaffes
Feb 15, 2016
98bf7a3
Somewhat important to actually set the LC.
Feb 15, 2016
5e9b59d
set lc in beastmode
Feb 15, 2016
b4eba9f
order of operations, added missing outer loop
Feb 16, 2016
847b2e1
commiting instead of stashing
Feb 16, 2016
1a933eb
some loop timing tweaks
Feb 16, 2016
5ce4d97
scale-in/out needs env
Feb 16, 2016
0ec5f08
don't back off if batch kill succeeded.
Feb 16, 2016
ce3cfac
Some comments, exit if no new instances.
Feb 16, 2016
e6d09b6
order of operations, refresh batch, kill, wait
Feb 16, 2016
e828b8d
Use findTagRunning to get container.id
Feb 16, 2016
861b512
comments? what comments?
Feb 16, 2016
9233656
Copy instead of link, change shell script modes
Feb 16, 2016
493de11
need an AMI blacklist
Feb 17, 2016
1c6d1b5
Merge pull request #314 from CodeNow/dock-init-user-data-script
Feb 17, 2016
2f7a97e
1) never kill 2) exclude staging
Feb 17, 2016
ed83709
Merge branch 'master' into SAN-3524-container-start
Feb 18, 2016
2c79ac6
fix output of findTagRunning.sh
Feb 18, 2016
137c5fe
use script module
Feb 18, 2016
d9c20be
Merge pull request #317 from CodeNow/SAN-3524-container-start
Feb 18, 2016
6a784ef
adding consul on t2 micro instance
Feb 18, 2016
e626465
will probably do delta in this branch too
Feb 18, 2016
5854581
Adding delta
Feb 19, 2016
39bc579
Didn't mean to check this in.
Feb 19, 2016
d5106a0
Merge pull request #318 from CodeNow/SAN-3543-new-api-gamma
Feb 19, 2016
fd1ef53
missing swarm_token for delta
Feb 20, 2016
71c1223
remove "swarm_token"
Feb 20, 2016
1666199
Merge pull request #319 from CodeNow/swarm_token
Feb 20, 2016
77bd913
Just send logs over TLS, nothing fancy.
Feb 23, 2016
63133b7
spelling
Feb 23, 2016
df38b99
cert must be owned by syslog user
Feb 23, 2016
e9a336f
Maintenance commit.
Feb 24, 2016
0e67294
Modified roles for new machine
Feb 24, 2016
04171a6
Had to wipe an re-init epsilon vault service.
Feb 24, 2016
ac746be
remove newrelic
Feb 25, 2016
d857fc1
Merge pull request #321 from CodeNow/rm-new-relic
und1sk0 Feb 25, 2016
61181e6
syntax woes
Feb 25, 2016
f0e5347
remove consul from sauron
Feb 25, 2016
d9d1570
update configs
Feb 25, 2016
d34b06d
add to host file
Feb 25, 2016
044d7e3
More command syntax
Feb 25, 2016
78056aa
Merge branch 'master' into SAN-2760-loggly-tls-simple
Feb 25, 2016
7f4ed7f
Merge branch 'master' into SAN-3474-rolling-thunder-schwifty
Feb 25, 2016
73582e8
add memory and prefetch
Feb 25, 2016
6384101
Merge pull request #322 from CodeNow/khronos-options
Feb 25, 2016
4fb400a
Merge pull request #323 from CodeNow/cleanup-sauron
bkendall Feb 25, 2016
23bc24d
remove redis_key from docker-listener
Feb 25, 2016
aabafc7
remove single deploy tags
Feb 26, 2016
f2d2807
remove deploy array tag
Feb 26, 2016
387dc55
remove , tags: [deploy]
Feb 26, 2016
cb8f1d4
remove , tags: deploy
Feb 26, 2016
55bf2dd
remove deploy,
Feb 26, 2016
5e7e4cd
WIP - Setting up marking and web for static hosting.
Feb 26, 2016
1123406
add deploy to right places
Feb 26, 2016
22904b4
bumped node and npm versions.
Feb 26, 2016
ca5b907
Changed npm version to default installed with node 4.3.1.
Feb 26, 2016
b203e35
Updated so static deploys are a thing and work.
Feb 26, 2016
1de65ca
Changed configuration so builds happen on a different box.
Feb 26, 2016
beb3d7c
Removed hosted ports.
Feb 26, 2016
598921a
add envs to docker-listener
Feb 26, 2016
e1544f4
Merge pull request #326 from CodeNow/SAN-3550-static-site
Myztiq Feb 26, 2016
2ac4748
We can no longer `just push it`
Feb 27, 2016
37b827f
Merge pull request #327 from CodeNow/hotfix-stop-pushing
bkendall Feb 27, 2016
207074e
Merge branch 'master' into SAN-2760-loggly-tls-simple
Feb 27, 2016
68d1976
merge with master
Feb 27, 2016
14e9285
remove deploy from web
Feb 27, 2016
aa0d241
Merge pull request #324 from CodeNow/fast-deploy
Myztiq Feb 27, 2016
df7178d
update image-builder to use deploy
Feb 29, 2016
5b31481
New delta bastion, fix bastion SG
Feb 29, 2016
064c99a
Merge pull request #329 from CodeNow/SAN-3583-bastion-infosec
Feb 29, 2016
3e6a216
Merge branch 'master' into SAN-3474-rolling-thunder-schwifty
Feb 29, 2016
9b7fc9f
Merge pull request #328 from CodeNow/update-image-build
und1sk0 Feb 29, 2016
1106682
merge with master
Feb 29, 2016
9d77caf
first pass, elimitate unnecessary port exposure
Mar 1, 2016
1d88e6b
Merge branch 'master' into SAN-2760-loggly-tls-simple
Mar 1, 2016
11e7e24
main.yml now wipes old configs
Mar 1, 2016
f0583b6
should do from cli then run stack.yml
Mar 2, 2016
cc6d96e
Merge pull request #320 from CodeNow/SAN-2760-loggly-tls-simple
und1sk0 Mar 2, 2016
905375c
Merge pull request #316 from CodeNow/SAN-3474-rolling-thunder-schwifty
und1sk0 Mar 2, 2016
c0bce4f
Merge pull request #325 from CodeNow/swarm-docker-listner
Mar 2, 2016
b93d246
add rollbar errors
podviaznikov Mar 2, 2016
2d1eba4
Merge branch 'master' into 3522-create-consul-cluster
Mar 3, 2016
fea5220
Merge pull request #330 from CodeNow/sauron-rollbar-keys
Mar 3, 2016
20b94e8
set restart_policy for conatiner start
Mar 3, 2016
1bbe73d
Merge pull request #331 from CodeNow/swarm-docker-listner
podviaznikov Mar 3, 2016
acf91f6
Merge branch 'master' into 3522-create-consul-cluster
Mar 3, 2016
bca02d9
use vault server
Mar 3, 2016
2fcd284
put consul services on only one consul client
Mar 3, 2016
4da0a5d
bump swarm
Mar 4, 2016
8b7983e
Merge pull request #334 from CodeNow/update-swarm
und1sk0 Mar 4, 2016
78cd3ed
better regex, more quotes
Mar 4, 2016
91b5441
Merge pull request #335 from CodeNow/fix
und1sk0 Mar 4, 2016
2d951ef
Merge branch 'master' into SAN-3586-docks-sg
Mar 4, 2016
5411e9e
Merge pull request #332 from CodeNow/3522-create-consul-cluster
Mar 4, 2016
3f63ab7
Merge branch 'master' into SAN-3586-docks-sg
Mar 4, 2016
2ff4707
re-add DNS
Mar 4, 2016
3ed5736
hipache->services docker ports
Mar 4, 2016
b74a772
add sudo to git pull
Nathan219 Mar 4, 2016
67af82e
Merge pull request #336 from CodeNow/krain-needs-sudo
Mar 4, 2016
2e71548
DNS ports back out
Mar 4, 2016
07aa010
Merge pull request #333 from CodeNow/SAN-3586-docks-sg
Mar 4, 2016
6d92e72
Revert "first pass, elimitate unnecessary port exposure"
Mar 4, 2016
82b8685
Merge pull request #337 from CodeNow/revert-333-SAN-3586-docks-sg
Mar 4, 2016
731874f
Optimus to use node 4
Mar 7, 2016
6aec799
Merge pull request #338 from CodeNow/optimus-es6
rsandor Mar 7, 2016
7a9b3d1
remove the pinning file
Mar 8, 2016
af97edc
remove ref to docker 1.9
Mar 8, 2016
dd9a3c3
removed defaults folder and hardcode docker package in task
Mar 8, 2016
ec18ef9
add back variable to control the version of docker
Mar 8, 2016
fa1f028
install specific version
Mar 8, 2016
dad9843
add --- for yml
Mar 8, 2016
73e8a29
Merge pull request #342 from CodeNow/SAN-3596-upgrade-docker-latest
Mar 8, 2016
2cce902
New Gamma consul cluster.
Mar 9, 2016
20b91d0
Merge pull request #344 from CodeNow/SAN-3586-new-gamma-consul-cluster
Mar 9, 2016
3da9d70
moving krain off the dock
podviaznikov Mar 9, 2016
baea257
minor
podviaznikov Mar 9, 2016
de998fe
more changes to move krain to the services
podviaznikov Mar 9, 2016
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
  •  
  •  
  •  
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
*.pem
pass
hellorunnable
dump.rdb
erl_crash.dump
npm-debug.log
ca.srl
.DS_Store
ansible/roles/hipache/templates/runnable*
ansible/certs/*
139 changes: 138 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,141 @@
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 (the deploy automation tool we use to deploy projects to production)
http://docs.ansible.com/intro_installation.html

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 “Keys of Power” from someone who can already deploy (ask Anand if you don’t know). Depending on what you want to deploy you'll receive either `Test-runnable.pem`, `oregon.pem`, or both.

5. Move the “Keys of Power” .pem files to your `~/.ssh` directory

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.

#### 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.

##### Command
```
ansible-playbook -i ./[inventory_dir] [service-playbook]
```

##### 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
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]
```

##### 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, ex:
- `-e git_branch=v1.9.9` (version tag)
- `-e git_branch=my-feature-branch` (branch)
- `-e git_branch=3928745892364578623` (specific commit)


#### Redeploy Tag or Branch (No Build)
Redeploy the given tag or branch without building the docker image. This is useful for when a redeploy
is required, but it is of an already built image (e.g. when a service runs out of memory).

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

##### 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.

##### 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) |
| charon | [Enter Sandman - Metallica](https://www.youtube.com/watch?v=CD-E-LDc384) |
| 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) |
| filibuster | [He's a Pirate - Pirates Of The Caribbean](https://www.youtube.com/watch?v=yRh-dzrI4Z4) |
| 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) |
| 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) |
| shiva | [FFXIV Shiva Theme](https://www.youtube.com/watch?v=noJiH8HLZw4) |
| 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) |
| vault / vault-values | [Seal - Kiss From A Rose](https://www.youtube.com/watch?v=zP3so2hY4CM) |
| 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) |
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.
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
20 changes: 20 additions & 0 deletions ansible/api-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
- hosts: mongodb
- hosts: neo4j
- hosts: navi
- hosts: charon
- hosts: rabbitmq
- hosts: redis
- hosts: swarm-manager

- hosts: api
vars_files:
- "group_vars/alpha-api-base.yml"
- "group_vars/alpha-api.yml"
roles:
- { role: notify, tags: "notify" }
- { role: redis_key, tags: ["setup", "redis_key"] }
- { role: builder, tags: "build" }
- { role: docker_client }
- { role: datadog, tags: "datadog" }
- { role: container_start }
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
13 changes: 13 additions & 0 deletions ansible/charon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
- hosts: redis
- hosts: consul

- hosts: "{{ dock | default('docks') }}"
vars_files:
- group_vars/alpha-charon.yml
roles:
- { role: notify, tags: [notify] }
- { role: git_repo }
- { role: node_service }
- { role: loggly-rotate }
- { role: consul_value, tags: [consul_value] }
7 changes: 7 additions & 0 deletions ansible/consul-services.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- hosts: rabbitmq
- hosts: redis

- hosts: consul
roles:
- { role: consul-services }
32 changes: 32 additions & 0 deletions ansible/consul-values.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
- hosts: consul
vars_files:
- "group_vars/alpha-consul.yml"
tasks:
- name: make sure httplib2 is installed
sudo: yes
apt: package=python-httplib2 state=present

- name: put values into consul
run_once: true
when: write_values is defined
uri:
method=PUT
url=http://{{ ansible_default_ipv4.address }}:8500/v1/kv/{{ item.key }}
body="{{ item.value }}"
with_items: "{{ consul_seed }}"

- name: get values from consul
run_once: true
when: read_values is defined
uri:
method=GET
url=http://{{ ansible_default_ipv4.address }}:8500/v1/kv/{{ item.key }}
with_items: "{{ consul_seed }}"
register: values

- name: print values to screen
run_once: true
when: read_values is defined
debug: msg="{{ item.item.key }}" -> "{{ item.json[0].Value | b64decode }}"
with_items: "{{ values.results }}"
9 changes: 9 additions & 0 deletions ansible/consul.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
- hosts: consul
serial: 1
vars_files:
- group_vars/alpha-consul.yml
roles:
- { role: notify, tags: notify }
- { role: database }
- { role: container_kill_start }
6 changes: 6 additions & 0 deletions ansible/datadog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- hosts: all
roles:
- { role: base_ubuntu }
- { role: apt_update }
- { role: datadog, tags: ["datadog"] }
75 changes: 75 additions & 0 deletions ansible/delta-hosts/docks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/env node

'use strict';

var aws = require('aws-sdk');
var ec2 = new aws.EC2({
accessKeyId: 'AKIAJ3RCYU6FCULAJP2Q',
secretAccessKey: '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',
region: 'us-west-2'
});

var params = {
Filters: [
// Only search for docks in the cluster security group
{
Name: 'instance.group-id',
Values: ['sg-6cd7fb08']
},
// Only fetch instances that are tagged as docks
{
Name: 'tag:role',
Values: ['dock']
},
// Only fetch running instances
{
Name: 'instance-state-name',
Values: ['running']
}
]
};

ec2.describeInstances(params, function (err, data) {
if (err) {
console.error("An error occurred: ", err);
process.exit(1);
}

// Get a set of instances from the describe response
var instances = [];
data.Reservations.forEach(function (res) {
res.Instances.forEach(function (instance) {
instances.push(instance);
});
});

// Map the instances to their private ip addresses
// NOTE This will work locally because of the wilcard ssh proxy in the config
var hosts = instances.map(function (instance) {
return instance.PrivateIpAddress;
});

var hostVars = {};
instances.forEach(function (instance) {
for (var i = 0; i < instance.Tags.length; i++) {
if (instance.Tags[i].Key === 'org') {
hostVars[instance.PrivateIpAddress] = {
host_tags: instance.Tags[i].Value + ',build,run'
};
}
}
});

// Output the resulting JSON
// NOTE http://docs.ansible.com/ansible/developing_inventory.html
console.log(JSON.stringify(
{
docks: {
hosts: hosts
},
_meta : {
hostvars : hostVars
}
}
));
});
Loading