Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d339e3f
add sequelize orm package
runleveldev Oct 20, 2025
f872120
initialize sequelize-cli
runleveldev Oct 21, 2025
1864049
add services models
runleveldev Oct 21, 2025
1116eaa
fix config path
runleveldev Oct 21, 2025
8062fef
flatten services model
runleveldev Oct 21, 2025
2d583a9
fix service model definition
runleveldev Oct 22, 2025
50ace75
add json-to-sql script
runleveldev Oct 22, 2025
bd4421b
remove pointless envvar check
runleveldev Oct 22, 2025
08e81d0
add ejs dependency
runleveldev Oct 22, 2025
9306124
add containers index page
runleveldev Oct 22, 2025
19aac49
fix logo path
runleveldev Oct 22, 2025
72e29a5
simplify logout form handling
runleveldev Oct 22, 2025
2db0c5e
unify page styles
runleveldev Oct 22, 2025
e2f7200
add missing fields to the container model
runleveldev Oct 22, 2025
8df1112
new container form improvements
runleveldev Oct 22, 2025
024b4df
fix aiContainer fields in container model
runleveldev Oct 22, 2025
4fa2e4f
remove ssh public key support from the html frontend
runleveldev Oct 22, 2025
02b492a
database update handling
runleveldev Oct 23, 2025
9ad86c2
fix form redirect handling
runleveldev Oct 23, 2025
186d6f9
remove unused body-parser import
runleveldev Oct 23, 2025
c57cb32
document extra .env settings
runleveldev Oct 23, 2025
bb1187c
remove duplicate services.json file
runleveldev Oct 23, 2025
55aa6c0
fix ratelmiting
runleveldev Oct 23, 2025
ff38269
remove unused import
runleveldev Oct 24, 2025
acf8af6
group statements
runleveldev Oct 24, 2025
7f64710
replace portmap.js with static templates
runleveldev Oct 24, 2025
955703f
Merge branch 'main' into 59-nginx-reverse-proxycreate-a-container-sha…
runleveldev Oct 24, 2025
29e75b3
add nginx-reverse-proxy README
runleveldev Oct 24, 2025
d7fbdc2
add create-a-container README
runleveldev Oct 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
replace portmap.js with static templates
  • Loading branch information
runleveldev committed Oct 24, 2025
commit 7f64710fbd0dcd54bf0121e74b2d02d0fedf13e8
10 changes: 10 additions & 0 deletions create-a-container/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,16 @@ app.get('/containers', requireAuth, async (req, res) => {
return res.render('containers', { rows });
});

// Generate nginx configuration for a container
app.get('/nginx.conf', async (req, res) => {
const services = await Service.findAll({
where: { type: 'http' },
include: [{ model: Container }]
});
res.contentType('text/plain');
return res.render('nginx-conf', { services });
});

// Create container
app.post('/containers', async (req, res) => {
const isInit = req.body.init === 'true' || req.body.init === true;
Expand Down
72 changes: 72 additions & 0 deletions create-a-container/views/nginx-conf.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
server_names_hash_bucket_size 128;

<% services.forEach((service, index) => { %>
server {
listen 443 ssl;
listen [::]:443 ssl;
listen 443 quic;
listen [::]:443 quic;
http2 on;
http3 on;

server_name <%= service.externalHostname %>.opensource.mieweb.org;

# SSL certificates
ssl_certificate /root/.acme.sh/opensource.mieweb.org/fullchain.cer;
ssl_certificate_key /root/.acme.sh/opensource.mieweb.org/opensource.mieweb.org.key;

# Modern TLS configuration
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
ssl_prefer_server_ciphers off;

# SSL session optimization
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_session_tickets off;

# OCSP stapling
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /root/.acme.sh/opensource.mieweb.org/fullchain.cer;
resolver 1.1.1.1 8.8.8.8 valid=300s;
resolver_timeout 5s;

# Security headers
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Alt-Svc 'h3=":443"; ma=86400' always;

# Proxy settings
location / {
proxy_pass http://<%= service.Container.ipv4Address %>:<%= service.internalPort %>;
proxy_http_version 1.1;

# Proxy headers
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_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;

# WebSocket support
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

# Timeouts
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;

# Buffering (disable for SSE/streaming)
proxy_buffering off;
proxy_request_buffering off;

# Allow large uploads
client_max_body_size 100M;
}
}
<% }) %>
29 changes: 0 additions & 29 deletions nginx-reverse-proxy/nginx.conf

This file was deleted.

67 changes: 0 additions & 67 deletions nginx-reverse-proxy/port-map-server.js

This file was deleted.

94 changes: 0 additions & 94 deletions nginx-reverse-proxy/port_map.js

This file was deleted.

3 changes: 3 additions & 0 deletions nginx-reverse-proxy/pull-config.cron
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
* * * * * root /opt/opensource-server/nginx-reverse-proxy/pull-config.sh
17 changes: 17 additions & 0 deletions nginx-reverse-proxy/pull-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -euo pipefail

CONF_FILE=/etc/nginx/conf.d/reverse-proxy.conf
CONF_URL=https://create-a-container.opensource.mieweb.org/nginx.conf

mv "${CONF_FILE}" "${CONF_FILE}.bak"
curl -fsSL -o "${CONF_FILE}" "${CONF_URL}"

if ! nginx -t; then
mv "${CONF_FILE}.bak" "${CONF_FILE}"
exit 1
fi

rm -f "${CONF_FILE}.bak"
nginx -s reload
76 changes: 0 additions & 76 deletions nginx-reverse-proxy/reverse_proxy.conf

This file was deleted.