Hello,
I've been fiddling with setting tinode up via docker compose and am having issues with it not wanting to init the database. I've attempted to pre-create the database and also let tinode create the database automatically. I'm also attempting to use ENV vars and not the config to keep it simpler to maintain over time. No matter what permissions I give it, it has issues creating or using an existing database. I'm hoping maybe another set of eyes might point out something I might be missing. Thank you.
Here is the error, both with and without super user permissions:
2025/06/30 17:39:53 Database adapter: 'postgres'; version: 114
2025/06/30 17:39:53 Database not found. Creating.
2025/06/30 17:39:53 Failure: ERROR: permission denied to create database (SQLSTATE 42501)
./init-db failed. Quitting.
2025/06/30 17:40:53 Database adapter: 'postgres'; version: 114
2025/06/30 17:40:53 Database not found. Creating.
2025/06/30 17:40:53 Failure: ERROR: database "tinode" already exists (SQLSTATE 42P04)
./init-db failed. Quitting.
Here is my config:
Docker Compose:
services: tinode:
image: tinode/tinode-postgres:latest
container_name: tinode
restart: always
hostname: tinode
ports:
- 6060:6060
# You can mount your volumes as necessary:
# volumes:
# # E.g. external config (assuming EXT_CONFIG is set).
# - <path to your tinode.conf>:/etc/tinode/tinode.conf
# # Logs directory.
# - <path to your tinode-0 logs directory>:/var/log
env_file:
- .env
.env file:
# Server
STORE_USE_ADAPTER=postgres
PPROF_URL=/pprof
#EXT_CONFIG=/etc/tinode/tinode.conf
#WAIT_FOR=mysql:3306
NO_DB_INIT=false
RESET_DB=false
UPGRADE_DB=false
POSTGRES_DSN=postgresql://<user>:<password>@postgres.apps.domain.cc:5432/tinode
# Push notifications.
# Tinode Push Gateway configuration.
TNPG_PUSH_ENABLED=false
#TNPG_USER=<user name>
#TNPG_AUTH_TOKEN=<token>
# FCM specific server configuration.
FCM_PUSH_ENABLED=false
#FCM_CRED_FILE=<path to FCM credentials file>
#FCM_INCLUDE_ANDROID_NOTIFICATION=false
# FCM Web client configuration.
#FCM_API_KEY="AIzaSyD6X4ULR-RUsobvs1zZ2bHdJuPz39q2tbQ"
#FCM_APP_ID="1:114126160546:web:aca6ea2981feb81fb44dfb"
#FCM_PROJECT_ID="tinode-1000"
#FCM_SENDER_ID=114126160546
#FCM_VAPID_KEY="BOgQVPOMzIMXUpsYGpbVkZoEBc0ifKY_f2kSU5DNDGYI6i6CoKqqxDd7w7PJ3FaGRBgVGJffldETumOx831jl58"
#FCM_MEASUREMENT_ID="G-WNJDQR34L3"
# iOS app universal links configuration.
#IOS_UNIV_LINKS_APP_ID=<ios universal links app id>
# Video calls
WEBRTC_ENABLED=false
#ICE_SERVERS_FILE=<path to ICE servers config>
# Exporter
#TINODE_ADDR=http://tinode.host:6060/stats/expvar/
# InfluxDB configation:
#SERVE_FOR=influxdb=
#INFLUXDB_VERSION=1.7
#INFLUXDB_ORGANIZATION=<your organization>
#INFLUXDB_PUSH_INTERVAL=30
#INFLUXDB_PUSH_ADDRESS=https://mon.tinode.co/intake
#INFLUXDB_AUTH_TOKEN=<auth token>
# Prometheus configuration:
#SERVE_FOR=prometheus
#PROM_NAMESPACE=tinode
#PROM_METRICS_PATH=/metrics