1. Caddy version (caddy version
):
caddy:2.4.6-alpine and caddy:2.4.5-alpine
2. How I run Caddy:
with docker compose (see below):
a. System environment:
Using Docker (compose)
b. Command:
docker-compose -f docker-compose.yml up -d
c. Service/unit/compose file:
version: "3.7"
services:
vendingdb:
image: mysql:latest
container_name: vendingdb
volumes:
- vending_db:/var/lib/mysql
ports:
- 3307:3307
environment:
MYSQL_ROOT_HOST: '%'
MYSQL_ROOT_USER: example
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: vendingdb
vending-app:
build:
context: ./
dockerfile: Dockerfile
ports:
- 8082:8082
depends_on:
- vendingdb
environment:
- SPRING_PROFILES_ACTIVE=prod
vending-ui:
build: ../frontend
container_name: frontend_vending
ports:
- "80:80"
- "443:443"
volumes:
- $PWD/Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
- caddy_config:/config
volumes:
caddy_data:
caddy_config:
vending_db:
d. My complete Caddyfile or JSON config:
vast.rest {
header {
Strict-Transport-Security max-age=31536000;
}
encode zstd gzip
handle /api/* {
reverse_proxy vending-app:8082
}
handle {
root * /srv
try_files {path} index.html
file_server
}
}
3. The problem I’m having:
I have a single VPS with two DNS connected to it. I’m already running another instance of mysql (port 3306) + java spring (port 8080) + angular (exposing 80 and 443) and connecting it with Caddy to one of the DNS instances with some test app, which works fine.
Now I’m wondering - is it it even possible to have two “front end” apps running on the same VPS?
4. Error messages and/or full log output:
5. What I already tried:
I’ve changed the ports for mysql and spring, but what about the ones for angular (80/443)? I am not even sure if this is Caddy’s work or not…