PostgreSql addon

Name Last Update
test Loading commit data...
Dockerfile Loading commit data...
LICENSE Loading commit data... Loading commit data...
logo.png Loading commit data...
pg_hba.conf Loading commit data...
pg_ident.conf Loading commit data...
postgresql.conf Loading commit data... Loading commit data... Loading commit data...

This is the PostgreSQL addon that provider PostgreSQL database to Cloudron apps.


docker build -t girish/postgresql .


Pass postgresql variables in a separate file:

echo "POSTGRESQL_ROOT_PASSWORD=secret" > /tmp/

You can run the container as follows:

docker run -tiP --name=postgresql -v /tmp/pgdata:/var/lib/postgresql -v /tmp/ girish/postgresql


You can get the container IP using:

docker inspect --format="{{ .NetworkSettings.IPAddress }}" postgresql

You can then connect using:

PGPASSWORD=secret psql -h localhost -p <port> -U root --dbname=postgres

Alternately connect as (this is how apps will connect):

PGPASSWORD=secret psql -h <container_ip> -U root -W --dbname=dbcockroach

You can also exec into the container and connect without a password


The /addons/postgresql/ implements service commands like adding/removing users.

Listing users

docker exec -t -i postgresql /addons/postgresql/ list-users

Listing databases

docker exec -t -i postgresql /addons/postgresql/ list-databases

Adding user

docker exec -t -i postgresql /addons/postgresql/ add appid
    the command above will output something like POSTGRESQL_URL=postgres://usercockroach:X8FqEgca@

    Connect now using:
        PGPASSWORD=:X8FqEgca psql -h localhost -p 49154 -U usercockroach --dbname=dbcockroach
    Alternately connect using:
        PGPASSWORD=:X8FqEgca psql -h <container_ip> -U usercockroach --dbname=dbcockroach

Removing user

docker exec -t -i postgresql /addons/postgresql/ remove appid

Backing up an app

docker exec -t -i postgresql /addons/postgresql/ backup appid | grep -v ^+ > dump.sql

Restoring an app

docker exec -i postgresql /addons/postgresql/ restore appid < dump.sql