diff --git a/.env b/.env index 3f7add0..292576c 100644 --- a/.env +++ b/.env @@ -36,7 +36,6 @@ PROTOC_VERSION=3.9.1 PROTOC_ARCH=${DEFAULT_ARCH} PROTOC_BASE=${DEFAULT_BASE} POSTGRES_VERSION=14.2 -PSQL_VERSION=${POSTGRES_VERSION} PYTHON_VERSION=3.10 PYTHON2_VERSION=2.7.18 RUBY_VERSION=3.1.1 diff --git a/README.md b/README.md index 03cb088..9b1c545 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,10 @@ dockerized - Database - dolt - mysql + - [postgres](apps/postgres/README.md) + - psql + - pg_dump + - pg_dumpall - Dev-Ops & Docker - ansible - ansible-playbook diff --git a/apps/postgres/README.md b/apps/postgres/README.md new file mode 100644 index 0000000..b750b2c --- /dev/null +++ b/apps/postgres/README.md @@ -0,0 +1,26 @@ +# dockerized postgres + +You can use dockerized postgres to query your database, and manage backups, without locally installing postgres. + +The commands work as usual, except: + +- Use `host.docker.internal` instead of `localhost`. +- You can only access files in the current working directory (e.g. when dumping). + +## psql + +```shell +dockerized psql --host "host.docker.internal" --username +``` + +## pg_dumpall + +```shell + dockerized pg_dumpall \ + --host "host.docker.internal" \ + --file "backup.sql" \ + --username root \ + --no-password \ + --quote-all-identifiers \ + --verbose +``` \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 7e6cd83..ff74c50 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -156,8 +156,14 @@ services: php: image: "php:${PHP_VERSION}" psql: - image: "postgres:${PSQL_VERSION}" + image: "postgres:${POSTGRES_VERSION}" entrypoint: [ "psql" ] + pg_dump: + image: "postgres:${POSTGRES_VERSION}" + entrypoint: [ "pg_dump" ] + pg_dumpall: + image: "postgres:${POSTGRES_VERSION}" + entrypoint: [ "pg_dumpall" ] protoc: image: "protoc:${PROTOC_VERSION}" build: