Skip to content

Commit 3a73724

Browse files
author
Myztiq
committed
Merge remote-tracking branch 'origin/master' into remove-shrinkwrap-from-api
# Conflicts: # ansible/roles/docker/tasks/main.yml
2 parents f02a0a9 + ac5fca8 commit 3a73724

22 files changed

Lines changed: 62 additions & 69 deletions

File tree

ansible/group_vars/all.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ loggly_username: ops
3232
## cores and logs
3333
##
3434

35+
app_log_dir: /var/log
3536
core_file_dir: /var/log/core
3637

3738
##

ansible/group_vars/alpha-khronos.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,23 @@ npm_version: 2
88

99
# for cron job
1010
# this is the list of queues we want to enqueue a job into
11-
cron_queues: khronos:containers:orphan:prune khronos:context-versions:prune-expired khronos:images:prune khronos:weave:prune
11+
main_cron_queues: "\
12+
khronos:containers:orphan:prune \
13+
khronos:context-versions:prune-expired \
14+
khronos:images:prune \
15+
khronos:weave:prune"
16+
17+
canary_cron_queues: "\
18+
khronos:canary:build \
19+
khronos:canary:github-branch \
20+
khronos:canary:log \
21+
khronos:canary:network \
22+
khronos:metrics:container-status"
23+
1224
# a nice version of the rabbitmq host
1325
cron_rabbit_host_address: "{{ rabbit_host_address }}:{{ rabbit_port }}"
1426
# a quick version of authentication for rabbit for cron
1527
cron_rabbit_auth: --username {{ rabbit_username }} --password {{ rabbit_password }}
16-
# this is the command we want to run in the container.
17-
cron_command: "bash -c \"for QUEUE in {{ cron_queues }}; do /khronos/bin/cli.js --queue \\$QUEUE --job '{}' --host {{ cron_rabbit_host_address }} {{ cron_rabbit_auth }}; done\""
18-
# This is the build canary cron command
19-
cron_build_canary_command: "/khronos/bin/cli.js --queue khronos:canary:build --job '{}' --host {{ cron_rabbit_host_address }} {{ cron_rabbit_auth }}"
20-
# This is the log canary cron command
21-
cron_log_canary_command: "/khronos/bin/cli.js --queue khronos:canary:log --job '{}' --host {{ cron_rabbit_host_address }} {{ cron_rabbit_auth }}"
22-
# This is the github-branch canary cron command
23-
cron_github_branch_canary_command: "/khronos/bin/cli.js --queue khronos:canary:github-branch --job '{}' --host {{ cron_rabbit_host_address }} {{ cron_rabbit_auth }}"
24-
cron_container_metrics_command: "/khronos/bin/cli.js --queue khronos:metrics:container-status --job '{}' --host {{ cron_rabbit_host_address }} {{ cron_rabbit_auth }}"
2528

2629
# for container settings
2730
container_envs: >
@@ -61,5 +64,3 @@ container_run_opts: >
6164
-v /opt/ssl/mongo-client:/opt/ssl/mongo-client:ro
6265
--memory=1500m
6366
{{container_envs}}
64-
65-
npm_start_command: run start-json-output

ansible/group_vars/alpha-vault.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ container_run_opts: >
1414
-v /opt/runnable/vault/vault.hcl:/vault.hcl:ro
1515
-v /opt/vault/client-consul:/opt/vault/client-consul:ro
1616
-v /opt/vault/server:/opt/vault/server:ro
17-
-v /var/log:/var/log:rw
17+
-v {{ app_log_dir }}:{{ app_log_dir }}:rw
1818
-p {{ ansible_default_ipv4.address }}:8200:8200
1919
-p {{ ansible_default_ipv4.address }}:8201:8201
2020
--cap-add IPC_LOCK

ansible/roles/builder/templates/basic_node/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ RUN {{ command }}
3939
{% endif %}
4040

4141
# Define default command.
42-
CMD ulimit -c unlimited && /usr/local/bin/npm {{ npm_start_command | default('start') }} > /var/log/{{ name }}.log 2>&1
42+
CMD ulimit -c unlimited && /usr/local/bin/npm {{ npm_start_command | default('start') }} > {{ app_log_dir }}/{{ name }}.log 2>&1

ansible/roles/container_kill_start/tasks/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
command: >
6565
sudo docker run
6666
--log-driver={{ log_driver | default("none")}}
67-
-v /var/log:/var/log:rw
67+
-v {{ app_log_dir }}:{{ app_log_dir }}:rw
68+
-v /dev/log:/dev/log:rw
6869
--restart={{ restart_policy | default('always') }}
6970
{{ container_run_opts}}
7071
{{ container_image }}:{{ container_tag }}

