Hi, i would love to deploy strapi with docker-compose behind Traefik. I want to make run 2 strapi with differents path like this : - http://localhost/test
- http://localhost/prod
For this i saw that i have to use serve.js, so i did this :
module.exports = ({ env }) => ({
host: env('HOST', '0.0.0.0'),
port: env.int('PORT', 1337),
url: '/test',
proxy: true,
admin: {
auth: {
secret: env('ADMIN_JWT_SECRET', '7b2e0c412e0e5c95787e9d469eecb35b'),
},
},
});
docker-compose :
version: "3"
services:
strapi-test:
container_name: strapi-test
image: strapi/strapi
restart: unless-stopped
environment:
DATABASE_CLIENT: ${DATABASE_CLIENT}
DATABASE_NAME: ${DATABASE_NAME}
DATABASE_HOST: ${DATABASE_HOST}
DATABASE_PORT: ${DATABASE_PORT}
DATABASE_USERNAME: ${DATABASE_USERNAME}
DATABASE_PASSWORD: ${DATABASE_PASSWORD}
labels:
traefik.enable: true
traefik.http.routers.strapi-dev.entrypoints: web
traefik.http.routers.strapi-dev.rule: PathPrefix(`/test`)
volumes:
- ./strapiTest:/srv/app
ports:
- "1337:1337"
networks:
- strapi-test
postgres:
image: postgres
container_name: postgres-test
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- ./dbTest:/var/lib/postgresql/data
networks:
- strapi-test
networks:
strapi-test:
external: true
When i run localhost:1337/dev i get “debug GET /test (3 ms) 404” in my strapi container
When i try to access with traefik localhost/dev i get the same “debug GET /test (3 ms) 404”
I saw that i have to use a proxy because url wont work without but i am not
comfortable with all this notions. Should i put nginx between traefik and strapi ? Or something else ?