https://github.com/isaced/postgres-backup-oss
A handy Docker container to periodically backup PostgreSQL to Alibaba Cloud Object Storage Service (OSS)
https://github.com/isaced/postgres-backup-oss
Last synced: 3 months ago
JSON representation
A handy Docker container to periodically backup PostgreSQL to Alibaba Cloud Object Storage Service (OSS)
- Host: GitHub
- URL: https://github.com/isaced/postgres-backup-oss
- Owner: isaced
- License: mit
- Created: 2024-11-06T03:09:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-12T09:21:08.000Z (about 1 year ago)
- Last Synced: 2025-07-03T23:34:15.489Z (about 1 year ago)
- Language: Shell
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-postgres-with-stars - postgres-backup-oss - 05-12 | (Backups)
README
# postgres-backup-oss
[](https://hub.docker.com/r/isaced/postgres-backup-oss)
English | [简体中文](README.zh-CN.md)
This project provides Docker images to periodically back up a PostgreSQL database to Alibaba Cloud Object Storage Service (OSS).
## Features
- Minimal image size (15MB)
- Low memory usage (less than 1MB in idle state)
- Support custom scheduling interval time (with cron format)
## Usage
Create a `docker-compose.yml` file with the following content:
```yaml
services:
postgres:
image: postgres:16
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: dbname
backup:
image: isaced/postgres-backup-oss:latest
depends_on:
- postgres
environment:
SCHEDULE: '0 0 * * *' # optional, default '0 0 * * *' (daily)
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432 # optional, default 5432
POSTGRES_DATABASE: dbname
POSTGRES_USER: user
POSTGRES_PASSWORD: password
OSS_BUCKET_NAME: ${OSS_BUCKET_NAME}
OSS_REGION: ${OSS_REGION}
OSS_ACCESS_KEY_ID: ${OSS_ACCESS_KEY_ID}
OSS_ACCESS_KEY_SECRET: ${OSS_ACCESS_KEY_SECRET}
```
Then run `docker-compose up -d` to start the backup service.
## OSS Configuration
You need to create an OSS bucket and an AccessKey pair in the [Alibaba Cloud console](https://home-intl.console.aliyun.com/). Then fill in the environment variables in the `docker-compose.yml` file.
About more OSS configuration, please refer to:[Configure ossutil - Environment variables](https://www.alibabacloud.com/help/en/oss/developer-reference/configure-ossutil2#8d24444ae2hnb), just add to environment to take effect.