dokku / dokku-redis

a redis plugin for dokku
MIT License
253 stars 38 forks source link

Dash in name prevent export #150

Closed skojin closed 3 years ago

skojin commented 4 years ago

I have create database with dash-in-name, like my-db

App connect successfully and works, but when I tried to backup, it give error

dokku postgres:export my-db
pg_dump: [archiver (db)] connection to database "my-db" failed: FATAL:  database "my-db" does not exist

Database connection URL postgres://postgres:XXXXXX@dokku-postgres-points-nearby:5432/points_nearby shows that problem that database name actually is _ underscored

dokku-postgres plugin version is 1.8.1

josegonzalez commented 4 years ago

Definitely a bug. Pull requests welcome :)

josegonzalez commented 3 years ago

Seems to work now (as of dokku-postgres@1.14.0):

root@77e422a94248:/workspaces/postgres# dokku postgres:create my-db
       Waiting for container to be ready
       Creating container database
       Securing connection to database
=====> Postgres container created: my-db
=====> my-db postgres service information
       Config dir:          /var/lib/dokku/services/postgres/my-db/data
       Config options:                               
       Data dir:            /var/lib/dokku/services/postgres/my-db/data
       Dsn:                 postgres://postgres:89fcca6e54119bf983488db25de09131@dokku-postgres-my-db:5432/my_db
       Exposed ports:       -                        
       Id:                  b3dd998aaad34f09c7e258ea097ef6b0f04b4463d7bd3eb698398ff32648cb29
       Internal ip:         172.17.0.6               
       Links:               -                        
       Service root:        /var/lib/dokku/services/postgres/my-db
       Status:              running                  
       Version:             postgres:13.4    

root@77e422a94248:/workspaces/postgres# dokku postgres:export my-db
ymy_db13.4 (Debian 13.4-1.pgdg100+1)13.4 (Debian 13.4-1.pgdg100+1)q
                                                                   0ENCODINENCODINGSET client_encoding = 'UTF8';
falser
      00
STDSTRINGS
STDSTRINGS(SET standard_conforming_strings = 'on';
falses
      00
SEARCHPATH
SEARCHPATH8SELECT pg_catalog.set_config('search_path', '', false);
falset
      126216384my_dDATABASEYCREATE DATABASE my_db WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE = 'en_US.utf8';
DROP DATABASE my_db;

Going to assume this was caused by a database that doesn't have the correct value at $SERVICE_ROOT/DATABASE_NAME. You can manually overwrite that file with the proper database name and it should start working.