{"id":13419836,"url":"https://github.com/dokku/dokku-postgres","last_synced_at":"2026-01-16T08:24:19.400Z","repository":{"id":36928024,"uuid":"41235251","full_name":"dokku/dokku-postgres","owner":"dokku","description":"a postgres plugin for dokku","archived":false,"fork":false,"pushed_at":"2026-01-14T00:07:35.000Z","size":645,"stargazers_count":520,"open_issues_count":14,"forks_count":106,"subscribers_count":7,"default_branch":"master","last_synced_at":"2026-01-14T03:59:18.596Z","etag":null,"topics":["dokku","dokku-plugin","dokku-service","paas","postgresql"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dokku.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"dokku","open_collective":"dokku","patreon":"dokku"}},"created_at":"2015-08-23T04:10:37.000Z","updated_at":"2026-01-14T00:07:39.000Z","dependencies_parsed_at":"2023-02-15T18:55:35.267Z","dependency_job_id":"6628c33a-33bc-4e4a-8806-5f88614f4b16","html_url":"https://github.com/dokku/dokku-postgres","commit_stats":{"total_commits":592,"total_committers":32,"mean_commits":18.5,"dds":"0.31756756756756754","last_synced_commit":"b18d0838b9daab2bb225a653e466fee6a0dc3c48"},"previous_names":[],"tags_count":104,"template":false,"template_full_name":null,"purl":"pkg:github/dokku/dokku-postgres","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dokku%2Fdokku-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dokku%2Fdokku-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dokku%2Fdokku-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dokku%2Fdokku-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dokku","download_url":"https://codeload.github.com/dokku/dokku-postgres/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dokku%2Fdokku-postgres/sbom","scorecard":{"id":349977,"data":{"date":"2025-08-11","repo":{"name":"github.com/dokku/dokku-postgres","commit":"34cee3536e8a8c4c8222c3a717dedc3f761dfb17"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.5,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/10 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":5,"reason":"6 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/tagged-release.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/dokku/dokku-postgres/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/dokku/dokku-postgres/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:54: update your workflow using https://app.stepsecurity.io/secureworkflow/dokku/dokku-postgres/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:67: update your workflow using https://app.stepsecurity.io/secureworkflow/dokku/dokku-postgres/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/dokku/dokku-postgres/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:96: update your workflow using https://app.stepsecurity.io/secureworkflow/dokku/dokku-postgres/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/tagged-release.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/dokku/dokku-postgres/tagged-release.yml/master?enable=pin","Warn: containerImage not pinned by hash: .devcontainer/Dockerfile:1: pin your Docker image by updating dokku/dokku:latest to dokku/dokku:latest@sha256:783e2569f86840c58d359b178d450864ac1eaa2de3dd899f68371a8b19895f5e","Warn: containerImage not pinned by hash: Dockerfile:1: pin your Docker image by updating postgres:17.5 to postgres:17.5@sha256:0f9d52b237395d0512efd1e5493ac9bd60606839994422bba9bfa7ab3ddc32ea","Warn: downloadThenRun not pinned by hash: tests/setup.sh:14","Warn: downloadThenRun not pinned by hash: tests/setup.sh:16","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   2 containerImage dependencies pinned","Info:   0 out of   2 downloadThenRun dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/dokku/.github/SECURITY.md:1","Info: Found linked content: github.com/dokku/.github/SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/dokku/.github/SECURITY.md:1","Info: Found text in security policy: github.com/dokku/.github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 24 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T08:06:38.157Z","repository_id":36928024,"created_at":"2025-08-18T08:06:38.157Z","updated_at":"2025-08-18T08:06:38.157Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T06:30:42.265Z","status":"ssl_error","status_checked_at":"2026-01-16T06:30:16.248Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dokku","dokku-plugin","dokku-service","paas","postgresql"],"created_at":"2024-07-30T22:01:21.655Z","updated_at":"2026-01-16T08:24:19.373Z","avatar_url":"https://github.com/dokku.png","language":"Shell","funding_links":["https://github.com/sponsors/dokku","https://opencollective.com/dokku","https://patreon.com/dokku"],"categories":["Shell"],"sub_categories":[],"readme":"# dokku postgres [![Build Status](https://img.shields.io/github/actions/workflow/status/dokku/dokku-postgres/ci.yml?branch=master\u0026style=flat-square \"Build Status\")](https://github.com/dokku/dokku-postgres/actions/workflows/ci.yml?query=branch%3Amaster) [![IRC Network](https://img.shields.io/badge/irc-libera-blue.svg?style=flat-square \"IRC Libera\")](https://webchat.libera.chat/?channels=dokku)\n\nOfficial postgres plugin for dokku. Currently defaults to installing [postgres 18.1](https://hub.docker.com/_/postgres/).\n\n## Requirements\n\n- dokku 0.19.x+\n- docker 1.8.x\n\n## Installation\n\n```shell\n# on 0.19.x+\nsudo dokku plugin:install https://github.com/dokku/dokku-postgres.git --name postgres\n```\n\n## Commands\n\n```\npostgres:app-links \u003capp\u003e                           # list all postgres service links for a given app\npostgres:backup \u003cservice\u003e \u003cbucket-name\u003e [--use-iam] # create a backup of the postgres service to an existing s3 bucket\npostgres:backup-auth \u003cservice\u003e \u003caws-access-key-id\u003e \u003caws-secret-access-key\u003e \u003caws-default-region\u003e \u003caws-signature-version\u003e \u003cendpoint-url\u003e # set up authentication for backups on the postgres service\npostgres:backup-deauth \u003cservice\u003e                   # remove backup authentication for the postgres service\npostgres:backup-schedule \u003cservice\u003e \u003cschedule\u003e \u003cbucket-name\u003e [--use-iam] # schedule a backup of the postgres service\npostgres:backup-schedule-cat \u003cservice\u003e             # cat the contents of the configured backup cronfile for the service\npostgres:backup-set-encryption \u003cservice\u003e \u003cpassphrase\u003e # set encryption for all future backups of postgres service\npostgres:backup-set-public-key-encryption \u003cservice\u003e \u003cpublic-key-id\u003e # set GPG Public Key encryption for all future backups of postgres service\npostgres:backup-unschedule \u003cservice\u003e               # unschedule the backup of the postgres service\npostgres:backup-unset-encryption \u003cservice\u003e         # unset encryption for future backups of the postgres service\npostgres:backup-unset-public-key-encryption \u003cservice\u003e # unset GPG Public Key encryption for future backups of the postgres service\npostgres:clone \u003cservice\u003e \u003cnew-service\u003e [--clone-flags...] # create container \u003cnew-name\u003e then copy data from \u003cname\u003e into \u003cnew-name\u003e\npostgres:connect \u003cservice\u003e                         # connect to the service via the postgres connection tool\npostgres:create \u003cservice\u003e [--create-flags...]      # create a postgres service\npostgres:destroy \u003cservice\u003e [-f|--force]            # delete the postgres service/data/container if there are no links left\npostgres:enter \u003cservice\u003e                           # enter or run a command in a running postgres service container\npostgres:exists \u003cservice\u003e                          # check if the postgres service exists\npostgres:export \u003cservice\u003e                          # export a dump of the postgres service database\npostgres:expose \u003cservice\u003e \u003cports...\u003e               # expose a postgres service on custom host:port if provided (random port on the 0.0.0.0 interface if otherwise unspecified)\npostgres:import \u003cservice\u003e                          # import a dump into the postgres service database\npostgres:info \u003cservice\u003e [--single-info-flag]       # print the service information\npostgres:link \u003cservice\u003e \u003capp\u003e [--link-flags...]    # link the postgres service to the app\npostgres:linked \u003cservice\u003e \u003capp\u003e                    # check if the postgres service is linked to an app\npostgres:links \u003cservice\u003e                           # list all apps linked to the postgres service\npostgres:list                                      # list all postgres services\npostgres:logs \u003cservice\u003e [-t|--tail] \u003ctail-num-optional\u003e # print the most recent log(s) for this service\npostgres:pause \u003cservice\u003e                           # pause a running postgres service\npostgres:promote \u003cservice\u003e \u003capp\u003e                   # promote service \u003cservice\u003e as DATABASE_URL in \u003capp\u003e\npostgres:restart \u003cservice\u003e                         # graceful shutdown and restart of the postgres service container\npostgres:set \u003cservice\u003e \u003ckey\u003e \u003cvalue\u003e               # set or clear a property for a service\npostgres:start \u003cservice\u003e                           # start a previously stopped postgres service\npostgres:stop \u003cservice\u003e                            # stop a running postgres service\npostgres:unexpose \u003cservice\u003e                        # unexpose a previously exposed postgres service\npostgres:unlink \u003cservice\u003e \u003capp\u003e                    # unlink the postgres service from the app\npostgres:upgrade \u003cservice\u003e [--upgrade-flags...]    # upgrade service \u003cservice\u003e to the specified versions\n```\n\n## Usage\n\nHelp for any commands can be displayed by specifying the command as an argument to postgres:help. Plugin help output in conjunction with any files in the `docs/` folder is used to generate the plugin documentation. Please consult the `postgres:help` command for any undocumented commands.\n\n### Basic Usage\n\n### create a postgres service\n\n```shell\n# usage\ndokku postgres:create \u003cservice\u003e [--create-flags...]\n```\n\nflags:\n\n- `-c|--config-options \"--args --go=here\"`: extra arguments to pass to the container create command (default: `None`)\n- `-C|--custom-env \"USER=alpha;HOST=beta\"`: semi-colon delimited environment variables to start the service with\n- `-i|--image IMAGE`: the image name to start the service with\n- `-I|--image-version IMAGE_VERSION`: the image version to start the service with\n- `-m|--memory MEMORY`: container memory limit in megabytes (default: unlimited)\n- `-N|--initial-network INITIAL_NETWORK`: the initial network to attach the service to\n- `-p|--password PASSWORD`: override the user-level service password\n- `-P|--post-create-network NETWORKS`: a comma-separated list of networks to attach the service container to after service creation\n- `-r|--root-password PASSWORD`: override the root-level service password\n- `-S|--post-start-network NETWORKS`: a comma-separated list of networks to attach the service container to after service start\n- `-s|--shm-size SHM_SIZE`: override shared memory size for postgres docker container\n\nCreate a postgres service named lollipop:\n\n```shell\ndokku postgres:create lollipop\n```\n\nYou can also specify the image and image version to use for the service. It *must* be compatible with the postgres image.\n\n```shell\nexport POSTGRES_IMAGE=\"postgres\"\nexport POSTGRES_IMAGE_VERSION=\"${PLUGIN_IMAGE_VERSION}\"\ndokku postgres:create lollipop\n```\n\nYou can also specify custom environment variables to start the postgres service in semicolon-separated form.\n\n```shell\nexport POSTGRES_CUSTOM_ENV=\"USER=alpha;HOST=beta\"\ndokku postgres:create lollipop\n```\n\nOfficial Postgres \"$DOCKER_BIN\" image ls does not include postgis extension (amongst others). The following example creates a new postgres service using `postgis/postgis:13-3.1` image, which includes the `postgis` extension.\n\n```shell\n# use the appropriate image-version for your use-case\ndokku postgres:create postgis-database --image \"postgis/postgis\" --image-version \"13-3.1\"\n```\n\nTo use pgvector instead, run the following:\n\n```shell\n# use the appropriate image-version for your use-case\ndokku postgres:create pgvector-database --image \"pgvector/pgvector\" --image-version \"pg17\"\n```\n\n### print the service information\n\n```shell\n# usage\ndokku postgres:info \u003cservice\u003e [--single-info-flag]\n```\n\nflags:\n\n- `--config-dir`: show the service configuration directory\n- `--data-dir`: show the service data directory\n- `--dsn`: show the service DSN\n- `--exposed-ports`: show service exposed ports\n- `--id`: show the service container id\n- `--internal-ip`: show the service internal ip\n- `--initial-network`: show the initial network being connected to\n- `--links`: show the service app links\n- `--post-create-network`: show the networks to attach to after service container creation\n- `--post-start-network`: show the networks to attach to after service container start\n- `--service-root`: show the service root directory\n- `--status`: show the service running status\n- `--version`: show the service image version\n\nGet connection information as follows:\n\n```shell\ndokku postgres:info lollipop\n```\n\nYou can also retrieve a specific piece of service info via flags:\n\n```shell\ndokku postgres:info lollipop --config-dir\ndokku postgres:info lollipop --data-dir\ndokku postgres:info lollipop --dsn\ndokku postgres:info lollipop --exposed-ports\ndokku postgres:info lollipop --id\ndokku postgres:info lollipop --internal-ip\ndokku postgres:info lollipop --initial-network\ndokku postgres:info lollipop --links\ndokku postgres:info lollipop --post-create-network\ndokku postgres:info lollipop --post-start-network\ndokku postgres:info lollipop --service-root\ndokku postgres:info lollipop --status\ndokku postgres:info lollipop --version\n```\n\n### list all postgres services\n\n```shell\n# usage\ndokku postgres:list\n```\n\nList all services:\n\n```shell\ndokku postgres:list\n```\n\n### print the most recent log(s) for this service\n\n```shell\n# usage\ndokku postgres:logs \u003cservice\u003e [-t|--tail] \u003ctail-num-optional\u003e\n```\n\nflags:\n\n- `-t|--tail [\u003ctail-num\u003e]`: do not stop when end of the logs are reached and wait for additional output\n\nYou can tail logs for a particular service:\n\n```shell\ndokku postgres:logs lollipop\n```\n\nBy default, logs will not be tailed, but you can do this with the --tail flag:\n\n```shell\ndokku postgres:logs lollipop --tail\n```\n\nThe default tail setting is to show all logs, but an initial count can also be specified:\n\n```shell\ndokku postgres:logs lollipop --tail 5\n```\n\n### link the postgres service to the app\n\n```shell\n# usage\ndokku postgres:link \u003cservice\u003e \u003capp\u003e [--link-flags...]\n```\n\nflags:\n\n- `-a|--alias \"BLUE_DATABASE\"`: an alternative alias to use for linking to an app via environment variable\n- `-q|--querystring \"pool=5\"`: ampersand delimited querystring arguments to append to the service link\n- `-n|--no-restart \"false\"`: whether or not to restart the app on link (default: true)\n\nA postgres service can be linked to a container. This will use native docker links via the docker-options plugin. Here we link it to our `playground` app.\n\n\u003e NOTE: this will restart your app\n\n```shell\ndokku postgres:link lollipop playground\n```\n\nThe following environment variables will be set automatically by docker (not on the app itself, so they won’t be listed when calling dokku config):\n\n```\nDOKKU_POSTGRES_LOLLIPOP_NAME=/lollipop/DATABASE\nDOKKU_POSTGRES_LOLLIPOP_PORT=tcp://172.17.0.1:5432\nDOKKU_POSTGRES_LOLLIPOP_PORT_5432_TCP=tcp://172.17.0.1:5432\nDOKKU_POSTGRES_LOLLIPOP_PORT_5432_TCP_PROTO=tcp\nDOKKU_POSTGRES_LOLLIPOP_PORT_5432_TCP_PORT=5432\nDOKKU_POSTGRES_LOLLIPOP_PORT_5432_TCP_ADDR=172.17.0.1\n```\n\nThe following will be set on the linked application by default:\n\n```\nDATABASE_URL=postgres://lollipop:SOME_PASSWORD@dokku-postgres-lollipop:5432/lollipop\n```\n\nThe host exposed here only works internally in docker containers. If you want your container to be reachable from outside, you should use the `expose` subcommand. Another service can be linked to your app:\n\n```shell\ndokku postgres:link other_service playground\n```\n\nIt is possible to change the protocol for `DATABASE_URL` by setting the environment variable `POSTGRES_DATABASE_SCHEME` on the app. Doing so will after linking will cause the plugin to think the service is not linked, and we advise you to unlink before proceeding.\n\n```shell\ndokku config:set playground POSTGRES_DATABASE_SCHEME=postgres2\ndokku postgres:link lollipop playground\n```\n\nThis will cause `DATABASE_URL` to be set as:\n\n```\npostgres2://lollipop:SOME_PASSWORD@dokku-postgres-lollipop:5432/lollipop\n```\n\n### unlink the postgres service from the app\n\n```shell\n# usage\ndokku postgres:unlink \u003cservice\u003e \u003capp\u003e\n```\n\nflags:\n\n- `-n|--no-restart \"false\"`: whether or not to restart the app on unlink (default: true)\n\nYou can unlink a postgres service:\n\n\u003e NOTE: this will restart your app and unset related environment variables\n\n```shell\ndokku postgres:unlink lollipop playground\n```\n\n### set or clear a property for a service\n\n```shell\n# usage\ndokku postgres:set \u003cservice\u003e \u003ckey\u003e \u003cvalue\u003e\n```\n\nSet the network to attach after the service container is started:\n\n```shell\ndokku postgres:set lollipop post-create-network custom-network\n```\n\nSet multiple networks:\n\n```shell\ndokku postgres:set lollipop post-create-network custom-network,other-network\n```\n\nUnset the post-create-network value:\n\n```shell\ndokku postgres:set lollipop post-create-network\n```\n\n### Service Lifecycle\n\nThe lifecycle of each service can be managed through the following commands:\n\n### connect to the service via the postgres connection tool\n\n```shell\n# usage\ndokku postgres:connect \u003cservice\u003e\n```\n\nConnect to the service via the postgres connection tool:\n\n\u003e NOTE: disconnecting from ssh while running this command may leave zombie processes due to moby/moby#9098\n\n```shell\ndokku postgres:connect lollipop\n```\n\n### enter or run a command in a running postgres service container\n\n```shell\n# usage\ndokku postgres:enter \u003cservice\u003e\n```\n\nA bash prompt can be opened against a running service. Filesystem changes will not be saved to disk.\n\n\u003e NOTE: disconnecting from ssh while running this command may leave zombie processes due to moby/moby#9098\n\n```shell\ndokku postgres:enter lollipop\n```\n\nYou may also run a command directly against the service. Filesystem changes will not be saved to disk.\n\n```shell\ndokku postgres:enter lollipop touch /tmp/test\n```\n\n### expose a postgres service on custom host:port if provided (random port on the 0.0.0.0 interface if otherwise unspecified)\n\n```shell\n# usage\ndokku postgres:expose \u003cservice\u003e \u003cports...\u003e\n```\n\nExpose the service on the service's normal ports, allowing access to it from the public interface (`0.0.0.0`):\n\n```shell\ndokku postgres:expose lollipop 5432\n```\n\nExpose the service on the service's normal ports, with the first on a specified ip address (127.0.0.1):\n\n```shell\ndokku postgres:expose lollipop 127.0.0.1:5432\n```\n\n### unexpose a previously exposed postgres service\n\n```shell\n# usage\ndokku postgres:unexpose \u003cservice\u003e\n```\n\nUnexpose the service, removing access to it from the public interface (`0.0.0.0`):\n\n```shell\ndokku postgres:unexpose lollipop\n```\n\n### promote service \u003cservice\u003e as DATABASE_URL in \u003capp\u003e\n\n```shell\n# usage\ndokku postgres:promote \u003cservice\u003e \u003capp\u003e\n```\n\nIf you have a postgres service linked to an app and try to link another postgres service another link environment variable will be generated automatically:\n\n```\nDOKKU_DATABASE_BLUE_URL=postgres://other_service:ANOTHER_PASSWORD@dokku-postgres-other-service:5432/other_service\n```\n\nYou can promote the new service to be the primary one:\n\n\u003e NOTE: this will restart your app\n\n```shell\ndokku postgres:promote other_service playground\n```\n\nThis will replace `DATABASE_URL` with the url from other_service and generate another environment variable to hold the previous value if necessary. You could end up with the following for example:\n\n```\nDATABASE_URL=postgres://other_service:ANOTHER_PASSWORD@dokku-postgres-other-service:5432/other_service\nDOKKU_DATABASE_BLUE_URL=postgres://other_service:ANOTHER_PASSWORD@dokku-postgres-other-service:5432/other_service\nDOKKU_DATABASE_SILVER_URL=postgres://lollipop:SOME_PASSWORD@dokku-postgres-lollipop:5432/lollipop\n```\n\n### start a previously stopped postgres service\n\n```shell\n# usage\ndokku postgres:start \u003cservice\u003e\n```\n\nStart the service:\n\n```shell\ndokku postgres:start lollipop\n```\n\n### stop a running postgres service\n\n```shell\n# usage\ndokku postgres:stop \u003cservice\u003e\n```\n\nStop the service and removes the running container:\n\n```shell\ndokku postgres:stop lollipop\n```\n\n### pause a running postgres service\n\n```shell\n# usage\ndokku postgres:pause \u003cservice\u003e\n```\n\nPause the running container for the service:\n\n```shell\ndokku postgres:pause lollipop\n```\n\n### graceful shutdown and restart of the postgres service container\n\n```shell\n# usage\ndokku postgres:restart \u003cservice\u003e\n```\n\nRestart the service:\n\n```shell\ndokku postgres:restart lollipop\n```\n\n### upgrade service \u003cservice\u003e to the specified versions\n\n```shell\n# usage\ndokku postgres:upgrade \u003cservice\u003e [--upgrade-flags...]\n```\n\nflags:\n\n- `-c|--config-options \"--args --go=here\"`: extra arguments to pass to the container create command (default: `None`)\n- `-C|--custom-env \"USER=alpha;HOST=beta\"`: semi-colon delimited environment variables to start the service with\n- `-i|--image IMAGE`: the image name to start the service with\n- `-I|--image-version IMAGE_VERSION`: the image version to start the service with\n- `-N|--initial-network INITIAL_NETWORK`: the initial network to attach the service to\n- `-P|--post-create-network NETWORKS`: a comma-separated list of networks to attach the service container to after service creation\n- `-R|--restart-apps \"true\"`: whether or not to force an app restart (default: false)\n- `-S|--post-start-network NETWORKS`: a comma-separated list of networks to attach the service container to after service start\n- `-s|--shm-size SHM_SIZE`: override shared memory size for postgres docker container\n\nYou can upgrade an existing service to a new image or image-version:\n\n```shell\ndokku postgres:upgrade lollipop\n```\n\nPostgres does not handle upgrading data for major versions automatically (eg. 11 =\u003e 12). Upgrades should be done manually. Users are encouraged to upgrade to the latest minor release for their postgres version before performing a major upgrade.\n\nWhile there are many ways to upgrade a postgres database, for safety purposes, it is recommended that an upgrade is performed by exporting the data from an existing database and importing it into a new database. This also allows testing to ensure that applications interact with the database correctly after the upgrade, and can be used in a staging environment.\n\nThe following is an example of how to upgrade a postgres database named `lollipop-11` from 11.13 to 12.8.\n\n```shell\n# stop any linked apps\ndokku ps:stop linked-app\n\n# export the database contents\ndokku postgres:export lollipop-11 \u003e /tmp/lollipop-11.export\n\n# create a new database at the desired version\ndokku postgres:create lollipop-12 --image-version 12.8\n\n# import the export file\ndokku postgres:import lollipop-12 \u003c /tmp/lollipop-11.export\n\n# run any sql tests against the new database to verify the import went smoothly\n\n# unlink the old database from your apps\ndokku postgres:unlink lollipop-11 linked-app\n\n# link the new database to your apps\ndokku postgres:link lollipop-12 linked-app\n\n# start the linked apps again\ndokku ps:start linked-app\n```\n\n### Service Automation\n\nService scripting can be executed using the following commands:\n\n### list all postgres service links for a given app\n\n```shell\n# usage\ndokku postgres:app-links \u003capp\u003e\n```\n\nList all postgres services that are linked to the `playground` app.\n\n```shell\ndokku postgres:app-links playground\n```\n\n### create container \u003cnew-name\u003e then copy data from \u003cname\u003e into \u003cnew-name\u003e\n\n```shell\n# usage\ndokku postgres:clone \u003cservice\u003e \u003cnew-service\u003e [--clone-flags...]\n```\n\nflags:\n\n- `-c|--config-options \"--args --go=here\"`: extra arguments to pass to the container create command (default: `None`)\n- `-C|--custom-env \"USER=alpha;HOST=beta\"`: semi-colon delimited environment variables to start the service with\n- `-i|--image IMAGE`: the image name to start the service with\n- `-I|--image-version IMAGE_VERSION`: the image version to start the service with\n- `-m|--memory MEMORY`: container memory limit in megabytes (default: unlimited)\n- `-N|--initial-network INITIAL_NETWORK`: the initial network to attach the service to\n- `-p|--password PASSWORD`: override the user-level service password\n- `-P|--post-create-network NETWORKS`: a comma-separated list of networks to attach the service container to after service creation\n- `-r|--root-password PASSWORD`: override the root-level service password\n- `-S|--post-start-network NETWORKS`: a comma-separated list of networks to attach the service container to after service start\n- `-s|--shm-size SHM_SIZE`: override shared memory size for postgres docker container\n\nYou can clone an existing service to a new one:\n\n```shell\ndokku postgres:clone lollipop lollipop-2\n```\n\n### check if the postgres service exists\n\n```shell\n# usage\ndokku postgres:exists \u003cservice\u003e\n```\n\nHere we check if the lollipop postgres service exists.\n\n```shell\ndokku postgres:exists lollipop\n```\n\n### check if the postgres service is linked to an app\n\n```shell\n# usage\ndokku postgres:linked \u003cservice\u003e \u003capp\u003e\n```\n\nHere we check if the lollipop postgres service is linked to the `playground` app.\n\n```shell\ndokku postgres:linked lollipop playground\n```\n\n### list all apps linked to the postgres service\n\n```shell\n# usage\ndokku postgres:links \u003cservice\u003e\n```\n\nList all apps linked to the `lollipop` postgres service.\n\n```shell\ndokku postgres:links lollipop\n```\n\n### Data Management\n\nThe underlying service data can be imported and exported with the following commands:\n\n### import a dump into the postgres service database\n\n```shell\n# usage\ndokku postgres:import \u003cservice\u003e\n```\n\nImport a datastore dump:\n\n```shell\ndokku postgres:import lollipop \u003c data.dump\n```\n\n### export a dump of the postgres service database\n\n```shell\n# usage\ndokku postgres:export \u003cservice\u003e\n```\n\nBy default, datastore output is exported to stdout:\n\n```shell\ndokku postgres:export lollipop\n```\n\nYou can redirect this output to a file:\n\n```shell\ndokku postgres:export lollipop \u003e data.dump\n```\n\nNote that the export will result in a file containing the binary postgres export data. It can be converted to plain text using `pg_restore` as follows\n\n```shell\npg_restore data.dump -f plain.sql\n```\n\n### Backups\n\nDatastore backups are supported via AWS S3 and S3 compatible services like [minio](https://github.com/minio/minio).\n\nYou may skip the `backup-auth` step if your dokku install is running within EC2 and has access to the bucket via an IAM profile. In that case, use the `--use-iam` option with the `backup` command.\n\nIf both passphrase and public key forms of encryption are set, the public key encryption will take precedence.\n\nThe underlying core backup script is present [here](https://github.com/dokku/docker-s3backup/blob/main/backup.sh).\n\nBackups can be performed using the backup commands:\n\n### set up authentication for backups on the postgres service\n\n```shell\n# usage\ndokku postgres:backup-auth \u003cservice\u003e \u003caws-access-key-id\u003e \u003caws-secret-access-key\u003e \u003caws-default-region\u003e \u003caws-signature-version\u003e \u003cendpoint-url\u003e\n```\n\nSetup s3 backup authentication:\n\n```shell\ndokku postgres:backup-auth lollipop AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY\n```\n\nSetup s3 backup authentication with different region:\n\n```shell\ndokku postgres:backup-auth lollipop AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_REGION\n```\n\nSetup s3 backup authentication with different signature version and endpoint:\n\n```shell\ndokku postgres:backup-auth lollipop AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_REGION AWS_SIGNATURE_VERSION ENDPOINT_URL\n```\n\nMore specific example for minio auth:\n\n```shell\ndokku postgres:backup-auth lollipop MINIO_ACCESS_KEY_ID MINIO_SECRET_ACCESS_KEY us-east-1 s3v4 https://YOURMINIOSERVICE\n```\n\n### remove backup authentication for the postgres service\n\n```shell\n# usage\ndokku postgres:backup-deauth \u003cservice\u003e\n```\n\nRemove s3 authentication:\n\n```shell\ndokku postgres:backup-deauth lollipop\n```\n\n### create a backup of the postgres service to an existing s3 bucket\n\n```shell\n# usage\ndokku postgres:backup \u003cservice\u003e \u003cbucket-name\u003e [--use-iam]\n```\n\nflags:\n\n- `-u|--use-iam`: use the IAM profile associated with the current server\n\nBackup the `lollipop` service to the `my-s3-bucket` bucket on `AWS`:`\n\n```shell\ndokku postgres:backup lollipop my-s3-bucket --use-iam\n```\n\nRestore a backup file (assuming it was extracted via `tar -xf backup.tgz`):\n\n```shell\ndokku postgres:import lollipop \u003c backup-folder/export\n```\n\n### set encryption for all future backups of postgres service\n\n```shell\n# usage\ndokku postgres:backup-set-encryption \u003cservice\u003e \u003cpassphrase\u003e\n```\n\nSet the GPG-compatible passphrase for encrypting backups for backups:\n\n```shell\ndokku postgres:backup-set-encryption lollipop\n```\n\nPublic key encryption will take precendence over the passphrase encryption if both types are set.\n\n### set GPG Public Key encryption for all future backups of postgres service\n\n```shell\n# usage\ndokku postgres:backup-set-public-key-encryption \u003cservice\u003e \u003cpublic-key-id\u003e\n```\n\nSet the `GPG` Public Key for encrypting backups:\n\n```shell\ndokku postgres:backup-set-public-key-encryption lollipop\n```\n\nThis method currently requires the \u003cpublic-key-id\u003e to be present on the keyserver `keyserver.ubuntu.com`:\n\n### unset encryption for future backups of the postgres service\n\n```shell\n# usage\ndokku postgres:backup-unset-encryption \u003cservice\u003e\n```\n\nUnset the `GPG` encryption passphrase for backups:\n\n```shell\ndokku postgres:backup-unset-encryption lollipop\n```\n\n### unset GPG Public Key encryption for future backups of the postgres service\n\n```shell\n# usage\ndokku postgres:backup-unset-public-key-encryption \u003cservice\u003e\n```\n\nUnset the `GPG` Public Key encryption for backups:\n\n```shell\ndokku postgres:backup-unset-public-key-encryption lollipop\n```\n\n### schedule a backup of the postgres service\n\n```shell\n# usage\ndokku postgres:backup-schedule \u003cservice\u003e \u003cschedule\u003e \u003cbucket-name\u003e [--use-iam]\n```\n\nflags:\n\n- `-u|--use-iam`: use the IAM profile associated with the current server\n\nSchedule a backup:\n\n\u003e 'schedule' is a crontab expression, eg. \"0 3 * * *\" for each day at 3am\n\n```shell\ndokku postgres:backup-schedule lollipop \"0 3 * * *\" my-s3-bucket\n```\n\nSchedule a backup and authenticate via iam:\n\n```shell\ndokku postgres:backup-schedule lollipop \"0 3 * * *\" my-s3-bucket --use-iam\n```\n\n### cat the contents of the configured backup cronfile for the service\n\n```shell\n# usage\ndokku postgres:backup-schedule-cat \u003cservice\u003e\n```\n\nCat the contents of the configured backup cronfile for the service:\n\n```shell\ndokku postgres:backup-schedule-cat lollipop\n```\n\n### unschedule the backup of the postgres service\n\n```shell\n# usage\ndokku postgres:backup-unschedule \u003cservice\u003e\n```\n\nRemove the scheduled backup from cron:\n\n```shell\ndokku postgres:backup-unschedule lollipop\n```\n\n### Disabling `docker image pull` calls\n\nIf you wish to disable the `docker image pull` calls that the plugin triggers, you may set the `POSTGRES_DISABLE_PULL` environment variable to `true`. Once disabled, you will need to pull the service image you wish to deploy as shown in the `stderr` output.\n\nPlease ensure the proper images are in place when `docker image pull` is disabled.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdokku%2Fdokku-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdokku%2Fdokku-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdokku%2Fdokku-postgres/lists"}