File tree Expand file tree Collapse file tree
roles/content-domain-proxy Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,4 +14,4 @@ container_run_opts: >
1414container_run_args : >
1515 -consul={{ consul_host_address }}:{{ consul_api_port }}
1616 -wait=1s
17- -template="/tmp/template:{{ target_updater_file_path }}/{{ out_file }}:{{ template_command }}"
17+ -template="/tmp/template:{{ target_updater_file_path }}/{{ proxy_service_name }}.conf :{{ template_command }}"
Original file line number Diff line number Diff line change 22name : nginx
33
44# used by consul template updater
5+ proxy_service_name : navi
56target_container_name : nginx
67target_updater_file_path : /etc/nginx/sites-enabled
7- template_path : /etc/nginx/template/navi.tmpl
88template_command : /bin/docker kill -s HUP {{ target_container_name }}
9- out_file : navi.conf
9+ template_path : /etc/nginx/template/ navi.tmpl
1010
1111# used by container_kill_start
1212container_image : " {{ name }}"
1313container_tag : " 1.10"
1414
15+ restart_policy : always
16+
1517container_run_opts : >
1618 -d
1719 --net=host
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ name: registrator
44container_image : gliderlabs/registrator
55container_tag : v7
66
7+ restart_policy : always
8+
79container_run_opts : >
810 -d
911 --hostname={{ ansible_hostname }}
Original file line number Diff line number Diff line change 4444 dest : /etc/nginx
4545 state : directory
4646
47- - name : assert nginx sites-enabled directory
48- tags : [ configure_proxy ]
49- become : yes
50- file :
51- state : directory
52- dest : /etc/nginx/sites-enabled
53-
5447- name : put nginx configuration in place
5548 tags : [ configure_proxy ]
5649 become : yes
7063 become : yes
7164 template :
7265 src : navi.tmpl
73- dest : /etc/nginx/template
66+ dest : /etc/nginx/template/navi.tmpl
67+
68+ - name : setup ip table rule to redir all to port 80
69+ tags : [ configure_proxy, iptables ]
70+ become : yes
71+ iptables :
72+ table=nat
73+ chain=PREROUTING
74+ in_interface=eth0
75+ protocol=tcp
76+ destination_port={{ item }}
77+ jump=REDIRECT
78+ to_ports=80
79+ comment="Redirect {{ item }} traffic to port 80"
80+ with_items :
81+ - 81:442
82+ - 444:65535
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ map $http_upgrade $connection_upgrade {
44}
55
66upstream {{ name }} {
7- {{ '{{' }}range service " {{ name }}" {{ '}}' }} server {{ '{{' }}.Address {{ '}}' }}:{{ '{{' }}.Port {{ '}}' }} max_fails= 0 fail_timeout= 1s;
7+ {{ '{{' }}range service " {{ proxy_service_name }}" {{ '}}' }} server {{ '{{' }}.Address {{ '}}' }}:{{ '{{' }}.Port {{ '}}' }} max_fails= 0 fail_timeout= 1s;
88 {{ '{{' }}end {{ '}}' }}
99}
1010
You can’t perform that action at this time.
0 commit comments