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.
sudo -u libretime libretime-api dbshell < libretime.sql
Any thoughts are most welcome
Thank you
Any one have any advice on how to migrate from a server to a docker instance?
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.
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
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
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.
1 Like
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
So this would be the recommended way to manage LT’s docker instances? to upgrade them for example?
thanks for your tips!