Open AnzeKop opened 1 month ago
Did you set any domain name for the app
service?
Yea tried with both autogenerated from the wildcard domain and setting it custom.
the labels it generated appeared correct for both trafeik ane caddy.
I'm on v4.0.0-beta.323 of Coolify and I constantly use this feature...Caddy + Docker compose.
I've faced 502 errors before but been able to resolve. @AnzeKop could you confirm you're adding the port to the domain e.g. https://mydomain.com:3000 this applies if you are adding/configuring the domain at the service level. If you're doing it as a dynamic config, the format is "container-name:3000" where container-name refers to the auto generated container name created by Coolify.
Lastly, it helps to confirm the app is actually running and ready to handle requests (healthy) otherwise you can also run into 502 errors.
If you're still encountering issues, you could share what the "deployable compose file" contents are and any logs from Caddy proxy or the app itself (feel free to mask/hide the domain in your screenshots)
This is my full docker compose with my postgrese setup, I tried it with different ports and caddy setups but still nothong works. The app runs healthy and it works but just the reverse proxy doesn't make it publicly accesable
FROM node:20
WORKDIR /app
COPY package*.json ./
COPY packages/ ./packages/
COPY . .
RUN npm ci
RUN npm run build
version: "3.8"
services:
server:
build: .
image: midab-kova-hubspot-sync:latest
command: npm run start:server
ports:
- "${PORT}:${PORT}"
environment:
- PORT=${PORT}
- NODE_ENV=production
- DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
- REDIS_URL=redis://redis:6379
- MABI_TOKEN=${MABI_TOKEN}
- HUBSPOT_API_KEY=${HUBSPOT_API_KEY}
depends_on:
- postgres
- redis
worker:
image: midab-kova-hubspot-sync:latest
command: npm run start:worker
environment:
- NODE_ENV=production
- DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
- REDIS_URL=redis://redis:6379
- JOB_CONCURRENCY=${JOB_CONCURRENCY:-1}
- HUBSPOT_API_KEY=${HUBSPOT_API_KEY}
depends_on:
- postgres
- redis
postgres:
image: postgres:15
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
redis:
image: redis:6
volumes:
- redis_data:/data
volumes:
postgres_data:
redis_data:
Hey @AnzeKop any chance you can show the labels being set by Coolify for this? You should be able to see them by clicking the "Show deployable compose" button when editing the docker-compose.yml via Coolify UI (screenshot of button attached)
An example of what the labels could look like:
- 'caddy_0.encode=zstd gzip'
- 'caddy_0.handle_path.0_reverse_proxy={{upstreams 7000}}'
- 'caddy_0.handle_path=/*'
- caddy_0.header=-Server
- 'caddy_0.try_files={path} /index.html /index.php'
- 'caddy_0=https://yourdomainhere.com'
- caddy_ingress_network=mc4wg4k
The key is on this line: - 'caddy_0.handle_path.0_reverse_proxy={{upstreams 7000}}'
Make sure the value of the upstreams port matches what you have as the ${PORT} in your envs and docker-compose.yml file (the number 7000 refers to the port that the container is listening on, so in your case I guess it's gonna be 3000)
I am having the same issue when using a docker compose. The upstreams port is not showing after clicking Reload Compose File
Description
Caddy reverse proxy doesn't work with docker compose. Server builds and boots and runs on port 3000 correctly. Receving 502 errors.
Minimal Reproduction (if possible, example repository)
Just put any docker file without labels into a caddy setup on coolify. rever proxa doesn't work.
Here is my file
Exception or Error
No response
Version
v4.0.0-beta.323
Cloud?