Skip to content

Commit 97547c1

Browse files
committed
Merge pull request #184 from CodeNow/SAN-2861
San 2861 - Gamma build
2 parents e726d0a + 53c1284 commit 97547c1

9 files changed

Lines changed: 334 additions & 1 deletion

File tree

ansible/gamma-hosts/docks.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/env node
2+
3+
'use strict';
4+
5+
var aws = require('aws-sdk');
6+
var ec2 = new aws.EC2({
7+
accessKeyId: 'AKIAJ3RCYU6FCULAJP2Q',
8+
secretAccessKey: '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',
9+
region: 'us-west-2'
10+
});
11+
12+
var params = {
13+
Filters: [
14+
// Only search for docks in the cluster security group
15+
{
16+
Name: 'instance.group-id',
17+
Values: ['sg-87ca04e3']
18+
},
19+
// Only fetch instances that are tagged as docks
20+
{
21+
Name: 'tag:role',
22+
Values: ['dock']
23+
},
24+
// Only fetch running instances
25+
{
26+
Name: 'instance-state-name',
27+
Values: ['running']
28+
}
29+
]
30+
};
31+
32+
ec2.describeInstances(params, function (err, data) {
33+
if (err) {
34+
console.error("An error occurred: ", err);
35+
process.exit(1);
36+
}
37+
38+
// Get a set of instances from the describe response
39+
var instances = [];
40+
data.Reservations.forEach(function (res) {
41+
res.Instances.forEach(function (instance) {
42+
instances.push(instance);
43+
});
44+
});
45+
46+
// Map the instances to their private ip addresses
47+
// NOTE This will work locally because of the wilcard ssh proxy in the config
48+
var hosts = instances.map(function (instance) {
49+
return instance.PrivateIpAddress;
50+
});
51+
52+
var hostVars = {};
53+
instances.forEach(function (instance) {
54+
for (var i = 0; i < instance.Tags.length; i++) {
55+
if (instance.Tags[i].Key === 'org') {
56+
hostVars[instance.PrivateIpAddress] = {
57+
host_tags: instance.Tags[i].Value + ',build,run'
58+
};
59+
}
60+
}
61+
});
62+
63+
// Output the resulting JSON
64+
// NOTE http://docs.ansible.com/ansible/developing_inventory.html
65+
console.log(JSON.stringify(
66+
{
67+
docks: {
68+
hosts: hosts
69+
},
70+
_meta : {
71+
hostvars : hostVars
72+
}
73+
}
74+
));
75+
});

ansible/gamma-hosts/hosts

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
[bastion]
2+
gamma-bastion
3+
4+
[hipache]
5+
gamma-hipache httpsCheckForBackend80=false prependIncomingPort=true subDomainDepth=4
6+
gamma-userland-hipache domain=runnable.ninja httpsCheckForBackend80=true prependIncomingPort=true subDomainDepth=3
7+
8+
[mongodb]
9+
gamma-mongo-us-west-2a
10+
gamma-mongo-us-west-2b
11+
gamma-mongo-us-west-2c
12+
13+
[neo4j]
14+
gamma-neo4j
15+
16+
[api_group:children]
17+
worker
18+
api
19+
20+
[api]
21+
gamma-api
22+
23+
[worker]
24+
gamma-api
25+
26+
[eru]
27+
gamma-services
28+
29+
[navi]
30+
gamma-services
31+
32+
[charon]
33+
gamma-services
34+
35+
[khronos]
36+
gamma-services
37+
38+
[mavis]
39+
gamma-services
40+
41+
[optimus]
42+
gamma-services
43+
44+
[detention]
45+
gamma-services
46+
47+
[palantiri]
48+
gamma-services
49+
50+
[rabbitmq]
51+
gamma-rabbit
52+
53+
[web]
54+
gamma-web
55+
56+
[redis]
57+
gamma-redis
58+
59+
[redis-slave]
60+
gamma-redis-slave
61+
62+
[shiva]
63+
gamma-services
64+
65+
[registry]
66+
gamma-registry
67+
68+
[swarm-manager]
69+
gamma-services
70+
71+
[docks]
72+
73+
[gamma:children]
74+
bastion
75+
hipache
76+
mongodb
77+
api
78+
web
79+
redis
80+
redis-slave
81+
docks
82+
registry
83+
neo4j
84+
navi
85+
charon
86+
khronos
87+
mavis
88+
optimus
89+
rabbitmq
90+
eru
91+
shiva
92+
swarm-manager
93+
94+
[targets]
95+
localhost ansible_connection=local bastion_name=gamma-bastion

