Skip to content

Commit 2e19750

Browse files
committed
Merge branch 'release/0.0.2'
2 parents 43ee6e8 + a29aeba commit 2e19750

File tree

135 files changed

+18561
-3842
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+18561
-3842
lines changed

.docker/add-env-vars.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
_writeFrontendEnvVars() {
2+
ENV_JSON="$(jq --compact-output --null-input 'env | with_entries(select(.key | startswith("REACT_APP_")))')"
3+
ENV_JSON_ESCAPED="$(printf "%s" "${ENV_JSON}" | sed -e 's/[\&/]/\\&/g')"
4+
sed -i "s/<noscript id=\"env-insertion-point\"><\/noscript>/<script>var ENV=${ENV_JSON_ESCAPED}<\/script>/g" ${PUBLIC_HTML}index.html
5+
}
6+
7+
_writeNginxEnvVars() {
8+
dockerize -template /etc/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
9+
}
10+
11+
_addSslConfig() {
12+
SSL_CERTIFICATE=/etc/nginx/ssl/${1}/fullchain.pem;
13+
SSL_CERTIFICATE_KEY=/etc/nginx/ssl/${1}/privkey.pem;
14+
FILE_CONF=/etc/nginx/sites.d/${1}.conf
15+
FILE_SSL_CONF=/etc/nginx/conf.d/00-ssl-redirect.conf;
16+
17+
if [ -f ${SSL_CERTIFICATE} ] && [ -f ${SSL_CERTIFICATE_KEY} ]; then
18+
echo "saving ssl config in ${FILE_CONF}"
19+
echo 'include include.d/ssl-redirect.conf;' >> ${FILE_SSL_CONF};
20+
echo 'include "include.d/ssl.conf";' >> ${FILE_CONF};
21+
echo "ssl_certificate ${SSL_CERTIFICATE};" >> ${FILE_CONF};
22+
echo "ssl_certificate_key ${SSL_CERTIFICATE_KEY};" >> ${FILE_CONF};
23+
else
24+
echo 'listen 80;' >> ${FILE_CONF};
25+
echo "ssl ${1} not found >> ${SSL_CERTIFICATE} -> ${SSL_CERTIFICATE_KEY}"
26+
fi;
27+
}
28+
29+
_writeFrontendEnvVars;
30+
_writeNginxEnvVars;
31+
32+
# _addSslConfig 'backend'
33+
# _addSslConfig 'frontend'

.docker/nginx.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
server {
2+
listen 80;
3+
root /usr/share/nginx/html;
4+
index index.html;
5+
6+
location / {
7+
try_files $uri /index.html;
8+
}
9+
}

.docker/nginx/conf.d/default.conf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
client_max_body_size 20M;
2+
3+
# upstream backend {
4+
# server {{ .Env.URL_BACKEND }};
5+
# }
6+
7+
server {
8+
index index.html;
9+
root /var/www/public/;
10+
11+
{{ if .Env.FRONTEND_SERVER_NAME }}
12+
server_name {{ .Env.FRONTEND_SERVER_NAME }};
13+
{{else}}
14+
server_name _;
15+
{{end}}
16+
17+
include sites.d/frontend.conf;
18+
# include include.d/letsencrypt.conf;
19+
}
20+
21+
# {{if .Env.BACKEND_SERVER_NAME}}
22+
# server {
23+
# server_name {{ .Env.BACKEND_SERVER_NAME }};
24+
# include sites.d/backend.conf;
25+
# include include.d/letsencrypt.conf;
26+
# }
27+
# {{end}}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
expires 1y;
2+
add_header Cache-Control "public";
3+
access_log off;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#############################################################################
2+
# Configuration file for Let's Encrypt ACME Challenge location
3+
# This file is already included in listen_xxx.conf files.
4+
# Do NOT include it separately!
5+
#############################################################################
6+
#
7+
# This config enables to access /.well-known/acme-challenge/xxxxxxxxxxx
8+
# on all our sites (HTTP), including all subdomains.
9+
# This is required by ACME Challenge (webroot authentication).
10+
# You can check that this location is working by placing ping.txt here:
11+
# /var/www/letsencrypt/.well-known/acme-challenge/ping.txt
12+
# And pointing your browser to:
13+
# http://xxx.domain.tld/.well-known/acme-challenge/ping.txt
14+
#
15+
# Sources:
16+
# https://community.letsencrypt.org/t/howto-easy-cert-generation-and-renewal-with-nginx/3491
17+
#
18+
#############################################################################
19+
20+
# Rule for legitimate ACME Challenge requests (like /.well-known/acme-challenge/xxxxxxxxx)
21+
# We use ^~ here, so that we don't check other regexes (for speed-up). We actually MUST cancel
22+
# other regex checks, because in our other config files have regex rule that denies access to files with dotted names.
23+
location ^~ /.well-known/acme-challenge/ {
24+
25+
# Set correct content type. According to this:
26+
# https://community.letsencrypt.org/t/using-the-webroot-domain-verification-method/1445/29
27+
# Current specification requires "text/plain" or no content header at all.
28+
# It seems that "text/plain" is a safe option.
29+
default_type "text/plain";
30+
31+
# This directory must be the same as in /etc/letsencrypt/cli.ini
32+
# as "webroot-path" parameter. Also don't forget to set "authenticator" parameter
33+
# there to "webroot".
34+
# Do NOT use alias, use root! Target directory is located here:
35+
# /var/www/common/letsencrypt/.well-known/acme-challenge/
36+
root /var/www/letsencrypt;
37+
autoindex on;
38+
}
39+
40+
# Hide /acme-challenge subdirectory and return 404 on all requests.
41+
# It is somewhat more secure than letting Nginx return 403.
42+
# Ending slash is important!
43+
location = /.well-known/acme-challenge/ {
44+
return 404;
45+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
add_header Last-Modified $date_gmt;
2+
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
3+
if_modified_since off;
4+
expires off;
5+
etag off;

.docker/nginx/include.d/spa.conf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# X-Frame-Options is to prevent from clickJacking attack
2+
add_header X-Frame-Options SAMEORIGIN;
3+
4+
# disable content-type sniffing on some browsers.
5+
add_header X-Content-Type-Options nosniff;
6+
7+
# This header enables the Cross-site scripting (XSS) filter
8+
add_header X-XSS-Protection "1; mode=block";
9+
10+
# This will enforce HTTP browsing into HTTPS and avoid ssl stripping attack
11+
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
12+
13+
add_header Referrer-Policy "no-referrer-when-downgrade";
14+
15+
# Enables response header of "Vary: Accept-Encoding"
16+
gzip_vary on;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
server {
2+
listen 80;
3+
listen [::]:80;
4+
return 302 https://$host$request_uri;
5+
}

.docker/nginx/include.d/ssl.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
listen 443 ssl http2;
2+
listen [::]:443 ssl http2;

.docker/nginx/sites.d/backend.conf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
location / {
2+
proxy_pass http://backend;
3+
proxy_http_version 1.1;
4+
proxy_set_header Upgrade $http_upgrade;
5+
proxy_set_header Connection 'upgrade';
6+
proxy_set_header Host $host;
7+
proxy_set_header X-Real-IP $remote_addr;
8+
proxy_set_header X-Forwarded-Proto $scheme;
9+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
10+
proxy_cache_bypass $http_upgrade;
11+
}

0 commit comments

Comments
 (0)