Skip to content

Commit 10b5ec1

Browse files
author
Anandkumar Patel
committed
remove ip tables, add config file back
1 parent 839affa commit 10b5ec1

6 files changed

Lines changed: 64 additions & 13 deletions

File tree

ansible/dock-init.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
roles:
1313
- { role: notify, tags: [notify] }
1414
- { role: docker, tags: [docker] }
15-
- { role: iptables, tags: [iptables, security] }
1615
- { role: datadog }
1716
- { role: git_repo, tags: [deploy] }
1817
- { role: dock-init, tags: [deploy] }

ansible/group_vars/alpha-docker-listener.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ enviroment_vars:
1010
RABBITMQ_PASSWORD: "{{ rabbit_password }}"
1111
RABBITMQ_PORT: "{{ rabbit_port }}"
1212
RABBITMQ_USERNAME: "{{ rabbit_username }}"
13-
REDIS_IPADDRESS: "{{ redis_host_address }}"
14-
REDIS_PORT: "{{ redis_port }}"
1513

1614
# consul values
1715
consul_values:

ansible/roles/dock-init/tasks/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
- name: copy vault auth files
66
tags: vault_files
7-
sudo: yes
87
lineinfile:
98
dest="/opt/runnable/dock-init/consul-resources/vault/{{ node_env }}/{{ item.file_name }}"
109
line="{{ item.value }}"

ansible/roles/node_service/tasks/main.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
11
---
22
- name: remove node_modules
3+
tags: deploy
34
when: remove_node_modules is defined
45
file:
56
path=/opt/runnable/{{ app_name }}/node_modules
67
state=absent
78

89
- name: npm install {{ app_name }}
10+
tags: deploy
911
npm:
1012
path=/opt/runnable/{{ app_name }}
1113
state=latest
1214
production=yes
1315

14-
- name: add env to configs
15-
tags: 'update_configs'
16+
- name: create new config file
1617
sudo: yes
17-
when: enviroment_vars is defined
18-
with_dict: "{{ enviroment_vars }}"
19-
lineinfile:
18+
template:
19+
src=upstart.conf
2020
dest=/etc/init/{{ app_name }}.conf
21-
regexp="env {{ item.key }}"
22-
insertafter="env NPM_BIN"
23-
line="env {{ item.key }}={{ item.value }}"
24-
state=present
21+
backup=yes
22+
23+
- name: make override file
24+
tags: deploy
25+
sudo: yes
26+
lineinfile:
27+
dest="/etc/init/{{ app_name }}.override"
28+
line="manual"
29+
create=yes
2530

2631
- name: restart service {{ app_name }}
32+
tags: deploy
2733
sudo: yes
34+
when: dock is not defined
2835
service:
2936
name={{ app_name }}
3037
state=restarted
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!upstart
2+
description "{{ app_name }}"
3+
author "Anandkumar Patel"
4+
5+
env NPM_BIN=/usr/local/bin/npm
6+
env APP_DIR=/opt/runnable/{{ app_name }}
7+
env LOG_FILE=/var/log/{{ app_name }}.log
8+
env NODE_ENV={{ node_env }}
9+
10+
{% if enviroment_vars is defined %}
11+
{% for name, value in enviroment_vars.iteritems() %}
12+
env {{ name }}={{ value }}
13+
{% endfor %}
14+
{% endif %}
15+
16+
start on (local-filesystems and net-device-up IFACE=eth0)
17+
stop on shutdown
18+
19+
script
20+
touch $LOG_FILE
21+
chdir $APP_DIR
22+
echo $$ > /var/run/{{ app_name }}.pid
23+
exec $NPM_BIN start >> $LOG_FILE 2>&1
24+
end script
25+
26+
pre-start script
27+
# Date format same as (new Date()).toISOString() for consistency
28+
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> $LOG_FILE
29+
end script
30+
31+
pre-stop script
32+
rm /var/run/{{ app_name }}.pid
33+
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> $LOG_FILE
34+
end script
35+
36+
post-start script
37+
echo "===== App restarted =====" >> $LOG_FILE
38+
end script
39+
40+
respawn
41+
respawn limit 5 1 # give up restart after 5 respawns in 1 seconds

ansible/stage-hosts/variables

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
[stage:vars]
2+
api_hostname=api-staging-codenow.runnableapp.com
23
aws_access_key_id=AKIAJ3RCYU6FCULAJP2Q
34
aws_secret_access_key=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
45
consul_host_address=consul-server-staging-codenow.runnableapp.com
6+
detention_hostname=detention-staging-codenow.runnableapp.com
57
domain=runnable-angular-staging-codenow.runnableapp.com
8+
eru_hostname=admin-staging-codenow.runnableapp.com
9+
fluffy_hostname=fluffy-staging-codenow.runnableapp.com
10+
mavis_hostname=mavis-staging-codenow.runnableapp.com
611
node_env=stageing
12+
optimus_hostname=optimus-staging-codenow.runnableapp.com
713
rabbit_password=h7n972sPLs5tWGCWe6QPSCnaxDWjvnpEFEA9c9mBqauH3f22
814
rabbit_username=5WE5wsEQmfw9sLsppJ4CEq9Auea8mPC4kgVt3xYqKxbYHPfP
915
registry_host=10.8.4.126
16+
user_content_domain=runnable3.net
1017
vault_auth_token=ff3b5003-5949-5d7d-7c0d-4fa21efe6666
1118
vault_token_01=c9dd02cd0f28aaeb8b819d50d2b7b274dab5ddc7fc64871a979bcb4472c9355501
1219
vault_token_02=15cc2b24a82fd3876476dd28b48756f56b4a78d2a23d18f0faca390aaf17092e02

0 commit comments

Comments
 (0)