|
|
|
Some times we need a db dump to attach it to a support ticket to help the OC team.
|
|
|
|
|
|
|
|
The next steps are used to extract a dump of the `opencell` db:
|
|
|
|
|
|
|
|
1. Access to the server:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ ssh opencell-test.coopdevs.org
|
|
|
|
```
|
|
|
|
|
|
|
|
2. Change to the `opencell` user:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ sudo su - opencell
|
|
|
|
```
|
|
|
|
|
|
|
|
3. Access to the db container:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ docker exec -ti postgres bash
|
|
|
|
```
|
|
|
|
|
|
|
|
4. Create the dump:
|
|
|
|
|
|
|
|
```
|
|
|
|
# pg_dump -U opencell -W -f opencell.19.08.07.dump opencell
|
|
|
|
```
|
|
|
|
|
|
|
|
5. Exit and copy the dump out of the container:
|
|
|
|
|
|
|
|
```
|
|
|
|
# exit
|
|
|
|
exit
|
|
|
|
$ docker cp postgres:/opencell.19.08.07.dump .
|
|
|
|
```
|
|
|
|
|
|
|
|
6. Move the dump to your user home and change the permissions:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ exit
|
|
|
|
logout
|
|
|
|
daniel@opencell-test:~$ sudo chown daniel:daniel /home/opencell/opencell.19.08.07.dump
|
|
|
|
daniel@opencell-test:~$ sudo mv /home/opencell/opencell.19.08.07.dump .
|
|
|
|
```
|
|
|
|
|
|
|
|
6. Copy the dump form the server to your machine:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ logout
|
|
|
|
Connection to opencell-test.coopdevs.org closed.
|
|
|
|
|
|
|
|
$ scp opencell-test.coopdevs.org:opencell.19.08.07.dump .
|
|
|
|
opencell.19.08.07.dump 100% 1027KB 2.5MB/s 00:00
|
|
|
|
``` |