-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rub21
committed
Dec 15, 2023
1 parent
4389cf9
commit 1c243bd
Showing
15 changed files
with
749 additions
and
426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM nginx:alpine | ||
COPY config/mime.types /etc/nginx/ | ||
COPY config/nginx.conf /etc/nginx/ | ||
|
||
# COPY --from=builder /app/build /assets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
types { | ||
text/html html htm shtml; | ||
text/css css; | ||
text/xml xml; | ||
image/gif gif; | ||
image/jpeg jpeg jpg; | ||
application/javascript js; | ||
image/png png; | ||
image/svg+xml svg svgz; | ||
image/tiff tif tiff; | ||
image/x-icon ico; | ||
image/x-jng jng; | ||
application/font-woff woff; | ||
application/json json; | ||
application/zip zip; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
worker_processes 4; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
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"'; | ||
|
||
access_log /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
#tcp_nopush on; | ||
|
||
keepalive_timeout 65; | ||
|
||
#gzip on; | ||
|
||
upstream app { | ||
server host.docker.internal:5000; | ||
} | ||
|
||
server { | ||
listen 80; | ||
charset utf-8; | ||
|
||
location ~ ^/static.* { | ||
root /staticfiles; | ||
try_files $uri @proxy_to_frontend; | ||
} | ||
|
||
location @proxy_to_frontend { | ||
root /assets; | ||
try_files $uri @django; | ||
} | ||
|
||
location / { | ||
root /assets; | ||
# checks for static file, if not found proxy to app | ||
try_files $uri $uri/ @django; | ||
} | ||
|
||
location @django { | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
# proxy_set_header Host $http_host; | ||
proxy_redirect off; | ||
proxy_pass http://app; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,8 @@ | ||
#!/usr/bin/env bash | ||
set -ex | ||
sed -i "s|https://osmcha.org|$OSMCHA_URL|g" package.json | ||
yarn build:prod | ||
cp -R build/* /staticfiles/ | ||
|
||
# Build frontend | ||
cd /osmcha-frontend | ||
REACT_APP_VERSION=ohm REACT_APP_STACK=PRODUCTION PUBLIC_URL=$OSMCHA_URL npx react-scripts build | ||
cp -R build/*.html /app/osmchadjango/frontend/templates/frontend/ | ||
cp -R build/* /app/osmchadjango/static/ | ||
cp -R build/static/* /app/osmchadjango/static/ | ||
|
||
# Start service | ||
cd /app | ||
python3 manage.py collectstatic --noinput | ||
python3 manage.py migrate | ||
supervisord -c /etc/supervisor/supervisord.conf | ||
# mkdir -p /staticfiles/static/ | ||
# chmod a+rw /staticfiles/static/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
{{- if .Values.osmchaApi.enabled -}} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ .Release.Name }}-osmcha-common-env | ||
data: | ||
POSTGRES_HOST: {{ .Release.Name }}-osmcha-db | ||
PGHOST: {{ .Release.Name }}-osmcha-db | ||
POSTGRES_PORT: {{ .Values.osmchaDb.env.POSTGRES_PORT | quote }} | ||
POSTGRES_USER: {{ .Values.osmchaDb.env.POSTGRES_USER | quote }} | ||
POSTGRES_PASSWORD: {{ .Values.osmchaDb.env.POSTGRES_PASSWORD | quote }} | ||
POSTGRES_DATABASE: {{ .Values.osmchaDb.env.POSTGRES_DB | quote }} | ||
POSTGRES_DB: {{ .Values.osmchaDb.env.POSTGRES_DB | quote }} | ||
|
||
# POSTGRES_HOST: {{ .Release.Name }}-osmcha-db | ||
# POSTGRES_PORT: "5432" | ||
# POSTGRES_USER: {{ .Values.osmchaDb.env.POSTGRES_USER | quote }} | ||
# POSTGRES_PASSWORD: {{ .Values.osmchaDb.env.POSTGRES_PASSWORD | quote }} | ||
# POSTGRES_DATABASE: {{ .Values.osmchaDb.env.POSTGRES_DB | quote }} | ||
|
||
REDIS_URL: {{ .Release.Name }}-osmcha-redis | ||
|
||
DJANGO_SETTINGS_MODULE: "config.settings.production" | ||
OSMCHA_FRONTEND_VERSION: "v0.86.0-production" | ||
|
||
|
||
OSM_SERVER_URL: {{ .Values.osmchaDb.env.OSM_SERVER_URL | quote }} | ||
POSTGRES_DB: {{ .Values.osmchaDb.env.POSTGRES_DB | quote }} | ||
PGHOST: {{ .Release.Name }}-osmcha-db | ||
DJANGO_SECRET_KEY: {{ .Values.osmchaApi.env.DJANGO_SECRET_KEY | quote }} | ||
C_FORCE_ROOT: {{ .Values.osmchaApi.env.C_FORCE_ROOT | quote }} | ||
OSMCHA_URL: {{ .Values.osmchaApi.env.OSMCHA_URL | quote }} | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ .Release.Name }}-osmcha-nginx-config | ||
data: | ||
nginx.conf: | | ||
worker_processes 4; | ||
events { | ||
worker_connections 1024; | ||
} | ||
http { | ||
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"'; | ||
access_log /var/log/nginx/access.log main; | ||
sendfile on; | ||
#tcp_nopush on; | ||
keepalive_timeout 65; | ||
#gzip on; | ||
upstream app { | ||
server localhost:3000; | ||
} | ||
server { | ||
listen 80; | ||
charset utf-8; | ||
location ~ ^/static.* { | ||
root /staticfiles; | ||
try_files $uri @proxy_to_frontend; | ||
} | ||
location @proxy_to_frontend { | ||
root /assets; | ||
try_files $uri @django; | ||
} | ||
location / { | ||
root /assets; | ||
# checks for static file, if not found proxy to app | ||
try_files $uri $uri/ @django; | ||
} | ||
# cookiecutter-django app | ||
location @django { | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $http_host; | ||
proxy_redirect off; | ||
proxy_pass http://app; | ||
} | ||
} | ||
} | ||
mime.types: | | ||
types { | ||
text/html html htm shtml; | ||
text/css css; | ||
text/xml xml; | ||
image/gif gif; | ||
image/jpeg jpeg jpg; | ||
application/javascript js; | ||
image/png png; | ||
image/svg+xml svg svgz; | ||
image/tiff tif tiff; | ||
image/x-icon ico; | ||
image/x-jng jng; | ||
application/font-woff woff; | ||
application/json json; | ||
application/zip zip; | ||
} | ||
{{- end }} |
Oops, something went wrong.