ansible/gamma-hosts/variables

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
[api_group:vars]
2+
api_aws_access_key_id=AKIAIDC4WVMTCGV7KRVQ
3+
api_aws_secret_access_key=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
4+
api_github_client_id=baa5c868b6d17d7ae002
5+
api_github_client_secret=ad4f8527ae98d7eea15a32ee5abbead5c9a25abc
6+
api_github_deploy_keys_bucket=runnable.deploykeys.production-gamma
7+
api_hello_runnable_github_token=88ddc423c2312d02a8bbcaad76dd4c374a30e4af
8+
api_mixpanel_app_id=c41affa4b08818443365c526cbb51606
9+
api_mongo_auth=api:oW4c7x9Wiv28oiNBy2Bc
10+
api_mongo_database=gamma
11+
api_mongo_replset_name=gamma
12+
api_neo4j_auth=neo4j:oqGlRV1KTpaqbHDkdlJz
13+
api_new_relic_app_name=gamma-api-production
14+
api_rollbar_key=a90d9c262c7c48cfabbd32fd0a1bc61c
15+
api_s3_context_bucket=runnable.context.resources.production-gamma
16+
17+
[docks:vars]
18+
docker_config=docks
19+
20+
[eru:vars]
21+
eru_github_id=8abb08f83f6d1c52bd1a
22+
eru_github_secret=74a23ee56486d57b14f292283cb04625f600917c
23+
24+
[khronos:vars]
25+
khronos_mongo_auth=api:oW4c7x9Wiv28oiNBy2Bc
26+
khronos_mongo_database=gamma
27+
khronos_mongo_replset_name=gamma
28+
29+
[optimus:vars]
30+
optimus_aws_access_id=AKIAJPA2ZYSVVA5V7XXQ
31+
optimus_aws_secret_id=5V70AUxfIyHeLvlYZe0xaYevDAdgTOWOn5G7nHlt
32+
optimus_github_deploy_keys_bucket=runnable.deploykeys.production-gamma
33+
34+
[palantiri:vars]
35+
palantiri_rollbar_key=f675e9090d6f483ca4e742af2c7f2f83
36+
37+
[registry:vars]
38+
registry_s3_access_key=AKIAJZQHOFYKTZP52XCQ
39+
registry_s3_bucket=runnableimages.gamma
40+
registry_s3_secret_key=iOKNwff7HhUnTmHxt1HrJj1lUkrccZTqWvrKi54C
41+
registry_s3_region=us-west-2
42+
43+
[shiva:vars]
44+
aws_access_key_id=AKIAJ3RCYU6FCULAJP2Q
45+
aws_secret_access_key=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
46+
shiva_rollbar_key=0526a90faec845d796e1ef5361a00526
47+
48+
[gamma:vars]
49+
ansible_ssh_private_key_file=~/.ssh/gamma.pem
50+
datadog_host=10.4.6.251
51+
datadog_tags=env:gamma
52+
domain=runnable-gamma.com
53+
new_relic_license_key=338516e0826451c297d44dc60aeaf0a0ca4bfead
54+
node_env=production-gamma
55+
pg_host=gamma-infrastructure-db.cnksgdqarobf.us-west-2.rds.amazonaws.com
56+
pg_pass=QBjSpAXVYwmGHu4Y
57+
rabbit_password=wKK7g7NWKpQXEeSzyWB7mIpxZIL8H2mDSf3Q6czR3Vk
58+
rabbit_username=o2mdLh9N9Ke2GzhoK8xsruYPhIQFN7iEL44dQJoq7OM
59+
registry_host=10.4.4.82
60+
swarm_token=d363b783f03a845a2c82b081bfe8443e
61+
user_content_domain=runnable.ninja

ansible/group_vars/alpha-hipache.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# container_kill_start settings
22
name: hipache
3+
redis_host: "{{ hostvars[groups['redis'][0]]['ansible_default_ipv4']['address'] }}"
4+
redis_port: 6379
35

