Developer Guides ‐ Remotely connect to the PostgreSQL database - MarechJ/hll_rcon_tool GitHub Wiki
🧭 You are here : Wiki home / Developer Guides / Remotely connect to the PostgreSQL database
You can remotely access the PostgreSQL database and then be able to connect to it from a local editor software like pgAdmin.
Exposing the postgres
Docker container port to the outside can be done in the docker-compose-common-components.yaml
file, located in the root folder of your CRCON installation (usually /root/hll_rcon_tool
).
Expose the database container port
Edit docker-compose-common-components.yaml
and define an external port.
It has to be located at the end of the postgres:
part :
(in the example below, port 15432 will be exposed)
ports:
- 0.0.0.0:15432:5432
See the Complete postgres
part example below.
Connecting to the database
You'll then be able to connect to the PostgreSQL database using the CRCON database credentials :
- server : your VPS IP ;
- username : as defined in
.env
(HLL_DB_USER
, should bercon
, unless you changed it) ; - password : as defined in
.env
(HLL_DB_PASSWORD
) ; - database : as defined in
.env
(HLL_DB_NAME
, should bercon
, unless you changed it).
How to do a backup
As you have full access to the database, you can update or delete any table entry.
So don't forget to make complete backups before modifying anything.
[!NOTE] We'll assume you have installed CRCON in its default
/root/hll_rcon_tool
folder, following the installation guide.
Adapt the commands given below if necessary.
- stop the CRCON Docker containers :
cd /root/hll_rcon_tool && docker compose down
- make a copy of the whole database :
cp -r /root/hll_rcon_tool/db_data /root/hll_rcon_tool/db_data_backup
- restart CRCON :
cd /root/hll_rcon_tool && docker compose up -d
postgres
part
Complete You can refer to this to see where the lines that open the ports are to be added (these are the two last lines).
In this example, the port 15432 will be exposed.
postgres:
image: ${POSTGRES_IMAGE}
environment:
# If a password is not defined this container will fail to create
POSTGRES_PASSWORD: ${HLL_DB_PASSWORD}
POSTGRES_USER: ${HLL_DB_USER}
POSTGRES_DB: ${HLL_DB_NAME}
PGDATA: /data
HLL_DB_NAME: ${HLL_DB_NAME}
HLL_DB_USER: ${HLL_DB_USER}
restart: always
healthcheck:
test:
["CMD", "pg_isready", "-U", "${HLL_DB_USER}", "-d", "${HLL_DB_NAME}"]
interval: 15s
timeout: 30s
retries: 5
start_period: 80s
volumes:
- ./db_data:/data
networks:
- common
ports:
- 0.0.0.0:15432:5432