{"id":18336217,"url":"https://github.com/openremote/postgresql","last_synced_at":"2026-01-22T17:24:26.997Z","repository":{"id":71631943,"uuid":"348408404","full_name":"openremote/postgresql","owner":"openremote","description":"PostgreSQL docker image with openremote env variables and post GIS","archived":false,"fork":false,"pushed_at":"2024-03-19T14:08:04.000Z","size":66,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-21T17:12:35.918Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openremote.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2021-03-16T15:59:14.000Z","updated_at":"2024-04-05T19:54:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"9ef02f8d-b68d-4893-a3b8-89a9620eb99b","html_url":"https://github.com/openremote/postgresql","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openremote%2Fpostgresql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openremote%2Fpostgresql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openremote%2Fpostgresql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openremote%2Fpostgresql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openremote","download_url":"https://codeload.github.com/openremote/postgresql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247435041,"owners_count":20938530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-05T20:06:53.240Z","updated_at":"2026-01-22T17:24:26.989Z","avatar_url":"https://github.com/openremote.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Postgresql docker image\n[![build multiarch postgresql Docker image and push to dockerhub](https://github.com/openremote/postgresql/actions/workflows/postgresql.yml/badge.svg)](https://github.com/openremote/postgresql/actions/workflows/postgresql.yml)\n\nPOSTGIS and TimescaleDB (inc. toolkit for hyperfunctions) image built for amd64 and arm64 using `timescale/timescaledb-ha` base image with:\n\n- OR specific ENV variables and a healthcheck added\n- Easy configuration of `max_connections` using `POSTGRES_MAX_CONNECTIONS` environment variable (set to `-1` to disable this setting)\n- PGDATA path set to match old Alpine image (for ease of DB migration)\n- POSTGRES user UID and GID changed to match old Alpine image (for ease of DB migration)\n- Auto upgrade of database with PG major version changes from previous PG major version; can be disabled using\n  `OR_DISABLE_AUTO_UPGRADE=true`\n- Auto upgrade of timescaleDB extension when a new version is available in the container; can be disabled using\n  `OR_DISABLE_AUTO_UPGRADE=true`\n- OR_DISABLE_REINDEX env variable with associated scripts to determine if a REINDEX of the entire DB should be carried\n  out at first startup with existing DB (checks whether or not `$PGDATA/OR_REINDEX_COUNTER.$OR_REINDEX_COUNTER` exists).\n  This is used when a collation change has occurred (glibc version change, muslc \u003c-\u003e glibc) which can break the indexes;\n  migration can either be manually handled or auto handled depending on OR_DISABLE_REINDEX env variable value.\n  NOTE THAT A REINDEX CAN TAKE A LONG TIME DEPENDING ON THE SIZE OF THE DB! And startup will be delayed until completed.\n  This functionality is intended to simplify migration for basic users; advanced users with large DBs should take care of this\n  themselves.\n- **Slimmed images** using [slim toolkit](https://github.com/slimtoolkit/slim) to reduce image size by ~60%\n\n## Local Development\n\n### Prerequisites\n\n- **Docker** must be installed and running\n- **slim toolkit** must be installed for image optimization\n\nInstall slim toolkit via the install script:\n```bash\ncurl -sL https://raw.githubusercontent.com/slimtoolkit/slim/master/scripts/install-slim.sh | sudo -E bash -\n```\n\nOr via Homebrew (macOS):\n```bash\nbrew install docker-slim\n```\n\nFor more installation options, see the [slim toolkit documentation](https://github.com/slimtoolkit/slim#installation).\n\n### Building the Image\n\n1. Build the Docker image (replace `17` with desired PostgreSQL major version):\n```bash\ndocker build --build-arg PG_MAJOR=17 -t openremote/postgresql:pg17 .\n```\n\n2. Slim the image using the provided script:\n```bash\n# Usage: ./slim-image.sh \u003csource-image\u003e \u003ctarget-image\u003e \u003carchitecture\u003e\n# Architecture: amd64 or arm64 (auto-detected if omitted)\n\n./slim-image.sh openremote/postgresql:pg17 openremote/postgresql:pg17-slim\n```\n\n3. Optionally replace the original with the slimmed version:\n```bash\ndocker tag openremote/postgresql:pg17-slim openremote/postgresql:pg17\n```\n\n## Upgrading\n\n***NOTE: If you change the version of container you use then make sure you have backed up your DB first as this container will try to auto upgrade your DB and/or TimescaleDB extension; this auto upgrade functionality can be disabled using `OR_DISABLE_AUTO_UPGRADE=true`***\n\n### Automatic Upgrade\n\nThis image supports automatic upgrades from the previous PostgreSQL major version. When the container starts with an existing database from a supported older version, it will:\n\n1. Upgrade TimescaleDB extensions on the old PostgreSQL version\n2. Run `pg_upgrade` to migrate the database to the new PostgreSQL version\n3. Upgrade TimescaleDB extensions on the new PostgreSQL version\n\n### Manual Upgrade\n\nIf automatic upgrade is not supported for your database version (e.g., skipping multiple major versions), you will need to perform a manual upgrade. Follow these steps:\n\n1. **Backup your database** using `pg_dump` or `pg_dumpall`\n2. **Upgrade TimescaleDB first** (if installed) - this must be done before PostgreSQL upgrade\n3. **Use pg_upgrade** to migrate between PostgreSQL versions, or restore from backup to a fresh database\n\n#### Useful Resources\n\n- [PostgreSQL pg_upgrade documentation](https://www.postgresql.org/docs/current/pgupgrade.html)\n- [TimescaleDB upgrade guide](https://docs.timescale.com/self-hosted/latest/upgrades/)\n- [TimescaleDB major upgrade guide](https://docs.timescale.com/self-hosted/latest/upgrades/major-upgrade/)\n\n#### Example: Manual pg_dump/restore\n\n```bash\n# On the old container, dump the database\ndocker exec -it \u003cold_container\u003e pg_dumpall -U postgres \u003e backup.sql\n\n# Start the new container with a fresh data directory\ndocker run -d --name new_postgres -v /path/to/new/data:/var/lib/postgresql/data openremote/postgresql:latest\n\n# Restore the backup\ndocker exec -i new_postgres psql -U postgres \u003c backup.sql\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenremote%2Fpostgresql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenremote%2Fpostgresql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenremote%2Fpostgresql/lists"}