Skip to content

Migration to Solar System from Manual Install

Migration to Solar System from Manual Install

Previously, you might have installed Sunrise server manually without using Solar System Orchestrator. This guide will help you migrate to Solar System from your manual installation.

  • Docker: For running the server and other components.
  • Git: For cloning the repositories.
  1. Stop the Server: Ensure that Sunrise/Observatory/Sunshine containers are not running before making any changes. (Leave databases containers running.)

  2. Clone the Solar System repository: Clone the Solar System repository with submodules.

    Terminal window
    git clone --recursive https://github.com/SunriseCommunity/Solar-System.git
    cd Solar-System
  3. Copy the configuration files: Copy the configuration files from your manual installation to the Solar System repository.

    Terminal window
    cp .env.example .env
    cp Sunrise.Config.Production.json.example Sunrise.Config.Production.json
  4. Fill the configuration files: Fill the configuration files with your previous configuration values.

    For example, if you were using appsettings.Production.json file, you can copy the values from it to the Sunrise.Config.Production.json file.

    For the .env file, each value has a prefix of the component it belongs to. For example, SUNRISE_ prefix is for Sunrise, OBSERVATORY_ prefix is for Observatory, SUNSHINE_ prefix is for Sunshine.

Before we are going to initialize the new databases, we need to create a backups of all Sunrsie services databases.

If you didn’t create a backup of the Sunrise database already, you can do so by running the following command in-game to the server’s bot1 while having superuser privileges.

Terminal window
!backupdatabase

Now you can create a backup of the Observatory, to do so, follow the following steps:

Get the docker container ID of the database container by running the following command:

Terminal window
docker ps --no-trunc --format "{{.ID}} {{.Names}} {{.Ports}}"

And look for the database container, it should be named like observatory-postgres-1

Terminal window
1dce4dbf874e5840a71fc359369ee6ae61e5bd5b46e8baff66091821f1470009 observatory-postgres-1 0.0.0.0:5432->5432/tcp

Copy the first part of the container ID, in this case 1dce4dbf874e5840a71fc359369ee6ae61e5bd5b46e8baff66091821f1470009

Then run the following command to create a backup of the Observatory database:

$ docker exec -it <container_id> pg_dumpall -c -U <observatory_username> > dump_observatory_postgres.sql

After that, you should see a file named dump_observatory_postgres.sql in the current directory. Make sure it’s not empty or doesn’t contain any errors.

In comparison to other services, Sunshine database is stores as a single file in the data directory.

Make sure you located sunshine.db file in the data directory.

Before applying the backups, start the Solar System stack by running the following command:

Terminal window
./start.sh

After that, stop all the non-database containers as you did with the manual installation.

Find the backup snapshot you made earlier, it should be named like Backup_YYYYMMDDHHMMSS.zip and located in the Database/Backups directory.

Inside the backup snapshot, you will find a file named backup_mysql_YYYYMMDDHHMMSS.sql. This is the database backup file.

Get the docker container ID of the database container by running the following command:

Terminal window
docker ps --no-trunc --format "{{.ID}} {{.Names}} {{.Ports}}"

And look for the database container, it should be named like osu-sunrise-infrastructure-mysql-sunrise-db-1

Terminal window
de72eaebe131634413be592186f7b5bab3a2b8970ca521394b9a57e77aa9aaa5 osu-sunrise-infrastructure-mysql-sunrise-db-1 33060/tcp, 0.0.0.0:3306->3306/tcp

Copy the first part of the container ID, in this case de72eaebe131634413be592186f7b5bab3a2b8970ca521394b9a57e77aa9aaa5

Then run the following command to apply clear all tables before applying the backup:

$ docker exec -it <container_id> mysql -u <root username> --password=<root password> <database_name>
DROP DATABASE IF EXISTS <database_name>;
CREATE DATABASE <database_name>;

The output should be like this:

Terminal window
mysql> DROP DATABASE IF EXISTS sunrise;
Query OK, 19 rows affected (0.354 sec)
mysql> CREATE DATABASE sunrise;
Query OK, 1 row affected (0.009 sec)
mysql> exit
Bye

Then apply the backup by running the following command:

$ cat backup_mysql_YYYYMMDDHHMMSS.sql | docker exec -i <container_id> mysql -u <root username> --password=<root password> <database_name>

After that, don’t forget to move Data files from backup snapshot to the Data directory.

Find the backup snapshot you made earlier, it should be named dump_observatory_postgres.sql.

Get the docker container ID of the database container by running the following command:

Terminal window
docker ps --no-trunc --format "{{.ID}} {{.Names}} {{.Ports}}"

And look for the database container, it should be named like osu-sunrise-infrastructure-observatory-postgres-1

Terminal window
1dce4dbf874e5840a71fc359369ee6ae61e5bd5b46e8baff66091821f1470009 osu-sunrise-infrastructure-observatory-postgres-1 0.0.0.0:5432->5432/tcp

Copy the first part of the container ID, in this case 1dce4dbf874e5840a71fc359369ee6ae61e5bd5b46e8baff66091821f1470009

Then run the following commands to apply the backup (in order):

Terminal window
$ docker exec -i <container_id> psql -U <username> -d postgres -c "DROP DATABASE IF EXISTS <database_name>;"
$ docker exec -i <container_id> psql -U <username> -d postgres -c "CREATE DATABASE <database_name>;"
$ cat dump_observatory_postgres.sql | docker exec -i <container_id> psql -U <username> -d <database_name>

Find the backup snapshot you made earlier, it should be named sunshine.db.

Move it to the Sunshine/data directory in the root of the Solar System repository.

After you applied all the backups, you can start the server again.

Run the following command to start the server:

Terminal window
./start.sh

Please don’t forget to rebuild global leaderboards, by running !flushcache yes_i_understand_what_im_doing command to the server’s bot1 as a superuser.

Make sure all data was migrated correctly, by checking the Observatory and Sunrise logs. And of course you should see existing users and beatmaps while accesing the server.

If you didn’t see any errors while migrating, but still don’t see any data, wait a couple of minutes to make sure that the problem is not with the cached data.

  1. Server Bot is the always online bot account that is used to interact with the server. Similar to the Tillerino on Bancho. Please don’t confuse it with the BanchoBot. 2