-
Notifications
You must be signed in to change notification settings - Fork 222
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
...
- Download the env file
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.
- Create the folder which to referred to in the docker-compose, in our example we will use
/usr/local/share/hashtopolis
sudo mkdir -p /usr/local/share/hashtopolis
- Copy the files, import, and log to the new location you refered to in the docker-compose file.
sudo cp -r files/ import/ log/ /usr/local/share/hashtopolis
- In the same folder create a
config
folder:mkdir /usr/local/share/hashtopolis/config
- Start the docker container
docker compose up
- Stop the backend container so that agents don't mess up the database mid migration
docker stop hashtopolis-backend
- To migrate the data, first copy the database backup towards the db container:
docker cp hashtopolis-backup.sql db:.
- Login on the container:
docker exec -it db /bin/bash
- Import the data:
mysql -Dhashtopolis -p < 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 /var/www/hashtopolis/inc/conf.php:
...
$PEPPER = [..., ..., ..., ...];
...
Becomes /usr/local/share/hashtopolis/config/config.json
:
{
"PEPPER": [..., ..., ..., ...],
}
- Restart the compose
docker compose down
&&docker compose up
- 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.
- Stop your docker compose
docker compose down
docker compose pull
docker compose up