Skip to content

Migration operating mode

kumy edited this page Oct 7, 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)

cd ~/zzz_kumy
./sync-images.sh

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
RedirectMatch 404 /\.svn.*$
RewriteCond %{REQUEST_URI} !^/maintenance.html$
RewriteRule ^(.*)$ https://geokrety.org/maintenance.html [L,R=302]

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

Synchronize pictures (iter 1)

cd ~/zzz_kumy
./sync-images.sh

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

Generate data

docker exec -it geokretylegacyprod_geokrety-legacy-scripts-prod_1 bash

export HOME=/opt/geokrety

cd $HOME && echo ./czysc.php && ./czysc.php 
cd $HOME/geonames/ && echo ./geonames-ruchy-alt.php && timeout 300s ./geonames-ruchy-alt.php 
cd $HOME/geonames/ && echo ./geonames-waypointy.php && timeout 300s ./geonames-waypointy.php 
cd $HOME/mapa_statyczna_logow/  && echo ./ostatnie_logi.sh && ./ostatnie_logi.sh 
cd $HOME/pop/ && echo ./procesuj.php && ./procesuj.php  
cd $HOME/rajdy/ && echo ./sprawdz-status.php && ./sprawdz-status.php 
cd $HOME/spam/ && echo ./spam_search.php && nice -n 10 ./spam_search.php 
cd $HOME/statystyki/ && echo ./apps_stats.php && ./apps_stats.php 
cd $HOME/statystyki/ && echo ./statystyczka.php && nice -n 14 ./statystyczka.php 
cd $HOME/statystyki/ && echo ./statystyki_nocne.sh && nice -n 10 ./statystyki_nocne.sh 
cd $HOME/waypointy/hu/ && echo ./gpx2sql.php && nice -n 13 ./gpx2sql.php 
cd $HOME/waypointy/oc/ && echo ./xml2sql.php && nice -n 13 ./xml2sql.php 
cd $HOME/waypointy/ro+trans/ && echo ./xml2sql.php && nice -n 13 ./xml2sql.php 
cd $HOME/waypointy/ru/ && echo ./gpx2sql.php && nice -n 10 ./gpx2sql.php 
cd $HOME/waypointy/wpg/ && echo ./gpx2sql-wpg.php && nice -n 13 ./gpx2sql-wpg.php 
cd $HOME/wykresy/ && echo ./histogram.php && ./histogram.php 
cd $HOME/wykresy/ && echo ./histogram-systemy.php && ./histogram-systemy.php 
cd $HOME/wykresy/ && echo ./pie.php && ./pie.php 
cd $HOME/wykresy/ && echo ./tabela_statystyki.php && ./tabela_statystyki.php 
cd $HOME/wykresy/ && echo ./tabela_statystyki_rysuj.php && ./tabela_statystyki_rysuj.php 
cd $HOME/wykresy/ && echo ./wysokosc.php && nice -n 1 ./wysokosc.php 
cd $HOME/waypointy/gpsgames && echo ./wpt && nice -n 10 ./wpt 
cd $HOME/ && echo ./static_xml.sh && nice -n 10 ./static_xml.sh  

Check