codice iac per deploy in vm
This commit is contained in:
5 files changed
+236
No files matched your search
@@ -0,0 +1,71 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# Java Web Application
|
||||
app:
|
||||
image: your-java-app:latest
|
||||
container_name: java-app
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- app-network
|
||||
environment:
|
||||
- SPRING_PROFILES_ACTIVE=prod
|
||||
- SERVER_PORT=8080
|
||||
# ports:
|
||||
# - "8080:8080" # Non esporre direttamente, usa nginx
|
||||
volumes:
|
||||
- app-data:/app/data
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
# Nginx Reverse Proxy
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
container_name: nginx-proxy
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./nginx/conf.d:/etc/nginx/conf.d:ro
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- certbot-webroot:/var/www/certbot:ro
|
||||
- certbot-certs:/etc/letsencrypt:ro
|
||||
- certbot-lib:/var/lib/letsencrypt:ro
|
||||
networks:
|
||||
- app-network
|
||||
depends_on:
|
||||
- app
|
||||
healthcheck:
|
||||
test: ["CMD", "nginx", "-t"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
# Certbot per Let's Encrypt
|
||||
certbot:
|
||||
image: certbot/certbot:latest
|
||||
container_name: certbot
|
||||
volumes:
|
||||
- certbot-webroot:/var/www/certbot:rw
|
||||
- certbot-certs:/etc/letsencrypt:rw
|
||||
- certbot-lib:/var/lib/letsencrypt:rw
|
||||
- certbot-logs:/var/log/letsencrypt:rw
|
||||
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew --webroot --webroot-path=/var/www/certbot --quiet; sleep 12h & wait $${!}; done;'"
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
networks:
|
||||
app-network:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
app-data:
|
||||
certbot-webroot:
|
||||
certbot-certs:
|
||||
certbot-lib:
|
||||
certbot-logs:
|
||||
Reference in new issue
Block a user