Toyhouse Migration

From PKC
Jump to navigation Jump to search

Migration toyhouse.wiki

Installation Inspection

On source server, below are the fact that is found. Installation is using docker container, we can check with docker ps command, and below are the output

docker ps

Output from docker ps command

As we can inspect, there are fourteen containers that are running on the source server. It is possible that not all of the containers is functional. Since there are no yml file that is directly related to bring the whole configuration up, decided to reverse engineer the installation by exporting the container, copy them to new server and proceed the installation on new server. Instead of building the container from scratch, which are the normal procedure of deploying new server.

Then, next step is to find mounted directory which use by the container on the host machine, we can use below command to display the configuration of each container

docker inspect [container-name]

and, to inspect the mediawiki container installation, type below command

docker inspect mediawiki

which, we can see portion of the output below

"HostConfig": {
  "Binds": [
  "/data/xlpsystem/mediawiki_dev:/xlp_dev:rw",
  "/data/xlpsystem/mediawiki:/xlp_data:rw"
 ],

after performing similar command for all the container, we can conclude that the mounter folder at host machine is at /data/xlpsystem/

Outline Planning

  1. Export all docker container from source server using docker command
  2. Copy the mounted folder
  3. Transfer all file to target server
  4. Prepare the target server
  5. Re-Create the docker-run command
  6. Bring docker container up
  7. Solve all issues

Below are the process of above plan, and all of the issues, and how to solve them.

Exporting all the containers

Transfer all file to target server

Prepare the target server

Mariadb Container

Mediawiki Container

Matomo Container

Once the container is up, the matomo screen displayed error message of :

The directory "/var/www/html/tmp/cache/tracker/" does not exist and could not be created

At this point, we understand that the problem might be related to user's authorization on host's directory. Try to look which user is use to accessed the folder, from the container. How to check is by going inside the container, see which user is used to execute the service inside the container. One point that we need to understand, is that the user inside the container and user at the host folder will be sharing similar user id. Below is the "ps aux" command from inside the container.

...
www-data    22  0.0  0.6 427860 25612 ?        S    08:30   0:00 apache2 -DFOREGROUND
www-data    23  0.0  0.8 503900 35304 ?        S    08:30   0:00 apache2 -DFOREGROUND
www-data    24  0.0  0.7 427768 28672 ?        S    08:30   0:00 apache2 -DFOREGROUND
www-data    25  0.0  0.6 427760 26484 ?        S    08:30   0:00 apache2 -DFOREGROUND
www-data    26  0.0  0.2 425396 11164 ?        S    08:30   0:00 apache2 -DFOREGROUND
...

And, we check the user id of www-data account, at the host file, if we cant found one, then we need to create one using similar user-id.

www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin

and, it is clear that matomo's container are using user-id 33, of www-data to execute the service. After inspection on host file, found similar userid, which is www-data using userid of 33, then we need to change the owner of the mounted folder to www-data.

chmod -R www-data:www-data /data/xlpsystem/matomo

After the change of folder owner is executed, the error message is moving forward to below message

Warning: You are now accessing Matomo from http://pkc-dev.org:82/index.php, but Matomo has been configured to run at this address: http://toyhouse.wiki:82/index.php.

To fix the error, we need to adjust matomo's configuration file at config.ini.php, at the [General] section, as shown below.

[General]
trusted_hosts[] = "pkc-dev.org:82"

Execution

References