-
Notifications
You must be signed in to change notification settings - Fork 0
Setting up a remote database
- A PostgreSQL host that you can connect to via port 5432 from the computer you're going to be installing the containers on
- The credentials for the superuser (generally
postgres
) - Some method of running
psql
on the PostgreSQL host, either from your container host or your local PC. Note that the version ofpsql
needs to match the version of PostgreSQL on the server for all functionality to be available. The current RDS in use is running PostgreSQL version 16.
- Add the environment variable GEONETWORK_DB_HOST to your
.env
file and set it to the address of the postgresql host - Comment out or remove the service definition for the
postgres
container from thedocker-compose
file you're using
Run the following steps to prep the template database, create a user, and install the necessary extensions:
Connect to the template1 database on your host (substitute in the host address, the same as you have for GEONETWORK_DB_HOST in .env
):
psql -h [host] -U postgres -d template1;
Enter the postgres user password at the prompt. Then run the following commands in psql, substituting 'yourgeonetworkpasswordinquotes' (the same as you have for POSTGRES_PASSWORD in .env
)
create user geonetwork with encrypted password [password] createdb;
create extension postgis;
create extension hstore;
create database geonetwork with template template1;
alter database geonetwork owner to geonetwork;
You should then be able to start up GeoNetwork with a fresh, blank database. The GeoNetwork start-up procedure, if it can connect to your database, will then populate the public schema with the necessary tables. If this doesn't happen, then it's likely that GeoNetwork could not connect to your database host. Check the log files if you are able to access them, otherwise work through the process of using psql
to connect using the geonetwork
user credentials from the computer you're running the containers on, and then the containers themselves (which might mean installing psql
inside the container).