freifunk-saar / ff-node-monitor

Monitoring for Freifunk nodes
GNU Affero General Public License v3.0
3 stars 2 forks source link

ERROR: Database connection failure #59

Closed rubo77 closed 5 years ago

rubo77 commented 5 years ago

I get this error after upgrading debian to buster and postgresql to 11:

RUST_BACKTRACE=1 /opt/ff-node-monitor/src/target/release/ff-node-monitor 
🔧 Configured for production.
    => address: 0.0.0.0
    => port: 8000
    => log: critical
    => workers: 14
    => secret key: generated
    => limits: forms = 32KiB
    => keep-alive: 5s
    => tls: disabled
Warning: environment is 'production', but no `secret_key` is configured
Error: Database configuration failure: 'postgres'
Error: A table named `databases` was not found for this configuration
...

Maybe because I recreated the database and something is missing? We got an update from postgresql 9.6 to 11 which created a new folder /var/lib/postgresql/11 but the old database is still inside the folder /var/lib/postgresql/9.6

rubo77 commented 5 years ago

It seems like there is no tables created in the new DB:

sudo -u postgres psql --dbname=ff-node-monitor -c "SELECT *    FROM information_schema.tables  WHERE table_type = 'BASE TABLE'    AND table_schema = 'public'  ORDER BY table_type, table_name; "
RalfJung commented 5 years ago

"no secret_key configured" is just a warning, so that's not your main problem. However if you followed the instructions and used https://github.com/freifunk-saar/ff-node-monitor/blob/master/Rocket.toml.dist, you would have a secret_key set.

I'm afraid I have very little Postgres experience so I cannot help you if the migration did not work. :/ Are you sure the database even exists? As the instructions say, you need to create it manually:

sudo -u postgres psql -c 'CREATE ROLE "ff-node-monitor" WITH LOGIN;'
sudo -u postgres psql -c 'CREATE DATABASE "ff-node-monitor" WITH OWNER = "ff-node-monitor" LC_COLLATE = '\''de_DE.utf8'\'' TEMPLATE template0;'
rubo77 commented 5 years ago

I will try to revive the old 9.4 database, so this will not be reproducible by then