We have stopped offering self hosted version. Hence this article is not usable unless you already had purchased a spotipo license. Please checkout our cloud offering instead.

Create a backup of database

Spotipo uses MySQL as the DB server to store all its data in a database named spotipo.

mysqldump -uroot -p spotipo > spotipo.sqlCreate a backup of files

Backup following directories as well

/usr/share/nginx/spotipo/instance
/usr/share/nginx/spotipo/unifispot/static/uploads
/usr/share/nginx/spotipo/unifispot/templates/guest





You can also use the below script which will let you make a full backup in linux.

#!/bin/bash CONFFILE=/usr/share/nginx/spotipo/instance/config.py USERNAME=$(grep "SQLALCHEMY" $CONFFILE | sed -r 's/SQLALCHEMY_DATABASE_URI="mysql:\/\/(.+):(.+)@.+\/(.+)"/\1/' ) PASSWORD=$(grep "SQLALCHEMY" $CONFFILE | sed -r 's/SQLALCHEMY_DATABASE_URI="mysql:\/\/(.+):(.+)@.+\/(.+)"/\2/' ) DBNAME=$(grep "SQLALCHEMY" $CONFFILE | sed -r 's/SQLALCHEMY_DATABASE_URI="mysql:\/\/(.+):(.+)@.+\/(.+)"/\3/' ) now=$(date +"%m%d%Y") mysqldump -u$USERNAME -p$PASSWORD $DBNAME > spotipo_$now.sql tar -czvf uploads_$now.tar.gz /usr/share/nginx/spotipo/unifispot/static/uploads/ tar -czvf instance_$now.tar.gz /usr/share/nginx/spotipo/instance/ tar -czvf guesttemplates_$now.tar.gz /usr/share/nginx/spotipo/unifispot/templates/guest


Restoring from a backup

First step is to intstall a fresh copy of Spotipo on the new server. Make sure to install the same version of spotipo from which backup was created

`

Copy the contents of uploads folder into
/usr/share/nginx/spotipo/unifispot/static/uploads

Copy the contents of guest templates into /usr/share/nginx/spotipo/unifispot/templates/guest

Copy the contents of instance folder into /usr/share/nginx/spotipo/instance

Now restore the database using below command

mysql -u root -p SPOTIPODBNAME < spotipo.sql



After restoring the database, you should reinitialise migrations. Use below commands for the same.

mysql -u root -p -e "DROP TABLE spotipo.alembic_version;"

cd /usr/share/nginx/spotipo
rm -rf migrations
source .env/bin/activate
python manage.py db init
python manage.py db migrate
python manage.py db upgrade

Restart the application

sudo service supervisor restart


Did this answer your question?