-
Notifications
You must be signed in to change notification settings - Fork 225
Migration Update
With version 0.10.0 an automatic upgrade procedure was introduced. There are two ways of upgrading:
- If you have the source on the web server still running as a git repository, you can simply retrieve the updates with git pull (or checkout if you need to switch a branch).
- If you used the bundled zip to deploy Hashtopolis, you can just download the newer bundled version and copy all the files to the existing directory. As there are not any changes during the installation to files which are in the bundle (e.g. conf.php), you can simply overwrite all the existing source files.
After updating the source you can simply load the normal Hashtopolis page and it will automatically determine which upgrades on the database need to be executed and will notify you about the upgrade.
NOTE:
- If you didn't use either a direct git repository which is still intact or the bundled version, you have to run the upgrade scripts still manually as it was for older versions.
- During the upgrade, it is recommended to stop all agents completely, to avoid any request being made to the server. Otherwise one of these requests may trigger the update already and in case of errors, it will not be visible to the user.
Starting from version 0.2.0-beta we provide upgrade scripts (located in the install/updates/ folder) so later you can easily upgrade your Hashtopolis installation by just pulling updates from the repository and then run the provided upgrade scripts to apply changes in the DB structure or content.
Important: You need to run all update scripts starting from the old version number up to the newest version which you checked out.
There are multiple ways to migrate the data from your non-docker setup to docker. You can of course completely start fresh; but if you want to migrate your data there are multiple ways to do this.
You can reuse your old database server or also migrate the database to a docker container.
- Install docker to your system (https://docs.docker.com/engine/install/ubuntu/)
- Create a database backup
mysqldump <database-name> > hashtopolis-backup.sql
- Make copies of the following folders, can be found in the hashtopolis folder along side the index.php:
- files
- import
- log
- Download the docker compose file:
wget https://raw.githubusercontent.com/hashtopolis/server/master/docker-compose.yml
- Edit the docker compose file
...
hashtopolis-server:
...
volumes:
- <path to where you want to store your hashtopolis files>:/usr/local/share/hashtopolis:Z
db:
...
volumes:
- <path to where you want to store the database volume>:/var/lib/mysql
...
wget https://raw.githubusercontent.com/hashtopolis/server/master/env.example -O .env
- Edit the .env file and change the settings to your likings nano .env
- Optional: if you want to test the new API and new UI, set the HASHTOPOLIS_APIV2_ENABLE to 1 inside the .env file. NOTE: The APIv2 and UIv2 are a technical preview. Currently when enable everyone through the new API will be fully admin!
- The HASHTOPOLIS_ADMIN_USER is only used during setup time and once you import the database backup will be replaced with your old data.
- Copy the files, import, and log to the new location you refered to in the docker-compose file.
- In the same folder create a
config
folder:mkdir config
- Start the docker container
docker compose up
- To migrate the data, first copy the database backup towards the server:
docker cp hashtopolis-backup.sql hashtopolis-server:/var/www/html
- Login on the container:
docker exec -it hashtopolis-server /bin/bash
- Import the data:
mysql -u root -d db -Dhashtopolis -p < hashtopolis-backup.sql
- If you get errors like
Unknown collation: ‘utf8mb4_0900_ai_ci’
run the following two commands:sed -i 's/utf8mb4_0900_ai_ci/utf8_general_ci/g' hashtopolis-server.sql
&&sed -i 's/CHARSET=utf8mb4/CHARSET=utf8/g' hashtopolis-backup.sql
- Exit the container
- Copy the content of the PEPPER from the
inc/conf.php file and place them into
config/config.json`
Example conf.php:
...
$PEPPER = [..., ..., ..., ...];
...
Becomes config/config.json
:
{
"PEPPER": [..., ..., ..., ...],
}
- Repeat all the steps above, but you don't need to export/import the database. Only make sure that you point the settings inside the
.env
file to your database server and that the database server is reachable from your container.