Skip to content

Migration Update

Romke van Dijk edited this page Sep 4, 2023 · 19 revisions

Upgrading Hashtopolis

Upgrading from 0.10.0 or newer

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.

Upgrading from 0.9.0 or older

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.

Upgrading to 0.14.0 (from non-Docker to Docker)

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.

New database

You can reuse your old database server or also migrate the database to a docker container.

  1. Install docker to your system (https://docs.docker.com/engine/install/ubuntu/)
  2. Create a database backup mysqldump <database-name> > hashtopolis-backup.sql
  3. Make copies of the following folders, can be found in the hashtopolis folder along side the index.php:
  • files
  • import
  • log
  1. Download the docker compose file: wget https://raw.githubusercontent.com/hashtopolis/server/master/docker-compose.yml
  2. Edit the docker compose file
...
  hashtopolis-server:
...
    volumes:
      - <path to where you want to store your hashtopolis files>:/usr/local/share/hashtopolis:Z
...
  1. Download the env file wget https://raw.githubusercontent.com/hashtopolis/server/master/env.example -O .env
  2. 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.
  3. 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
  4. 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
  5. In the same folder create a config folder: mkdir /usr/local/share/hashtopolis/config
  6. Start the docker container docker compose up
  7. Stop the backend container so that agents don't mess up the database mid migration docker stop hashtopolis-backend
  8. To migrate the data, first copy the database backup towards the db container: docker cp hashtopolis-backup.sql db:.
  9. Login on the container: docker exec -it db /bin/bash
  10. Import the data: mysql -Dhashtopolis -p < hashtopolis-backup.sql
  11. Exit the container
  12. 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": [..., ..., ..., ...],
}
  1. Restart the compose docker compose down && docker compose up

Existing database

  1. 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.

Upgrading from docker to docker (version 0.14.0 and up)

  1. Stop your docker compose docker compose down
  2. docker compose pull
  3. docker compose up