Do not depends of nginx or netfilter anymore
This commit is contained in:
parent
fb812906cf
commit
8763992080
|
@ -1,4 +1,5 @@
|
|||
almanach_port: 8000
|
||||
almanach_listen_ip: 0.0.0.0
|
||||
almanach_user: almanach
|
||||
almanach_group: almanach
|
||||
almanach_service_name: almanach-api
|
||||
|
@ -6,8 +7,3 @@ almanach_service_name: almanach-api
|
|||
almanach_nginx_hostname: default
|
||||
almanach_nginx_port: 80
|
||||
almanach_nginx_log_file: /var/log/nginx/default_access.log
|
||||
|
||||
use_nginx: True
|
||||
|
||||
use_netfilter: False
|
||||
netfilter_iface: eth0
|
||||
|
|
|
@ -13,10 +13,4 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- include: nginx.yml
|
||||
when: use_nginx == True
|
||||
|
||||
- include: netfilter.yml
|
||||
when: use_netfilter == True
|
||||
|
||||
- include: init_upstart.yml
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
---
|
||||
# Copyright 2016, Internap Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Forward port 80 to Almanach port
|
||||
iptables: table=nat chain=PREROUTING in_interface={{ netfilter_iface }} protocol=tcp match=tcp destination_port=80 jump=REDIRECT to_ports={{ almanach_port }}
|
|
@ -1,31 +0,0 @@
|
|||
---
|
||||
# Copyright 2016, Internap Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
- name: Install nginx
|
||||
apt: name=nginx state=present
|
||||
|
||||
- name: Remove default nginx config
|
||||
file: name=/etc/nginx/sites-enabled/default state=absent
|
||||
|
||||
- name: Configure nginx
|
||||
template:
|
||||
src: "nginx.vhost.conf.j2"
|
||||
dest: /etc/nginx/sites-enabled/00-almanach-api
|
||||
mode: "0644"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
register: nginx_config
|
||||
notify:
|
||||
- Restart nginx
|
|
@ -10,5 +10,5 @@ setuid {{ almanach_user }}
|
|||
setgid {{ almanach_group }}
|
||||
|
||||
script
|
||||
exec {{ almanach_app_dir }}/bin/almanach api {{ almanach_config_file }} --port {{ almanach_port }} --logging {{ almanach_logging_config_file }}
|
||||
exec {{ almanach_app_dir }}/bin/almanach api {{ almanach_config_file }} --host {{ almanach_listen_ip }} --port {{ almanach_port }} --logging {{ almanach_logging_config_file }}
|
||||
end script
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
server {
|
||||
listen {{ almanach_nginx_port }};
|
||||
server_name {{ almanach_nginx_hostname }};
|
||||
|
||||
access_log {{ almanach_nginx_log_file }};
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:{{ almanach_port }};
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue