Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ansible/group_vars/alpha-consul-template-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ container_run_opts: >
container_run_args: >
-consul={{ consul_host_address }}:{{ consul_api_port }}
-wait=1s
-template="/tmp/template:{{ target_updater_file_path }}/{{ out_file }}:{{ template_command }}"
-template="/tmp/template:{{ target_updater_file_path }}/{{ proxy_service_name }}.conf:{{ template_command }}"
6 changes: 4 additions & 2 deletions ansible/group_vars/alpha-navi-proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
name: nginx

# used by consul template updater
proxy_service_name: navi
target_container_name: nginx
target_updater_file_path: /etc/nginx/sites-enabled
template_path: /etc/nginx/template/navi.tmpl
template_command: /bin/docker kill -s HUP {{ target_container_name }}
out_file: navi.conf
template_path: /etc/nginx/template/navi.tmpl

# used by container_kill_start
container_image: "{{ name }}"
container_tag: "1.10"

restart_policy: always

container_run_opts: >
-d
--net=host
Expand Down
2 changes: 2 additions & 0 deletions ansible/group_vars/alpha-registrator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ name: registrator
container_image: gliderlabs/registrator
container_tag: v7

restart_policy: always

container_run_opts: >
-d
--hostname={{ ansible_hostname }}
Expand Down
25 changes: 17 additions & 8 deletions ansible/roles/content-domain-proxy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@
dest: /etc/nginx
state: directory

- name: assert nginx sites-enabled directory
tags: [ configure_proxy ]
become: yes
file:
state: directory
dest: /etc/nginx/sites-enabled

- name: put nginx configuration in place
tags: [ configure_proxy ]
become: yes
Expand All @@ -70,4 +63,20 @@
become: yes
template:
src: navi.tmpl
dest: /etc/nginx/template
dest: /etc/nginx/template/navi.tmpl

- name: setup ip table rule to redir all to port 80
tags: [ configure_proxy, iptables ]
become: yes
iptables:
table=nat
chain=PREROUTING
in_interface=eth0
protocol=tcp
destination_port={{ item }}
jump=REDIRECT
to_ports=80
comment="Redirect {{ item }} traffic to port 80"
with_items:
- 81:442
- 444:65535
2 changes: 1 addition & 1 deletion ansible/roles/content-domain-proxy/templates/navi.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ map $http_upgrade $connection_upgrade {
}

upstream {{ name }} {
{{ '{{' }}range service "{{ name }}"{{ '}}' }} server {{ '{{' }}.Address{{ '}}' }}:{{ '{{' }}.Port{{ '}}' }} max_fails=0 fail_timeout=1s;
{{ '{{' }}range service "{{ proxy_service_name }}"{{ '}}' }} server {{ '{{' }}.Address{{ '}}' }}:{{ '{{' }}.Port{{ '}}' }} max_fails=0 fail_timeout=1s;
{{ '{{' }}end{{ '}}' }}
}

Expand Down