mirror of
https://github.com/frappe/frappe_docker.git
synced 2026-06-17 13:55:08 +00:00
Merge pull request #1834 from nishanthabimanyu/fix/update-postgres-override
fix(overrides): update PostgreSQL to v15 and improve v16 compatibility
This commit is contained in:
commit
cb8b01658c
3 changed files with 58 additions and 13 deletions
|
|
@ -15,17 +15,12 @@ docker-compose exec backend bench new-site --mariadb-user-host-login-scope=% --d
|
|||
|
||||
If you need to install some app, specify `--install-app`. To see all options, just run `bench new-site --help`.
|
||||
|
||||
To create Postgres site (assuming you already use [Postgres compose override](../02-setup/05-overrides.md)) you need have to do set `root_login` and `root_password` in common config before that:
|
||||
To create a Postgres site (assuming you already use [Postgres compose override](../02-setup/05-overrides.md)), the `root_login` and `root_password` are now automatically set by the `configurator`. For major version upgrades, please refer to the [Postgres Migration Guide](../06-migration/03-postgres-major-version-upgrade.md).
|
||||
|
||||
To create a new Postgres site:
|
||||
|
||||
```sh
|
||||
docker-compose exec backend bench set-config -g root_login <root-login>
|
||||
docker-compose exec backend bench set-config -g root_password <root-password>
|
||||
```
|
||||
|
||||
Also command is slightly different:
|
||||
|
||||
```sh
|
||||
docker-compose exec backend bench new-site --mariadb-user-host-login-scope=% --db-type postgres --admin-password <admin-password> <site-name>
|
||||
docker-compose exec backend bench new-site --db-type postgres --admin-password <admin-password> <site-name>
|
||||
```
|
||||
|
||||
## Push backup to S3 storage
|
||||
|
|
|
|||
45
docs/06-migration/03-postgres-major-version-upgrade.md
Normal file
45
docs/06-migration/03-postgres-major-version-upgrade.md
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# PostgreSQL Major Version Upgrade (v13 to v15)
|
||||
|
||||
Upgrading PostgreSQL from version 13 to 15 is a major version jump. Since PostgreSQL does not support in-place data directory upgrades, existing users must manually migrate their data using `pg_dump`.
|
||||
|
||||
### **Migration Steps**
|
||||
|
||||
1. **Backup Existing Data (Version 13):**
|
||||
Before updating your compose file, ensure your containers are running and perform a dump of all databases.
|
||||
|
||||
```bash
|
||||
docker exec -it <project_name>-db-1 pg_dumpall -U postgres > full_dump.sql
|
||||
```
|
||||
|
||||
2. **Stop and Remove Containers:**
|
||||
|
||||
```bash
|
||||
docker compose down
|
||||
```
|
||||
|
||||
3. **Delete Old Data Volume:**
|
||||
PostgreSQL 15 cannot read data created by version 13. You must remove the existing volume (Warning: this deletes the old data directory).
|
||||
|
||||
```bash
|
||||
docker volume rm <project_name>_db-data
|
||||
```
|
||||
|
||||
4. **Update Image and Start (Version 15):**
|
||||
Update your `overrides/compose.postgres.yaml` (or pull the latest changes) and start the containers.
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
5. **Restore Data:**
|
||||
Restore the dump into the new PostgreSQL 15 instance.
|
||||
|
||||
```bash
|
||||
cat full_dump.sql | docker exec -i <project_name>-db-1 psql -U postgres
|
||||
```
|
||||
|
||||
6. **Verify and Clean Up:**
|
||||
Ensure your sites are working correctly with `bench migrate` and then remove the `full_dump.sql` file.
|
||||
```bash
|
||||
docker exec -it <project_name>-backend-1 bench --site all migrate
|
||||
```
|
||||
|
|
@ -2,15 +2,20 @@ services:
|
|||
configurator:
|
||||
environment:
|
||||
DB_HOST: db
|
||||
DB_PORT: 5432
|
||||
DB_PORT: "5432"
|
||||
depends_on:
|
||||
- db
|
||||
db:
|
||||
condition: service_healthy
|
||||
|
||||
db:
|
||||
image: postgres:13.5
|
||||
image: postgres:15.17
|
||||
command: []
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
interval: 5s
|
||||
retries: 5
|
||||
environment:
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD:?No db password set}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD:-123}
|
||||
volumes:
|
||||
- db-data:/var/lib/postgresql/data
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue