Hi there,
Took some time, but hereby my steps:
Migration Documentation
In this scenario I assume you are migrating an older version of Xibo from an old server to a new server (another location).
Also I assume that you are using docker compose on both locations. I have no experience with local installations.
Server A ----xibo migrate----> Server B
Steps
- Create a machine with enough diskspace, in my case 140gb.
- Install docker and docker compose.
- create the folder /opt/docker/xibo
this could be any folder you like. but remember that this will be the installation directory. - Create the following folderstructure within the folder you made in the previous step.
shared | - backup - cms | - library
- Download Xibo and Extract the contents. Run this within the folder you created in step 3.
wget -O xibo-docker.tar.gz https://xibo.org.uk/api/downloads/cms
tar --strip-components=1 -zxvf xibo-docker.tar.gz
- Create the config and set environment variables.
cp config.env.template config.env
vim config.env
change the mysql password to the same mysql password you are using on the old environment.
you can find the password in the config.env file on the old environment.
-
Edit the docker-compose.yml
Here you have to change the image version numbers to the exact version numbers you are using on the old environment. Do this for both the CMS and MySQL Containers/Images. -
Optional: To shrink the database you can clear the proof of play statistics. This speeds up the migration enormous.
Run the following commands. Also notice that maybe your DB containers name is different. So use the commands with your environment settings.
docker exec -ti xibo-cms-db-1 bash
mysql -u cms -h localhost -p cms
truncate `stat`;
optimize table `stat`;
exit
exit
- If you used step 7. You could wait a day for the automatic backup to take place or create a manual backup.
Manual backup can be made with:
docker exec xibo-cms-db-1 /usr/bin/mysqldump -uusername --password=yourpassword cms> import.sql
On the old server there should be a backup of the database that should be generated every day. shared\backup should be the location. You should migrate this backup to the new environment. Also notice that it is a gzip format so you will have to extract it. When extracted, rename the database to import.sql and move it to
shared\backup\
so that the exact location will be
shared/backup/import.sql
- Migrate the library folder to the new environment to the same location as where it is on the old environment. So this will be
shared\cms\library
.
It could help to compress the folder first so that a transfer should be fast.
compress with:
tar -zcvf myfolder.tar.gz myfolder
extract with:
tar -tf myfolder.tar.gz
-
If everything is in place you are ready to spin up the environment with
docker compose up -d
This could take a little time. You can monitor it by using HTOP (look at mysqld process). Also withdocker logs xibo-cms-web-1
you can check the container logs. It should say “importing database”. Just have patience. -
Now when everything is working you can perform the upgrade(s). As a reference I used: Xibo CMS 2.3.10 Released - #2 by alex
If you’re upgrading from an earlier version to 2.3.10, the version of MySQL bundled changes from 5.6 to 5.7 as 5.6 is now end of life.
docker compose down
docker run --rm -ti -v /opt/docker/xibo/shared/db:/var/lib/mysql mysql:5.7 bash
mysqld --skip-grant-tables &
mysql_upgrade (just type the command, you wont see a cursor)
exit
docker compose up -d
- Now when you done everything right mine advice is to first upgrade to 3.0.0 and after that just do an increment backup to newer version(s).
When upgrading do not interrupt the process, be patience and always make a backup before performing an upgrade.
When looking at docker logs you could see the following error:
We will upgrade it, take a backup
mysqldump: Error: ‘Access denied; you need (at least one of) the PROCESS privilege(s) for this operation’ when trying to dump tablespaces
Don’t panic, just wait! After a while you should see:
Running database migrations
Just wait, monitor docker logs and processes. Finally you should be able to access with webbrowser.
Hope this helps!
Some fixes
We found out that after an upgrade not all displays where showed/visible:
You should make an DB connection for that:
docker exec -ti xibo-cms-db-1 bash (name is db docker container)
mysql -u cms -h localhost -p cms
UPDATE `displaygroup` SET userId = (SELECT userId FROM `user` WHERE usertypeid = 1 LIMIT 1) WHERE userId NOT IN (SELECT userId FROM `user`);