2024-08-03 00:49:14 +02:00
|
|
|
---
|
|
|
|
|
title: Restore database
|
|
|
|
|
layout: default
|
|
|
|
|
parent: How Tos
|
2024-09-30 00:00:21 +02:00
|
|
|
nav_order: 5
|
2024-08-03 00:49:14 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Restore database
|
|
|
|
|
|
2024-08-10 09:39:50 +02:00
|
|
|
To restore the database, you need to add `restore` command and specify the file to restore by adding `--file store_20231219_022941.sql.gz`.
|
2024-08-03 00:49:14 +02:00
|
|
|
|
|
|
|
|
{: .note }
|
2024-10-12 11:14:40 +02:00
|
|
|
It supports __.sql__,__.sql.gpg__ and __.sql.gz__,__.sql.gz.gpg__ compressed file.
|
2024-08-03 00:49:14 +02:00
|
|
|
|
|
|
|
|
### Restore
|
|
|
|
|
|
|
|
|
|
```yml
|
|
|
|
|
services:
|
|
|
|
|
pg-bkup:
|
|
|
|
|
# In production, it is advised to lock your image tag to a proper
|
|
|
|
|
# release version instead of using `latest`.
|
|
|
|
|
# Check https://github.com/jkaninda/pg-bkup/releases
|
|
|
|
|
# for a list of available releases.
|
|
|
|
|
image: jkaninda/pg-bkup
|
|
|
|
|
container_name: pg-bkup
|
2024-08-10 09:39:50 +02:00
|
|
|
command: restore -d database -f store_20231219_022941.sql.gz
|
2024-08-03 00:49:14 +02:00
|
|
|
volumes:
|
|
|
|
|
- ./backup:/backup
|
|
|
|
|
environment:
|
|
|
|
|
- DB_PORT=5432
|
|
|
|
|
- DB_HOST=postgres
|
|
|
|
|
- DB_NAME=database
|
|
|
|
|
- DB_USERNAME=username
|
|
|
|
|
- DB_PASSWORD=password
|
|
|
|
|
# pg-bkup container must be connected to the same network with your database
|
|
|
|
|
networks:
|
|
|
|
|
- web
|
|
|
|
|
networks:
|
|
|
|
|
web:
|
|
|
|
|
```
|