Skip to content

Commit 68a985d

Browse files
author
Anandkumar Patel
committed
add nginx and reggi to gamma
1 parent 26695cb commit 68a985d

15 files changed

Lines changed: 250 additions & 16 deletions

File tree

ansible/api-core.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,18 @@
1616
- role: notify
1717
rollbar_token: "{{ api_rollbar_key }}"
1818
tags: [ notify ]
19-
- { role: redis_key, tags: [ setup, redis_key ] }
20-
- { role: builder, tags: [ build ] }
21-
- { role: docker_client }
22-
- { role: tls-client, tls_service: mongodb, tags: [ tls ] }
23-
- { role: datadog, tags: [ datadog ] }
24-
- { role: container_start }
19+
20+
- role: builder
21+
tags: [ build ]
22+
23+
- role: docker_client
24+
25+
- role: tls-client
26+
tags: [ tls ]
27+
tls_service: mongodb
28+
29+
- role: datadog
30+
tags: [ datadog ]
31+
32+
- role: container_start
33+
number_of_containers: "{{ ansible_processor_cores }}"

ansible/consul-template-updater.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
- hosts: consul
33

4-
- hosts: userland
4+
- hosts: "{{ host }}"
55
vars_files:
66
- group_vars/{{ var_file }}
77
- group_vars/alpha-consul-template-updater.yml

ansible/gamma-hosts/hosts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ gamma-app-services
4545
[navi]
4646
gamma-navi
4747

48+
[ingress]
49+
gamma-ingress
50+
4851
[link]
4952
gamma-navi
5053

@@ -127,6 +130,7 @@ drake
127130
eru
128131
github-varnish
129132
hipache
133+
ingress
130134
khronos
131135
mavis
132136
metis
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: nginx
3+
4+
# used by consul template updater
5+
proxy_service_name: api
6+
target_container_name: nginx
7+
target_updater_file_path: /etc/nginx/sites-enabled
8+
template_command: /bin/docker kill -s HUP {{ target_container_name }}
9+
template_path: /etc/nginx/template/api.tmpl
10+
11+
# used by container_kill_start
12+
container_image: "{{ name }}"
13+
container_tag: "1.10"
14+
15+
restart_policy: always
16+
17+
container_run_opts: >
18+
-d
19+
--name {{ name }}
20+
-p 0.0.0.0:443:443
21+
-p 0.0.0.0:80:80
22+
-v /etc/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
23+
-v {{ target_updater_file_path }}
24+
-v /etc/ssl/certs/{{ domain }}:/etc/ssl/certs/{{ domain }}:ro
25+
-v /var/log/nginx:/var/log/nginx

ansible/ingress-proxy.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
- hosts: ingress
3+
vars_files:
4+
- group_vars/alpha-ingress-proxy.yml
5+
roles:
6+
- role: datadog
7+
has_dd_integration: yes
8+
9+
- role: runnable-domain-proxy
10+
11+
- role: container_kill_start
12+
13+
- include: consul-template-updater.yml
14+
vars:
15+
host: ingress
16+
var_file: alpha-ingress-proxy.yml

ansible/navi-proxy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212

1313
- include: consul-template-updater.yml
1414
vars:
15+
host: ingress
1516
var_file: alpha-navi-proxy.yml

ansible/registrator-api.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
- hosts: consul
3+
4+
- hosts: api
5+
vars_files:
6+
- group_vars/alpha-registrator.yml
7+
roles:
8+
- role: notify
9+
tags: notify
10+
11+
- role: container_kill_start

ansible/roles/container_kill_start/files/findTagRunning.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env bash
22

33
IMAGE_NAME="$1"
4-
CONTAINERS=`docker ps | grep -v '^CONTAINER' | awk '{print $1}'`
4+
CONTAINERS=`docker ps -a | grep -v '^CONTAINER' | awk '{print $1}'`
55

66
if [ "" = "${CONTAINERS}" ] ; then
77
exit 0
88
else
99
for container in ${CONTAINERS} ; do
10-
docker inspect "${container}" | grep -q '"Image": "'"${IMAGE_NAME}":
10+
docker inspect "${container}" 2>/dev/null| grep -q '"Image": "'"${IMAGE_NAME}": > /dev/null 2>&1
1111
if [ ${?} -eq 0 ] ; then
1212
if [ -z "${RUNNING_CONTAINERS}" ] ; then
1313
RUNNING_CONTAINERS="${container}"
@@ -19,5 +19,5 @@ else
1919
fi
2020

2121
if [ ! -z "${RUNNING_CONTAINERS}" ] ; then
22-
echo "${RUNNING_CONTAINERS}"
22+
echo "${RUNNING_CONTAINERS//['\t\r\n']}"
2323
fi

ansible/roles/container_kill_start/tasks/main.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
become: true
2323
script: findTagRunning.sh {{ container_image }}
2424
register: old_containers_id
25-
changed_when: old_containers_id.stdout != ''
25+
changed_when: old_containers_id.stdout | length > 4
2626

2727
# get latest image
2828
# tag will default to latest
@@ -48,16 +48,14 @@
4848
tags: deploy
4949
when: old_containers_id.changed
5050
become: yes
51-
command: docker stop -t {{ stop_time }} {{ item }}
52-
with_items: "{{ old_containers_id.stdout_lines }}"
51+
command: docker stop -t {{ stop_time }} {{ old_containers_id.stdout }}
5352

5453
# remove the old containers that were running previously
5554
- name: remove old containers
5655
tags: deploy
5756
when: old_containers_id.changed
5857
become: yes
59-
command: docker rm {{ item }}
60-
with_items: "{{ old_containers_id.stdout_lines }}"
58+
command: docker rm {{ old_containers_id.stdout }}
6159

6260
- name: pause to allow for any odd conditions in system caching tables
6361
tags: deploy

0 commit comments

Comments
 (0)