I have setup a clean docker-central system for my development endeavors.
I find "Setting up a development environment" on https://github.com/getodk/central-backend it says:
Next, create a database and user in Postgres.
I need to know what database what the username password
Either use the same settings as the default configuration file, or update your local configuration file to match the settings you choose. For example:
CREATE USER jubilant WITH PASSWORD 'jubilant';
CREATE DATABASE jubilant_test with owner=jubilant encoding=UTF8;
CREATE DATABASE jubilant with owner=jubilant encoding=UTF8;
\c jubilant;
CREATE EXTENSION IF NOT EXISTS CITEXT;
CREATE EXTENSION IF NOT EXISTS pg_trgm;"
The default configuration file is a large json file that I can't figure out what it is or how to use it.
So, with a docker inspect, I find I can connect to a running database by
psql -h 172.20.0.3 -p 5432 -U odk
Password for user odk:
psql (10.15 (Ubuntu 10.15-0ubuntu0.18.04.1), server 9.6.20)
Type "help" for help.
odk=# CREATE USER jubilant WITH PASSWORD 'jubilant';
CREATE ROLE
odk=# CREATE DATABASE jubilant_test with owner=jubilant encoding=UTF8;
CREATE DATABASE
odk=# CREATE DATABASE jubilant with owner=jubilant encoding=UTF8;
CREATE DATABASE
\c jubilant;
psql (10.15 (Ubuntu 10.15-0ubuntu0.18.04.1), server 9.6.20)
You are now connected to database "jubilant" as user "odk".
jubilant=#CREATE EXTENSION IF NOT EXISTS CITEXT;
CREATE EXTENSION
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE EXTENSION
(exit to shell, "server" directory)
Then, go to the repository root in a command line (where this README is) and run make with no arguments.
make
pat@gauss:~/central.org/server$ make
node -e 'const { withDatabase, migrate } = require("./lib/model/database"); withDatabase(require("config").get("default.database"))(migrate);'
FS-related option specified for migration configuration. This resets migrationSource to default FsMigrations
(node:12263) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
(node:12263) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)
(node:12263) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I think the problem is localhost (127.0.0.1) is not accessable to the script but...
ufw status
inactive
and:
ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.047 ms
I'm out of tricks. Any suggestions?