I have been attempting to set up a Joplin server using the sample docker-compose in a Portainer stack. I am not too familiar with running personal databases, but from what I understand the compose file should be sufficient to setup both the database and the server, as well as connect them. However, I cannot seem to make it work. After deploying the stack it seems to be running, but localhost:22300/login shows ‘invalid URL’; a Joplin server copyright notice, and a link to the same page.
Docker-compose file:
version: '3'
services:
db:
image: postgres:latest
container_name: postgres
# ports:
# - 5433:5432
restart: unless-stopped
volumes:
- /srv/dev-disk-by-uuid-e2c30baa-1378-4126-a5e0-f850fb3b9396/DOCKER/DATA/JOPLIN:/var/lib/postgresql/data # Make database files persistent. Otherwise data is lost when the container is destroyed.
environment:
- APP_PORT=22300 # port joplin-server is reachable at
- POSTGRES_PASSWORD=mypassword123 # database password
- POSTGRES_USER=admin # database user
- POSTGRES_DB=joplin # database name
app:
image: joplin/server:latest
depends_on:
- db
ports:
- "22300:22300" # Expose internal port to LAN
restart: unless-stopped
environment:
- APP_BASE_URL=192.168.1.253:22300
- DB_CLIENT=pg
- POSTGRES_PASSWORD=mypassword123
- POSTGRES_DATABASE=joplin
- POSTGRES_USER=admin
- POSTGRES_PORT=5432
- POSTGRES_HOST=db
I see. Anyway, you need to remove these two containers (app, db) completely and after that add them again to reload the configuration (restart isn’t enough). I don’t know how can you do it in Portainer.
Each time I attempt a different configuration I first remove the stack (which removes both containers and their data). So far it has made no difference.
2021-09-17 07:08:37: App: Trying to connect to database...
2021-09-17 07:08:37: db: Could not connect. Will try again. password authentication failed for user "admin"
Is this because I need to create a database/user prior to running docker-compose (I assumed the compose file would do this for me)?
I think you ran the db container earlier with different user/password and now the db configuration is persisted thanks to this volume. It’s not enough to just remove the db container, you must remove volume as well to clean all data - https://documentation.portainer.io/v2.0/volumes/delete/.