ansible/roles/container_start/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
- name: start new container
3030
tags: deploy
31-
shell: for i in {{ '{' }}1..{{ number_of_containers }}{{ '}' }}; do sudo docker run --log-driver=none -v /var/log:/var/log:rw --restart={{ restart_policy | default('no') }} {{ container_run_opts }} {{ container_image }}:{{ container_tag }} {{ container_run_args }}; done
31+
shell: for i in {{ '{' }}1..{{ number_of_containers }}{{ '}' }}; do sudo docker run --log-driver=none -v {{ app_log_dir }}:{{ app_log_dir }}:rw -v /dev/log://dev/log:rw --restart={{ restart_policy | default('no') }} {{ container_run_opts }} {{ container_image }}:{{ container_tag }} {{ container_run_args }}; done
3232
args:
3333
executable: /bin/bash
3434
register: new_container_ids

ansible/roles/docker/tasks/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
file:
2424
path="{{ core_file_dir }}"
2525
state=directory
26+
owner=root
2627
group=root
2728
mode=0755
2829

@@ -90,6 +91,15 @@
9091
update_cache=yes
9192
cache_valid_time=604800
9293

94+
- name: enforce modes on /docker
95+
become: true
96+
file:
97+
path=/docker
98+
state=directory
99+
owner=root
100+
group=root
101+
mode=0755
102+
93103
- name: restart docker
94104
when: (copied_config.changed and restart is defined) or dock is defined
95105
command: sudo service docker restart

ansible/roles/khronos/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Run Khronos CLI tool out of cron once daily.
22

3-
`tasks/main.yml` - install cron entry to run `/khronos/bin/cli.js` and output to `/var/log/khonos_cron.log`
3+
`tasks/main.yml` - install cron entry to run `/khronos/bin/cli.js` and output to `{{ app_log_dir }}/khonos_cron.log`

ansible/roles/khronos/tasks/main.yml

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,30 @@
22
become: yes
33
tags: cron
44
template:
5-
src: "{{ item }}"
5+
src: "khronos-cron.sh"
66
mode: 0744
7-
dest: /opt/runnable/{{ item }}
7+
dest: /opt/runnable/{{ item.script }}
88
with_items:
9-
- khronos-cron.sh
10-
- build-canary.sh
11-
- log-canary.sh
12-
- github-branch-canary.sh
13-
- container-metrics.sh
9+
- { cron_queues: "{{ main_cron_queues }}", script: "main-cron.sh"}
10+
- { cron_queues: "{{ canary_cron_queues }}", script: "canary-cron.sh"}
1411

1512
- name: Put Khronos script into crontab
1613
become: yes
1714
tags: cron
1815
cron:
1916
name: "{{ item.name }}"
20-
job: /opt/runnable/{{ item.script }} >> /var/log/{{ item.script }}.log 2>&1
17+
job: /opt/runnable/{{ item.script }} >> {{ app_log_dir }}/{{ item.script }}.log 2>&1
2118
minute: "{{ item.minute | default('*') }}"
2219
hour: "{{ item.hour | default('*') }}"
2320
state: "{{ item.state | default('present') }}"
2421
with_items:
2522
- name: Khronos CLI - Daily Cleanup
2623
minute: 13
2724
hour: 1,7,13,19
28-
script: khronos-cron.sh
25+
script: main-cron.sh
2926
- name: Khronos CLI - Canary
3027
minute: "*/5"
31-
script: build-canary.sh
32-
state: "{% if node_env == 'production-delta' %}present{% else %}absent{% endif %}"
33-
- name: Khronos CLI - Github Branch Canary
34-
minute: "*/5"
35-
script: github-branch-canary.sh
36-
state: "{% if node_env == 'production-delta' %}present{% else %}absent{% endif %}"
37-
- name: Khronos CLI - Log Canary
38-
minute: "*/5"
39-
script: log-canary.sh
40-
state: "{% if node_env == 'production-delta' %}present{% else %}absent{% endif %}"
41-
- name: Container Metrics
42-
minute: "*/5"
43-
script: container-metrics.sh
28+
script: canary-cron.sh
4429
state: "{% if node_env == 'production-delta' %}present{% else %}absent{% endif %}"
4530

4631
- name: make directory for mongo certificates

ansible/roles/khronos/templates/build-canary.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)