blob: 5b2a41c0a21a1c870a0285f9b4f92b255491384e [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 -%}
3daemon off;
4
5worker_processes 1;
6
7error_log /dev/stderr;
8pid /var/run/nginx/nginx.pid;
9
10events {
11 worker_connections 1024;
12}
13
14http {
15 include /etc/nginx/mime.types;
16
17 sendfile on;
18
19 access_log /dev/stdout;
20
21 server {
Ilya Kharinc27499c2017-03-14 16:52:59 +040022 listen 0.0.0.0:8000 default_server;
Ilya Kharin9954eaf2017-03-06 15:21:07 +040023
24 root /opt/devops-portal/;
25
26 gzip on;
27 gzip_min_length 1000;
28 gzip_types
29 text/plain
30 text/css
31 application/json
32 application/javascript
33 application/x-javascript;
34
35 location / {
Ilya Kharinb5a5a922017-03-16 11:59:59 +040036 if ($request_method = OPTIONS ) {
37 add_header Content-Length 0;
38 add_header Content-Type text/plain;
39 return 200;
40 }
Ilya Kharin9954eaf2017-03-06 15:21:07 +040041 try_files $uri /index.html;
42 }
43
44{%- for service_name in services %}
Ilya Kharin918686b2017-03-16 20:09:13 +040045{%- if config.service[service_name] is defined %}
46{%- set service = config.service[service_name] %}
Ilya Kharind80a6f62017-03-15 12:40:36 +040047{%- if service.enabled|default(False) and service.configure_proxy|default(False) %}
Ilya Kharin9954eaf2017-03-06 15:21:07 +040048
49 location /api/{{ service_name }} {
50 proxy_pass {{ service.endpoint }};
51 }
52{%- endif %}
Ilya Kharind80a6f62017-03-15 12:40:36 +040053{%- endif %}
Ilya Kharin9954eaf2017-03-06 15:21:07 +040054{%- endfor %}
55 }
56}