46
container_image: registry.runnable.com/runnable/hipache
57
container_tag: latest

ansible/group_vars/alpha-redis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# database vars
22
name: redis
33
db_path: "/opt/redis/db"
4+
redis_host: "{{ hostvars[groups['redis'][0]]['ansible_default_ipv4']['address'] }}"
45

56
# container_kill_start settings
67
container_image: redis

ansible/hipache.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
---
2+
- hosts: redis
3+
24
- hosts: hipache
35
vars_files:
46
- "group_vars/alpha-hipache.yml"

ansible/redis-slave.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
- hosts: redis
23
- hosts: redis-slave
34
vars_files:
45
- "group_vars/alpha-redis.yml"

ansible/roles/docker/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
- name: install docker
4949
sudo: yes
5050
when: restart is defined
51-
action: apt pkg="{{ docker_package_name }}" state=present update_cache=yes
51+
apt: pkg="{{ docker_package_name }}" state=present update_cache=yes force=yes
5252

5353
- name: restart docker
5454
when: copied_config.changed and restart is defined

ssh/config

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ Host beta*
1010
StrictHostKeyChecking no
1111
IdentityFile ~/.ssh/oregon.pem
1212

13+
Host gamma*
14+
User ubuntu
15+
ForwardAgent yes
16+
StrictHostKeyChecking no
17+
Identityfile ~/.ssh/gamma.pem
18+
1319
################################################################################
1420
# production runnable.io
1521
################################################################################
@@ -169,6 +175,96 @@ Host beta-rabbit
169175
Host beta-web
170176
ProxyCommand ssh -q ubuntu@beta-bastion nc 10.20.1.61 22
171177

178+
################################################################################
179+
# Gamma
180+
################################################################################
181+
182+
Host gamma-bastion
183+
HostName 54.69.34.161
184+
185+
Host 10.4.*.*
186+
User ubuntu
187+
ForwardAgent yes
188+
StrictHostKeyChecking no
189+
ProxyCommand ssh -o StrictHostKeyChecking=no -q ubuntu@gamma-bastion nc %h %p
190+
IdentityFile ~/.ssh/gamma.pem
191+
192+
## Gamma Userland Hipache
193+
Host gamma-userland-hipache
194+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.0.141 22
195+
196+
Host gamma-user-us-west-2a
197+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.0.141 22
198+
199+
## Gamma App Hipache
200+
Host gamma-hipache
201+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.0.209 22
202+
203+
Host gamma-hipache-us-west-2a
204+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.0.209 22
205+
206+
## Gamma API
207+
Host gamma-api
208+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.4.188 22
209+
210+
Host gamma-api-us-west-2a
211+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.4.188 22
212+
213+
## Gamma MongoDB
214+
Host gamma-mongo-us-west-2a
215+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.7.144 22
216+
217+
Host gamma-mongo-us-west-2b
218+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.10.57 22
219+
220+
Host gamma-mongo-us-west-2c
221+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.15.18 22
222+
223+
## Gamma Rabbit
224+
Host gamma-rabbit
225+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.19.17 22
226+
227+
## Gamma Redis
228+
Host gamma-redis
229+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.6.45 22
230+
231+
Host gamma-redis-us-west-2a
232+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.6.45 22
233+
234+
Host gamma-redis-slave
235+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.10.84 22
236+
237+
Host gamma-redis-us-west-2b
238+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.10.84 22
239+
240+
## Gamma Neo4J
241+
Host gamma-neo4j
242+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.4.210 22
243+
244+
Host gamma-neo4j-us-west-2a
245+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.4.210 22
246+
247+
## Gamma Services
248+
Host gamma-services-us-west-2a
249+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.6.251 22
250+
251+
Host gamma-services
252+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.6.251 22
253+
254+
## Gamma Registry
255+
Host gamma-registry-us-west-2a
256+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.4.82 22
257+
258+
Host gamma-registry
259+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.4.82 22
260+
261+
## Gamma Web
262+
Host gamma-web-us-west-2a
263+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.6.121 22
264+
265+
Host gamma-web
266+
ProxyCommand ssh -q ubuntu@gamma-bastion nc 10.4.6.121 22
267+
172268
################################################################################
173269
# other
174270
################################################################################

0 commit comments

Comments
 (0)