-
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
- Git clone server repo into a new folder
- Edit the docker-compose file:
version: '3.7'
services:
hashtopolis-server:
container_name: hashtopolis-server
build:
context: .
target: hashtopolis-server-prod
restart: always
volumes:
- <path to where you want to store your hashtopolis files>:/usr/local/share/hashtopolis:Z
environment:
HASHTOPOLIS_DB_USER: $MYSQL_USER
HASHTOPOLIS_DB_PASS: $MYSQL_PASSWORD
HASHTOPOLIS_DB_HOST: $HASHTOPOLIS_DB_HOST
HASHTOPOLIS_DB_DATABASE: $MYSQL_DATABASE
HASHTOPOLIS_ADMIN_USER: $HASHTOPOLIS_ADMIN_USER
HASHTOPOLIS_ADMIN_PASSWORD: $HASHTOPOLIS_ADMIN_PASSWORD
depends_on:
- db
ports:
- 8080:80
db:
container_name: db
image: mysql:5.7
restart: always
volumes:
- db:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASS
MYSQL_DATABASE: $MYSQL_DATABASE
MYSQL_USER: $MYSQL_USER
MYSQL_PASSWORD: $MYSQL_PASSWORD
hashtopolis-web-ui:
container_name: hashtopolis-web-ui
image: hashtopolis-web-ui:latest
restart: always
depends_on:
- hashtopolis-server
ports:
- 4200:4200
volumes:
db:
Copy env.example to .env
in the root of the cloned folder:
MYSQL_ROOT_PASS=<password for the root user of the database container
MYSQL_DATABASE=<database name to be used in hashtopolis>
MYSQL_USER=<database user used for hashtopolis)
MYSQL_PASSWORD=<password user for the database user>
HASHTOPOLIS_ADMIN_USER=admin
HASHTOPOLIS_ADMIN_PASSWORD=hashtopolis
HASHTOPOLIS_DB_HOST=db
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.