Skip to content

Commit

Permalink
feat: production profile
Browse files Browse the repository at this point in the history
  • Loading branch information
akdasa committed Oct 27, 2024
1 parent 4b52e9e commit 4b981c6
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
FROM nginx:1.27.0-bookworm

# ---------------------------------------------------------------------------- #
# Metadata #
# ---------------------------------------------------------------------------- #

LABEL org.opencontainers.image.description="Gateway for the Lectorium project"
LABEL org.opencontainers.image.source="https://github.com/akdasa-studios/lectorium"

# ---------------------------------------------------------------------------- #
# Build #
# ---------------------------------------------------------------------------- #

# Copy the nginx configuration files
WORKDIR /akd-studios/lectorium/services/gateway
COPY . .

# Run nginx
# ---------------------------------------------------------------------------- #
# Run #
# ---------------------------------------------------------------------------- #

CMD ["nginx", "-c", "/akd-studios/lectorium/services/gateway/envs/dev/_root.conf", "-g", "daemon off;"]
50 changes: 50 additions & 0 deletions envs/prod/_root.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;


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;
keepalive_timeout 65;

resolver 127.0.0.11 valid=30s;
resolver_timeout 10s;

root /akd-studios/lectorium/services/gateway/envs/dev/static;
index index.html index.htm;

server {
listen 80;
server_name lectorium;
access_log off;
error_log off;
return 301 https://$host$request_uri;
}

server {
listen 443 ssl;
ssl_certificate /akd-studios/lectorium/services/gateway/keys/cert.crt;
ssl_certificate_key /akd-studios/lectorium/services/gateway/keys/cert.key;
ssl_ciphers HIGH:!aNULL:!MD5;
server_name lectorium;

include _index.conf;
include services-database.endpoint.conf;
include services-signed-url-generator.endpoint.conf;
include services-vayu.endpoint.conf;
}
}
Empty file.
5 changes: 5 additions & 0 deletions envs/prod/services-database.endpoint.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
location /database {
set $upstream_host "http://database:5984";
proxy_pass $upstream_host;
rewrite ^/database/(.*) /$1 break;
}
5 changes: 5 additions & 0 deletions envs/prod/services-signed-url-generator.endpoint.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
location /signed-url-generator {
set $upstream_host "http://signed-url-generator:8000";
proxy_pass $upstream_host;
rewrite ^/signed-url-generator/(.*) /$1 break;
}
11 changes: 11 additions & 0 deletions envs/prod/services-vayu.endpoint.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
location /vayu {
set $upstream_host "http://vayu-webserver:8080";
proxy_pass $upstream_host;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}

0 comments on commit 4b981c6

Please sign in to comment.