Skip to content

Migration operating mode

kumy edited this page Oct 6, 2017 · 13 revisions

Migration procedure

Install

Create directory tree

GEOKRETY-LEGACY-REC/
├── configs/
└── vars/
    ├── generated/
    ├── logs/
    ├── mapka/
    ├── mapki/
    |   ├─ csv/
    |   ├─ gpx/
    |   ├─ map/
    ├── obrazki/
    ├── obrazki-dowonu/
    ├── obrazki-male/
    ├── rzeczy/
    |   ├─ xml/
    ├── statpics/
    |   ├─ wzory/
    └── templates/
        ├─ cache/
        ├─ compile/
        ├─ htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer/HTML/
        ├─ wykresy/


mkdir -p generated/
mkdir -p logs/
mkdir -p mapka/
mkdir -p mapki/csv/
mkdir -p mapki/gpx/
mkdir -p mapki/map/
mkdir -p obrazki/
mkdir -p obrazki-dowonu/
mkdir -p obrazki-male/
mkdir -p rzeczy/xml/
mkdir -p statpics/wzory/
mkdir -p templates/cache/
mkdir -p templates/compile/
mkdir -p templates/htmlpurifier/library/HTMLPurifier/DefinitionCache/Serializer/HTML/
mkdir -p templates/wykresy/

Checkout code into src

cd GEOKRETY-LEGACY-REC/
git clone [email protected]:geokrety/www.git src
git clone [email protected]:geokrety/geokrety-scripts.git geokrety-scripts

Create files missing from the git tree

cd GEOKRETY-LEGACY-REC/src
touch templates/konfig-local.php
touch templates/konfig-mysql.php

Configure

Edit files and adapt.

cd GEOKRETY-LEGACY-REC/src
touch templates/konfig-local.php
touch templates/konfig-mysql.php

Synchronize pictures (iter 1)

TODO #1 insert script name here

Permissions

All files inside ./vars must be writable by the webserver. In the current image, www-data has id 33. So set owner as 33 or make directories writable for everyone.

chown -R 33.33 GEOKRETY-LEGACY-REC/vars/*

Set old server in Maintenance mode

Create file public_html/.htaccess

RewriteEngine On
RewriteRule ^(.*)$ https://prod.gk.kumy.org/ [R=301]

Synchronize database

# On oldsrv:
cd ~/zzz_kumy
mysqldump -ugeokrety -p geokrety --default-character-set=latin1 -r geokrety-latin1.dump

scp geokrety-latin1.dump tr1.sys.kumy.org:~/GEOKRETY-LEGACY-REC/

# On newsrv:
cd ~/GEOKRETY-LEGACY-REC/
sed -i '/SET NAMES latin1/d' geokrety-latin1.dump
docker cp geokrety-latin1.dump mariadb:/tmp/
docker exec -it  mariadb bash
mysql -ugeokrety-legacy-rec -p --default-character-set=utf8 geokrety-legacy-rec
mysql> SET names 'utf8'
mysql> SOURCE /tmp/geokrety-latin1.dump

Change DNS entry

Change dns to point to the new server

geokrety.org. 3600 IN CNAME prod.gk.kumy.org.

Activate ssl in traefik

edit traefik.toml, uncomment geokrety.org lines

Clone this wiki locally