I am trying to start two wikijs containers with different databases through traefik. I have no problem in starting the containers. I can start traefik on a subdomain and I even can start the two wikis on different subdomains. My problem is the following: Every time I start the wikijs containers I always somehow use the same database and I don't know how to change that.
The purpose is, that I have customers which want to have a seperate wiki for their documentation. So I want to start as many wikijs containers as possible but preferably through one docker-compose.yml file.
Can anybody tell me, what I am doing wrong? Thanks = )
this is my traefik.toml file:
defaultEntryPoints = ["http", "https"]
[entryPoints]
[entryPoints.http]
address = ":80"
[entryPoints.http.redirect]
entryPoint = "https"
[entryPoints.https]
address = ":443"
[entryPoints.https.tls]
[entryPoints.dashboard]
address = ":8080"
[entryPoints.dashboard.auth]
[entryPoints.dashboard.auth.basic]
users = ["admin:$apr1$Ld55R9Cl$/8W5BCc.J/Qtg9Xtpk4lq0"]
[api]
entrypoint="dashboard"
[acme]
email = "email@domain.com"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
[acme.httpChallenge]
this is my docker-compose.yml file:
services:
db:
image: postgres:11-alpine
networks:
- internal
labels:
- "traefik.enable=false"
environment:
POSTGRES_DB: wiki1
POSTGRES_PASSWORD: wikijsrocks
POSTGRES_USER: wikijs
logging:
driver: "none"
restart: unless-stopped
volumes:
- db-data:/var/lib/postgresql/data
db1:
image: postgres:11-alpine
networks:
- internal
labels:
- "traefik.enable=false"
environment:
POSTGRES_DB: wiki2
POSTGRES_PASSWORD: wikijsrocks
POSTGRES_USER: wikijs
logging:
driver: "none"
restart: unless-stopped
volumes:
- db-data1:/var/lib/postgresql/data
wiki1:
image: requarks/wiki:2
networks:
- internal
- web
labels:
- "traefik.enable=true"
- "traefik.backend=wiki1"
- "traefik.docker.network=web"
- "traefik.frontend.rule=Host:domain.com"
- "traefik.http.services.wiki.loadbalancer.server.port=3000"
depends_on:
- db
environment:
DB_TYPE: postgres
DB_HOST: db
DB_PORT: 5432
DB_USER: wikijs
DB_PASS: wikijsrocks
DB_NAME: wiki
restart: unless-stopped
wiki2:
image: requarks/wiki:2
networks:
- internal
- web
labels:
- "traefik.enable=true"
- "traefik.backend=wiki2"
- "traefik.docker.network=web"
- "traefik.frontend.rule=Host:domain.com" - "traefik.http.services.wiki.loadbalancer.server.port=3000"
depends_on:
- db1
environment:
DB_TYPE: postgres
DB_HOST: db1
DB_PORT: 5432
DB_USER: wikijs
DB_PASS: wikijsrocks
DB_NAME: wikispiral
restart: unless-stopped
adminer:
image: adminer:4.6.3-standalone
labels:
- traefik.backend=adminer
- traefik.frontend.rule=Host:domain.com
- traefik.docker.network=web
- traefik.port=8080
networks:
- internal
- web
depends_on:
- db
- db1
volumes:
db-data:
db-data1:
networks:
web:
external: true
internal:
external: false
Both databases are on the same network:
networks:
- internal
and listening on the same port:
DB_PORT: 5432
So put each database in it's own network and add that network to the wikis service or instead change the port that one of them is listening to.