Join the community today
Become a Member

Migrate to new server scenario

Discussion in 'Centmin Mod Insights' started by Sunka, Nov 11, 2016.

  1. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    1:44 PM
    Nginx 1.17.9
    MariaDB 10.3.22
    Move or merge this thread with similiar @eva2000 if you have to :)
    I have read Restore from backup thread, but I think that this will be better to be in seperate thread.


    I am thinking to move to another server from Digital Ocean, sometime in december.
    It will be Linode, Upcloud or maybe third one if I find something good for same price.

    I have backup on Ramnode server (backuped daily with Rsnapshot):
    • Complete /home/nginx/domains/mydomain/
    • Complete /usr/local/nginx/conf/
    • Database of my forum
    • Cron edits
    • config/ini files:
      • php.ini
      • my.cnf
      • logrotate.conf
      • redis.conf
      • redis-sentinel.conf
      • custom_config.inc
      • zendopcache.ini
      • zzz_customphp.ini
      • csf.conf
      • elasticsearch.yml
      • logwatch.conf
      • php-fpm.conf
      • nginx.conf
      • php.conf
      • drop.conf
      • staticfiles.conf
      • virtual.conf
      • ssl.conf
      • pijanitvor.com.ssl.conf
      • brotli_inc.conf
      • maintenance.conf
      • php-rediscache.conf

    Steps:
    • Create server with Centos 7
    • Install Centmin
      Code:
      yum -y update; curl -O https://centminmod.com/betainstaller.sh && chmod 0700 betainstaller.sh && bash betainstaller.sh
    • ...
    And there adventure begin...
    Should I first rsync from backup above files/folders and edit them, or shoud I first create vhost through centmin menu?

    I should also install on new server Redis, Elasticsearch, rebuild php with PGO enabled, rebuild/upgrade nginx with custom configuration, upgrade MariaDB (I think that default centmin beta install v5?).
    That should be done before rsync?

    Also need to change dedicated ram to programs, because on new server ram will be higher.
    Same for CPU core number.

    Also, I have to change all old server IP address to new one. I do not know which files exactly, and thinking about this command:
    Code:
    grep -i -r 'old IP' /
    Also, server name need to be changed and that is only in mysite.conf file?


    What about repos? Could I just copy repos files and rsync to new server?

    So many questions and tasks, and I am not afraid of that, I am afraid because I do not know steps order.

    Could anybody share thougts about this?
    I can pay through PayPal some amount to get help that day when this will be start.
     
  2. eva2000

    eva2000 Administrator Staff Member

    54,564
    12,224
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,793
    Local Time:
    10:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yes create the site domain nginx vhost via centmin menu option 2 first on new server

    yes do that before rsync - basically setup the new server the way you want before migrating data this will save site downtime as the only downtime will be related to data move and DNS propagation time (want to set TTL for DNS low like 15-60 seconds).

    leave as is as centmin mod 123.09beta01 installer will auto optimise allocations based on dedicated resources on new server. You may want to adjust later but start with what 123.09beta01 has for auto optimised baseline.

    you shouldn't have any hardcoded IP references in site vhost files at lease, you have ?

    the main hostname not site domain nginx vhost server_name would need updating if you transfer the old server's virtual.conf. But if you do not transfer it and just use new server's one, then no change for virtual.conf as it would be straight step 1 from Getting Started Guide for main hostname setup like normal

    no need, if you re-setup all stuff you wanted for Redis, Elasticsearch and PGO PHP 7 etc, then all required yum repos would have been installed by you or by centmin mod via the routines

    Good news as you are migrating, the new server is just a test server, moving data to new test server won't inteferre with live site. So if you mess up, just wipe and reload new server and try again :)

    In fact you may want to the opportunity to make it a practice task. Do it a few times over and over - more you practice the more comfortable you get and if you write down the steps you do, you end up formulating your own migration guide :D

    @RoldanLT and @Matt both have alot of experience with Centmin Mod migrations - between them they've moved servers alot !!!! :)
     
  3. eva2000

    eva2000 Administrator Staff Member

    54,564
    12,224
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,793
    Local Time:
    10:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    oh as you're on DO, you can create a manual snapshot back of your server before this migration so you have something to revert to if you accidentally mess up live server :)
     
  4. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    1:44 PM
    Nginx 1.17.9
    MariaDB 10.3.22
    I can not find in UpCloud cpanel dns settings, so this from image (in DO control panel), when transfer site, I should setup on my name registration domain (name.com)?
    I should create just first three records (A and 2x CNAME) wih different IP adress for A record.
    Is that correct?

    Digital Ocean (Cname, NS, A).png
    I already have this in name.com (I will change IP's after migrate):

    name.png


    So, should I add that 3 records from Digital Ocean to Name.com too?
    name servers are configured at name.com already, so I do not need to reconfigure them.
     
  5. eva2000

    eva2000 Administrator Staff Member

    54,564
    12,224
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,793
    Local Time:
    10:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    never used named.com interface so not 100% sure, just need your A records, SPF/TXT and MX records if you have them for 3rd party email.
     
  6. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    1:44 PM
    Nginx 1.17.9
    MariaDB 10.3.22
    I already have SPF/TXT and MX records on name.com and all working OK.
    Just need to know should I after editing existing A records on name.com add that three from Digital Ocean
     
  7. eva2000

    eva2000 Administrator Staff Member

    54,564
    12,224
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,793
    Local Time:
    10:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    oh you mean ns1-3 ? no don't need those those tell your domain registrar that digitalocean is handling your DNS
     
  8. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    1:44 PM
    Nginx 1.17.9
    MariaDB 10.3.22
    Nop.
    Name server is handled by name .com
    i ask for A and 2x CNAME from first image.
     
  9. eva2000

    eva2000 Administrator Staff Member

    54,564
    12,224
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,793
    Local Time:
    10:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    those are wildcards not needed if i understand name.com conventions
     
  10. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    1:44 PM
    Nginx 1.17.9
    MariaDB 10.3.22
    Error getting repository data for city-fan.org, repository not found
     
  11. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    1:44 PM
    Nginx 1.17.9
    MariaDB 10.3.22
    Resolved with installing custom curl script
     
  12. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    1:44 PM
    Nginx 1.17.9
    MariaDB 10.3.22
    OK, finished migration in 7 hours total.

    1. instal centos 7 on new server
    2. install centmin beta
    3. yum all
    4. install vhost
    5. update php to newest 7x
    6. install redis
    7. install phpmyadmin
    8. install elasticsearch 5
    9. install Maldet
    10. install Auditd
    11. install logwatch
    12. install gifsicle
    13. rsync domain folder
    14. download from old server all important files
      config/ini files:
      • php.ini
      • my.cnf
      • logrotate.conf
      • redis.conf
      • redis-sentinel.conf
      • custom_config.inc
      • zendopcache.ini
      • zzz_customphp.ini
      • csf.conf
      • elasticsearch.yml
      • logwatch.conf
      • php-fpm.conf
      • nginx.conf
      • php.conf
      • drop.conf
      • staticfiles.conf
      • virtual.conf
      • ssl.conf
      • pijanitvor.com.ssl.conf
      • brotli_inc.conf
      • maintenance.conf
      • php-rediscache.conf
    15. Looking for differences in new vs old conf & ini files
    16. some strange tweaking
    17. recompile nginx, php with pgo
    18. change dns
    19. ta daaaa... forum working OK

    One newbie problem I solved is how to delete symlink folder - with command to delete file, not directory (linux recognize symlink as file)
     
  13. eva2000

    eva2000 Administrator Staff Member

    54,564
    12,224
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,793
    Local Time:
    10:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    excellent work @Sunka you've come along way since the beginning with the learning and reading you have done (y)
    yeah google-fu is good and for other folks reading linux - Remove a symlink to a directory - Stack Overflow :)
    i.e.
    Code (Text):
    ls -lah /home | grep dir
    drwxr-xr-x   2 root  root  4.0K Nov 15 01:52 srcdir
    lrwxrwxrwx   1 root  root    12 Nov 15 01:52 symdir -> /home/srcdir
    

    Code (Text):
    rm /home/symdir/
    rm: cannot remove ‘/home/symdir/’: Is a directory
    

    versus
    Code (Text):
    rm /home/symdir
    rm: remove symbolic link ‘/home/symdir’? 
    
     
  14. eva2000

    eva2000 Administrator Staff Member

    54,564
    12,224
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,793
    Local Time:
    10:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+