From 270314c975e92ee4c3c2b2bbf0e0b93b13835b5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ture=20Gj=C3=B8rup?= Date: Tue, 11 Jul 2023 17:55:42 +0200 Subject: [PATCH] DISPLAY-986: Re-added infrastructure template files wrongfully excluded by gitignore --- .gitignore | 1 + .../itkdev/etc/confd/templates/config.tmpl | 19 ++++++++ .../etc/confd/templates/default.conf.tmpl | 34 ++++++++++++++ .../etc/confd/templates/nginx.conf.tmpl | 45 +++++++++++++++++++ .../etc/confd/templates/config.tmpl | 19 ++++++++ .../etc/confd/templates/default.conf.tmpl | 34 ++++++++++++++ .../etc/confd/templates/nginx.conf.tmpl | 45 +++++++++++++++++++ 7 files changed, 197 insertions(+) create mode 100644 infrastructure/itkdev/etc/confd/templates/config.tmpl create mode 100644 infrastructure/itkdev/etc/confd/templates/default.conf.tmpl create mode 100644 infrastructure/itkdev/etc/confd/templates/nginx.conf.tmpl create mode 100644 infrastructure/os2display/etc/confd/templates/config.tmpl create mode 100644 infrastructure/os2display/etc/confd/templates/default.conf.tmpl create mode 100644 infrastructure/os2display/etc/confd/templates/nginx.conf.tmpl diff --git a/.gitignore b/.gitignore index 6e74c945..b8da1ce3 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ cypress/screenshots/* temp/ templates/ +!infrastructure/**/templates public/config.json public/release.json diff --git a/infrastructure/itkdev/etc/confd/templates/config.tmpl b/infrastructure/itkdev/etc/confd/templates/config.tmpl new file mode 100644 index 00000000..df696098 --- /dev/null +++ b/infrastructure/itkdev/etc/confd/templates/config.tmpl @@ -0,0 +1,19 @@ +{ + "apiEndpoint": "{{ getenv "APP_API_ENDPOINT" "/" }}", + "authenticationEndpoint": "{{ getenv "APP_API_AUTHENTICATION_ENDPOINT" "/v1/authentication/token" }}", + "authenticationRefreshTokenEndpoint": "{{ getenv "APP_API_AUTHENTICATION_REFRESH_ENDPOINT" "/v1/authentication/token/refresh" }}", + "dataStrategy": { + "type": "pull", + "config": { + "interval": {{ getenv "APP_DATA_PULL_INTERVAL" "30000" }}, + "endpoint": "{{ getenv "APP_API_PATH" "/" }}" + } + }, + "colorScheme": { + "type": "library", + "lat": {{ getenv "APP_CLIENT_LATITUDE" "56.0" }}, + "lng": {{ getenv "APP_CLIENT_LONGITUDE" "10.0" }} + }, + "schedulingInterval": {{ getenv "APP_SCHEDULING_INTERVAL" "60000" }}, + "debug": {{ getenv "APP_DEBUG" "false" }} +} diff --git a/infrastructure/itkdev/etc/confd/templates/default.conf.tmpl b/infrastructure/itkdev/etc/confd/templates/default.conf.tmpl new file mode 100644 index 00000000..59defbd6 --- /dev/null +++ b/infrastructure/itkdev/etc/confd/templates/default.conf.tmpl @@ -0,0 +1,34 @@ +server { + listen 8080; + server_name localhost; + root /var/www/html; + + location {{ getenv "APP_SCREEN_CLIENT_PATH" "/" }} { + rewrite ^{{ getenv "APP_SCREEN_CLIENT_PATH" "/" }}(.*) /$1 break; + index index.html; + autoindex off; + try_files $uri $uri/ =404; + } + + location = {{ getenv "APP_SCREEN_CLIENT_PATH" "" }}/robots.txt { + add_header Content-Type text/plain; + add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive"; + return 200 "User-agent: *\nDisallow: /\n"; + } + + error_log /var/log/nginx/error.log; + access_log /var/log/nginx/access.log; +} + +server { + listen 8081; + server_name localhost; + root /var/www/html/public; + + error_log off; + access_log off; + + location /stub_status { + stub_status; + } +} diff --git a/infrastructure/itkdev/etc/confd/templates/nginx.conf.tmpl b/infrastructure/itkdev/etc/confd/templates/nginx.conf.tmpl new file mode 100644 index 00000000..a3961034 --- /dev/null +++ b/infrastructure/itkdev/etc/confd/templates/nginx.conf.tmpl @@ -0,0 +1,45 @@ +worker_processes auto; + +error_log /var/log/nginx/error.log warn; +pid /tmp/nginx.pid; + +events { + worker_connections 2048; + multi_accept on; +} + +http { + open_file_cache max=10000 inactive=5m; + open_file_cache_valid 5m; + open_file_cache_min_uses 5; + open_file_cache_errors off; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 15 15; + types_hash_max_size 2048; + + server_tokens off; + + gzip on; + gzip_disable "msie6"; + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.0; + gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + error_log /dev/stderr; + access_log /dev/stdout main; + + include /etc/nginx/conf.d/*.conf; +} diff --git a/infrastructure/os2display/etc/confd/templates/config.tmpl b/infrastructure/os2display/etc/confd/templates/config.tmpl new file mode 100644 index 00000000..df696098 --- /dev/null +++ b/infrastructure/os2display/etc/confd/templates/config.tmpl @@ -0,0 +1,19 @@ +{ + "apiEndpoint": "{{ getenv "APP_API_ENDPOINT" "/" }}", + "authenticationEndpoint": "{{ getenv "APP_API_AUTHENTICATION_ENDPOINT" "/v1/authentication/token" }}", + "authenticationRefreshTokenEndpoint": "{{ getenv "APP_API_AUTHENTICATION_REFRESH_ENDPOINT" "/v1/authentication/token/refresh" }}", + "dataStrategy": { + "type": "pull", + "config": { + "interval": {{ getenv "APP_DATA_PULL_INTERVAL" "30000" }}, + "endpoint": "{{ getenv "APP_API_PATH" "/" }}" + } + }, + "colorScheme": { + "type": "library", + "lat": {{ getenv "APP_CLIENT_LATITUDE" "56.0" }}, + "lng": {{ getenv "APP_CLIENT_LONGITUDE" "10.0" }} + }, + "schedulingInterval": {{ getenv "APP_SCHEDULING_INTERVAL" "60000" }}, + "debug": {{ getenv "APP_DEBUG" "false" }} +} diff --git a/infrastructure/os2display/etc/confd/templates/default.conf.tmpl b/infrastructure/os2display/etc/confd/templates/default.conf.tmpl new file mode 100644 index 00000000..59defbd6 --- /dev/null +++ b/infrastructure/os2display/etc/confd/templates/default.conf.tmpl @@ -0,0 +1,34 @@ +server { + listen 8080; + server_name localhost; + root /var/www/html; + + location {{ getenv "APP_SCREEN_CLIENT_PATH" "/" }} { + rewrite ^{{ getenv "APP_SCREEN_CLIENT_PATH" "/" }}(.*) /$1 break; + index index.html; + autoindex off; + try_files $uri $uri/ =404; + } + + location = {{ getenv "APP_SCREEN_CLIENT_PATH" "" }}/robots.txt { + add_header Content-Type text/plain; + add_header X-Robots-Tag "noindex, nofollow, nosnippet, noarchive"; + return 200 "User-agent: *\nDisallow: /\n"; + } + + error_log /var/log/nginx/error.log; + access_log /var/log/nginx/access.log; +} + +server { + listen 8081; + server_name localhost; + root /var/www/html/public; + + error_log off; + access_log off; + + location /stub_status { + stub_status; + } +} diff --git a/infrastructure/os2display/etc/confd/templates/nginx.conf.tmpl b/infrastructure/os2display/etc/confd/templates/nginx.conf.tmpl new file mode 100644 index 00000000..a3961034 --- /dev/null +++ b/infrastructure/os2display/etc/confd/templates/nginx.conf.tmpl @@ -0,0 +1,45 @@ +worker_processes auto; + +error_log /var/log/nginx/error.log warn; +pid /tmp/nginx.pid; + +events { + worker_connections 2048; + multi_accept on; +} + +http { + open_file_cache max=10000 inactive=5m; + open_file_cache_valid 5m; + open_file_cache_min_uses 5; + open_file_cache_errors off; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 15 15; + types_hash_max_size 2048; + + server_tokens off; + + gzip on; + gzip_disable "msie6"; + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.0; + gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + error_log /dev/stderr; + access_log /dev/stdout main; + + include /etc/nginx/conf.d/*.conf; +}