# Import postgre dump sql text to Libretime docker

**URL:** <https://discourse.libretime.org/t/import-postgre-dump-sql-text-to-libretime-docker/1580>\
**Category:** Uncategorized\
**Created:** [October 2, 2023, 7:03pm UTC](https://discourse.libretime.org/t/import-postgre-dump-sql-text-to-libretime-docker/1580 "2023-10-02T19:03:21Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![chlowden](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@chlowden](https://discourse.libretime.org/u/chlowden)\
**Post date:** [October 2, 2023, 7:03pm UTC](https://discourse.libretime.org/t/import-postgre-dump-sql-text-to-libretime-docker/1580/1 "2023-10-02T19:03:21Z")

</div>

Hello  
I am trying to replace a postgre dump sql text file from an old server over a newly installed libretime instance on a docker.  
I suppose that I am looking a docker equivalent of the command below.

```auto
sudo -u libretime libretime-api dbshell < libretime.sql

```

Any thoughts are most welcome  
Thank you

---

<div class="post-metadata">

**Author:** ![chlowden](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@chlowden](https://discourse.libretime.org/u/chlowden)\
**Post date:** [October 3, 2023, 3:40pm UTC](https://discourse.libretime.org/t/import-postgre-dump-sql-text-to-libretime-docker/1580/2 "2023-10-03T15:40:46Z")

</div>

I have installed the Libretime docker, using the method below.

[https://libretime.org/docs/admin-manual/install/install-using-docker/](https://libretime.org/docs/admin-manual/install/install-using-docker/)

---

<div class="post-metadata">

**Author:** ![chlowden](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@chlowden](https://discourse.libretime.org/u/chlowden)\
**Post date:** [October 4, 2023, 6:30am UTC](https://discourse.libretime.org/t/import-postgre-dump-sql-text-to-libretime-docker/1580/3 "2023-10-04T06:30:41Z")

</div>

Any one have any advice on how to migrate from a server to a docker instance?

---

<div class="post-metadata">

**Author:** ![cderuiter](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/cderuiter/32/725_2.png) [@cderuiter](https://discourse.libretime.org/u/cderuiter)\
**Post date:** [October 4, 2023, 11:18am UTC](https://discourse.libretime.org/t/import-postgre-dump-sql-text-to-libretime-docker/1580/4 "2023-10-04T11:18:52Z")

</div>

some important things i’ve done to migrate to a docker instance:  
Backup the /srv/blah/blah directory, backup the postgress data.  
Secure the SSL certificates.  
Modify the docker-compose.yml to access the following

- srv data
- icecast.xml
- the html files (if modified)
- Postgress data
- Certificate files
- config.yml

from outside the container.  
This way you do not have to re-build anything inside the containers in case of a certificate expiration, a software update. or anything like that.

the changes then look like (all snippets, not the complete file)  
  
postgres:  
image: postgres:15  
container\_name: libretime-postgres  
volumes:  
- ./postgresql:/var/lib/postgresql/data  
environment:  
POSTGRES\_USER: $xxxxxxxxxxxxxxxx  
POSTGRES\_PASSWORD: $xxxxxxxxxxxxxxxxxxxx  
healthcheck:  
test: pg\_isready -U libretime

 playout:

```
image: ghcr.io/libretime/libretime-playout:${LIBRETIME_VERSION:-latest}
container_name: libretime-playout
depends_on:
  - rabbitmq
volumes:
  - ${LIBRETIME_CONFIG_FILEPATH:-./config.yml}:/etc/libretime/config.yml:ro
  - libretime_playout:/app
environment:
  LIBRETIME_GENERAL_PUBLIC_URL: http://nginx

```

 liquidsoap:

```
image: ghcr.io/libretime/libretime-playout:${LIBRETIME_VERSION:-latest}
container_name: libretime-liquidsoap
command: /usr/local/bin/libretime-liquidsoap
ports:
  - xxxxx:xxxx
  - xxxxx:xxxxxxx
depends_on:
  - rabbitmq
volumes:
  - ${LIBRETIME_CONFIG_FILEPATH:-./config.yml}:/etc/libretime/config.yml:ro
  - libretime_playout:/app

```

 analyzer:

```
depends_on:
  - rabbitmq
volumes:
  - ${LIBRETIME_CONFIG_FILEPATH:-./config.yml}:/etc/libretime/config.yml:ro
  - /srv/libretime:/srv/libretime

```

 worker:

```
ima
volumes:
  - ${LIBRETIME_CONFIG_FILEPATH:-./config.yml}:/etc/libretime/config.yml:ro
environment:
  LIBRETIME_GENERAL_PUBLIC_URL: http://nginx</SNIP>

```

 legacy:

```
volumes:
  - ${LIBRETIME_CONFIG_FILEPATH:-./config.yml}:/etc/libretime/config.yml:ro
  - ./html:/var/www/html
  - /srv/libretime:/srv/libretime

```

 nginx:

```
ports:
        - xxxxxxxxxxxxxx:80:80
        - xxxxxxxxxxxxxxxx:443:443
depends_on:
  - legacy
volumes:
  - ./html:/var/www/html:ro
  - ${NGINX_CONFIG_FILEPATH:-./nginx.conf}:/etc/nginx/conf.d/default.conf:ro

```

 icecast:

```
volumes:

  - ${LIBRETIME_CONFIG_FILEPATH:-./icecast.xml}:/etc/icecast.xml:ro

  - ./xxxxxxxxxxxxxt.crt:/etc/ssl/certs/xxxxxxxxxxxxxxxxx.crt:ro

```

I hope I provided you enough info to get going.

Chris.

---

<div class="post-metadata">

**Author:** ![chlowden](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@chlowden](https://discourse.libretime.org/u/chlowden)\
**Post date:** [October 6, 2023, 4:37pm UTC](https://discourse.libretime.org/t/import-postgre-dump-sql-text-to-libretime-docker/1580/5 "2023-10-06T16:37:46Z")

</div>

Thank you for your reply.

Not knowing anything about yml, maybe you can clarify some details for me .  
Firstly, What part of your config line defines that the data is outside of the docker?  
Your docker config file is remarkably similar to mine, do I am looking for the difference.  
Secondly, my first goal was to use a migration command to install the libretime.sql file. When I look at your config, I presume that the /var/lib/postgresql/data is outside of the docker, which is what I would prefer the data to be.  
Did you copy the postgreql folder from the old machine to the new one with the same path or did you manage to migrate as per the libretime website method?  
Many thanks

---

<div class="post-metadata">

**Author:** ![matias-tecnosoul](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/matias-tecnosoul/32/341_2.png) [@matias-tecnosoul](https://discourse.libretime.org/u/matias-tecnosoul)\
**Post date:** [October 10, 2023, 1:22am UTC](https://discourse.libretime.org/t/import-postgre-dump-sql-text-to-libretime-docker/1580/6 "2023-10-10T01:22:59Z")

</div>

Hi, I share my notes about restoring a Libretime backup into a docker instance.  
(raw notes, use with care 🙂 ).

**find docker volume where to copy the backups.**

docker inspect -f ‘{{ json .Mounts }}’ \<container\_id\> | python3 -m json.tool

**Look at the volume paths under the key Destination.**  
[  
{  
“Type”: “volume”,  
“Name”: “libretime-docker\_postgres\_data”,  
“Source”: “/mnt/ltdocker/volumes/libretime-docker\_postgres\_data/\_data”,  
“Destination”: “/var/lib/postgresql/data”,  
“Driver”: “local”,  
“Mode”: “rw”,  
“RW”: true,  
“Propagation”: “”  
}

**Copy dump into volumes**  
docker cp /bak-lt/libretime-backup.dump libretime-docker-postgres-1:/var/lib/postgresql/data

**Copy backup tracks**  
docker cp /bak-lt/libretime/ libretime-docker\_analyzer\_1:/srv/libretime

**Recreate DB**  
docker exec -it libretime-docker-postgres-1 pg\_restore -U libretime --verbose -C -d libretime /var/lib/postgresql/data//libretime-backup.dump

---

<div class="post-metadata">

**Author:** ![chlowden](https://avatars.discourse-cdn.com/v4/letter/c/c2a13f/32.png) [@chlowden](https://discourse.libretime.org/u/chlowden)\
**Post date:** [October 16, 2023, 7:28pm UTC](https://discourse.libretime.org/t/import-postgre-dump-sql-text-to-libretime-docker/1580/7 "2023-10-16T19:28:17Z")

</div>

Mathias  
Thank you so much for this.  
All that you have written should probably to made into a docker troubleshooting doc for the Libretime site.

---

<div class="post-metadata">

**Author:** ![cderuiter](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/cderuiter/32/725_2.png) [@cderuiter](https://discourse.libretime.org/u/cderuiter)\
**Post date:** [October 27, 2023, 7:32pm UTC](https://discourse.libretime.org/t/import-postgre-dump-sql-text-to-libretime-docker/1580/8 "2023-10-27T19:32:21Z")

</div>

I did not a backup and restore of the db.  
I have outside of the containers the following;

- Audio Files
- Icecast.xml
- SSL files
- Config.yml
- nginx.conf

---

<div class="post-metadata">

**Author:** ![matias-tecnosoul](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/matias-tecnosoul/32/341_2.png) [@matias-tecnosoul](https://discourse.libretime.org/u/matias-tecnosoul)\
**Post date:** [December 6, 2023, 9:40pm UTC](https://discourse.libretime.org/t/import-postgre-dump-sql-text-to-libretime-docker/1580/9 "2023-12-06T21:40:42Z")

</div>

So this would be the recommended way to manage LT’s docker instances? to upgrade them for example?  
thanks for your tips!
