blob: fc3bcfe9487bdbfcfdabedc53a89b9f918101730 [file] [log] [blame]
Ilya Kharinfd293c42017-03-14 17:34:12 +04001{%- from "devops_portal/map.jinja" import config with context -%}
Ilya Kharin9954eaf2017-03-06 15:21:07 +04002{%- from "devops_portal/map.jinja" import services with context -%}
Ilya Kharin5f5d3522017-03-22 23:53:06 +04003{%- from "devops_portal/map.jinja" import service_url with context -%}
Ilya Kharin9954eaf2017-03-06 15:21:07 +04004daemon off;
5
6worker_processes 1;
7
8error_log /dev/stderr;
9pid /var/run/nginx/nginx.pid;
10
11events {
12 worker_connections 1024;
13}
14
15http {
16 include /etc/nginx/mime.types;
17
18 sendfile on;
19
20 access_log /dev/stdout;
21
22 server {
Ilya Kharinc27499c2017-03-14 16:52:59 +040023 listen 0.0.0.0:8000 default_server;
Ilya Kharin9954eaf2017-03-06 15:21:07 +040024
25 root /opt/devops-portal/;
26
27 gzip on;
28 gzip_min_length 1000;
29 gzip_types
30 text/plain
31 text/css
32 application/json
33 application/javascript
34 application/x-javascript;
35
36 location / {
Ilya Kharinb5a5a922017-03-16 11:59:59 +040037 if ($request_method = OPTIONS ) {
38 add_header Content-Length 0;
39 add_header Content-Type text/plain;
40 return 200;
41 }
Ilya Kharin9954eaf2017-03-06 15:21:07 +040042 try_files $uri /index.html;
43 }
44
45{%- for service_name in services %}
Ilya Kharin918686b2017-03-16 20:09:13 +040046{%- if config.service[service_name] is defined %}
47{%- set service = config.service[service_name] %}
Ilya Kharin3ce0cd12017-03-17 18:49:45 +040048{%- if service.enabled|default(True) and service.configure_proxy|default(False) %}
Ilya Kharin9954eaf2017-03-06 15:21:07 +040049
Ilya Kharind3779d52017-03-30 00:48:36 +040050 location /api/{{ service_name }}/ {
Ilya Kharine1cf8542017-03-17 18:37:09 +040051 proxy_pass {{ service_url(service.endpoint) }};
Ilya Kharin9954eaf2017-03-06 15:21:07 +040052 }
53{%- endif %}
Ilya Kharind80a6f62017-03-15 12:40:36 +040054{%- endif %}
Ilya Kharin9954eaf2017-03-06 15:21:07 +040055{%- endfor %}
56 }
57}