Fix minor typo errors | Change Nginx for Caddy | Consolidate templates in this repo

This commit is contained in:
2025-01-24 02:57:53 -03:00
parent 21515daef1
commit ddf0301463
15 changed files with 254 additions and 35 deletions

10
templates/caddy/Caddyfile Normal file
View File

@@ -0,0 +1,10 @@
# Static content server
domain.com {
root * /srv/static
file_server
}
# Reverse proxy
ssl.test.benitez.ar {
reverse_proxy * http://localhost:9090
}

View File

@@ -0,0 +1,14 @@
services:
caddy:
image: caddy:latest
container_name: caddy
network_mode: "host" # Allow access to local networks (EX: Backend running on port 3000)
ports:
- "80:80"
- "443:443"
volumes:
- ./settings:/etc/caddy
- ./static:/srv/static
- ./caddy_data:/data
- ./caddy_config:/config
restart: unless-stopped

View File

@@ -0,0 +1,39 @@
services:
prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: always
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
networks:
- monitoring_net
grafana:
image: grafana/grafana:latest
container_name: grafana
restart: always
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=YOUR_PASSWORD
- GE_SERVER_ROOT_URL=YOUR_URL
depends_on:
- prometheus
networks:
- monitoring_net
node_exporter:
image: prom/node-exporter:latest
container_name: node-exporter
restart: always
ports:
- "9100:9100"
networks:
- monitoring_net
networks:
monitoring_net:
driver: bridge

View File

@@ -0,0 +1,25 @@
services:
prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: always
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
networks:
- monitoring_net
node_exporter:
image: prom/node-exporter:latest
container_name: node-exporter
restart: always
ports:
- "9100:9100"
networks:
- monitoring_net
networks:
monitoring_net:
driver: bridge

View File

@@ -0,0 +1,12 @@
global:
scrape_interval: 5s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node'
static_configs:
- targets: ['node-exporter:9100']

View File

@@ -0,0 +1,22 @@
services:
nginx:
image: nginx:latest
ports:
- "80:80"
- "443:443"
volumes:
- ./static:/var/www/static # For static content delivery
- ./nginx/conf.d:/etc/nginx/conf.d # Your sites conf files
- ./nginx/nginx.conf:/etc/nginx/nginx.conf # Main NginX config file
- ./certbot/www:/var/www/certbot
- ./certbot/conf:/etc/letsencrypt # Stores certificates
restart: unless-stopped
depends_on:
- certbot
certbot:
image: certbot/certbot
volumes:
- ./certbot/www:/var/www/certbot
- ./certbot/conf:/etc/letsencrypt
restart: unless-stopped

View File

@@ -0,0 +1,38 @@
# Reverse proxy
server {
listen 80;
server_name api.domain.com;
server_tokens off;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name api.domain.com;
server_tokens off;
ssl_certificate /etc/letsencrypt/live/api.domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.domain.com/privkey.pem;
location / {
proxy_pass http://localhost:{LOCAL_NETWORK_PORT}/;
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-Host $host;
# WebSocket support
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
# Change upload max size
client_max_body_size 50M;
}
}

View File

@@ -0,0 +1,29 @@
# Static delivery
server {
listen 80;
server_name test.domain.com;
server_tokens off;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name test.domain.com;
server_tokens off;
ssl_certificate /etc/letsencrypt/live/test.domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/test.domain.com/privkey.pem;
location / {
root /var/www/static;
index index.html;
}
}

View File

@@ -0,0 +1,24 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
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;
include /etc/nginx/conf.d/*.conf; # Include all childs in ./conf.d
}