postgres issues

24 views
Skip to first unread message

Aaron Echols

unread,
Jun 30, 2025, 1:51:34 PMJun 30
to Tinode General
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

Aaron Echols

unread,
Jun 30, 2025, 2:08:07 PMJun 30
to Tinode General
Also, if letting it create the database, I get the following even with superuser access in postgres:

2025/06/30 18:06:08 Database adapter: 'postgres'; version: 114
2025/06/30 18:06:08 Failed to init DB adapter: failed to connect to `host=postgres.apps.domain.cc user=<user> database=`: server error (FATAL: database "tin
ode" does not exist (SQLSTATE 3D000))

Gene

unread,
Jun 30, 2025, 2:09:49 PMJun 30
to Tinode General
The error messages are quite clear:

In your first message the user you are using to create the tinode db lacks needed permissions, in the second message the DB is missing. 

Aaron Echols

unread,
Jun 30, 2025, 2:20:05 PMJun 30
to Tinode General
No, it's not clear. Please read my other comments and not just the error logs. Those messages exist because the app DOES NOT create the database when it DOES NOT exist, even with the SUPERUSER permissions. The other error is because the app won't INIT the database when it DOES exist. It's cyclical errors when using ENV vars and I haven't found a way around it. I could create a tinode.conf file, but I'm trying to avoid that... Please let me know your thoughts. Thank you.

Aaron Echols

unread,
Jun 30, 2025, 2:22:16 PMJun 30
to Tinode General
One way the user has SUPERUSER permissions, the other is OWNER of the database when attempting to INIT the database. I saw your other comments that it attempts to drop and recreate, that doesn't work either even with SUPERUSER permissions.

Gene

unread,
Jul 1, 2025, 1:52:27 AMJul 1
to Tinode General
If your superuser does not have permission to drop/create databases then likely something is misconfigured in your database instance. You may want to try creating/dropping some DBs with the same credentials using command line tools or pgAdmin.
Reply all
Reply to author
Forward
0 new messages