Difference between revisions of "Migratehelper"

From SME Server
Jump to navigationJump to search
(Created page with "{{Languages}} <!-- here we define the contrib name variable --> <!-- we get the page title, remove suffix for translated version; if needed you can define there with the valu...")
 
Line 16: Line 16:
 
|category= Category you want
 
|category= Category you want
 
|tags=backup, restore, contribs
 
|tags=backup, restore, contribs
}}
+
}}{{WIP box|this is a work in progress, contrib is currently in development. Please follow the bug list at the end of the page.}}
  
 
===Maintainer===
 
===Maintainer===
Line 28: Line 28:
  
 
=== Description ===
 
=== Description ===
<!-- add a description here -->
+
This is a suite of script intended to help backup and restore when migrating to another box with same SME version or more recent.
 +
 
 +
It will create an archive similar to the console usb backup, hence allowing console restore at startup directly after install.
 +
 
 +
It will backup all the already known by the script locations for every installed contribs.
 +
 
 +
It will also backup some user space known to have potential manually added files.
 +
 
 +
It will create a list of rpm currently installed and break them down to ease the install later.
 +
 
 +
A WIP will be to download the rpms from the repos to allow quick reinstall. A script will be used later to allow download from a more recent version.
 +
 
 +
There is also an exclusion list. By default /home/e-smith/files is in this exclusion list So you can have a server backup and restore faster, It assumes you backup those files separately and restore them manually latter (or have them on a separate mount point you can easily remount latter), as the server can boot without them on install.
  
  
Line 34: Line 46:
 
  yum --enablerepo=smecontribs install {{#var:smecontribname}}
 
  yum --enablerepo=smecontribs install {{#var:smecontribname}}
  
 +
=== Usage and behaviour ===
 +
You must first create the mount point and mount your external disk already formatted and with sufficient place to receive the archive:<syntaxhighlight lang="bash">
 +
mkdir /mnt/backup
 +
mount /dev/mydisk /mnt/backup
 +
</syntaxhighlight>
 +
 +
You can then edit (WIP creation of db properties to handle that).  Add you directories or files to include in the '''dir.list''' section, your exclusion in '''exclude.list''' section. Then check all your contribs are listed, and the associated destination are correct.<syntaxhighlight lang="bash">
 +
vim /usr/bin/migratehelper.sh
 +
</syntaxhighlight>Then run the script<syntaxhighlight lang="bash">
 +
/usr/bin/migratehelper.sh
 +
</syntaxhighlight>
 +
 +
It will then process all the files to backup and display the progress on screen. After creating the definitive list depending on installed rpms, it will then Create a list of rpm installed and breakdown them in two easy to restore lists :
 +
{| class="wikitable"
 +
!files
 +
!description
 +
|-
 +
|/root/newrpms
 +
|
 +
|-
 +
|/root/contribs
 +
|
 +
|-
 +
|/root/rpmsextra
 +
|
 +
|}
 +
 +
==== Default backup list ====
 +
note we are not including /home/e-smith/{files,shares} and /home/e-smith/db/mysql*/{daily,hourly}<syntaxhighlight lang="bash">
 +
/etc/e-smith/templates-custom
 +
/etc/e-smith/templates-user-custom
 +
/etc/group
 +
/etc/gshadow
 +
/etc/passwd
 +
/etc/samba/secrets.tdb
 +
/etc/samba/smbpasswd
 +
/etc/shadow
 +
/etc/smbpasswd
 +
/etc/ssh
 +
/etc/sudoers
 +
/root
 +
/home/e-smith/Maildir
 +
/home/e-smith/home
 +
/home/e-smith/ssl.crt
 +
/home/e-smith/ssl.key
 +
/home/e-smith/dkim_keys
 +
/home/e-smith/db
 +
/var/lib/dhcpd/dhcpd.leases
 +
/var/log/qpsmtpd
 +
/var/log/sqpsmtpd
 +
/var/log/qmail
 +
/var/log/httpd/
 +
/var/log/dovecot/
 +
/var/log/squid
 +
 +
</syntaxhighlight>
 +
 +
==== Default exclusions ====
 +
<syntaxhighlight lang="bash">
 +
/home/e-smith/db/mysql/daily
 +
/home/e-smith/db/mysql/hourly
 +
/home/e-smith/db/mysql55/daily
 +
/home/e-smith/db/mysql55/hourly
 +
/home/e-smith/db/mysql57/daily
 +
/home/e-smith/db/mysql57/hourly
 +
</syntaxhighlight>
 +
 +
==== Supported contribs ====
 +
this is a list of currently configured and known contribs to save in the process. Please be aware that it is not exhaustive. Check if your is in there, and '''check that all the needed files are indeed included'''.
 +
<syntaxhighlight lang="bash">
 +
smeserver-awstats
 +
smeserver-clamav-unofficial-sigs
 +
smeserver-durep
 +
smeserver-isoqlog
 +
smeserver-letsencrypt
 +
smeserver-sme8admin
 +
smeserver-sme9admin
 +
smeserver-sysmon
 +
smeserver-webshares
 +
smeserver-ezmlm-web
 +
smeserver-dovecot
 +
phpki
 +
smeserver-openvpn-bridge
 +
smeserver-openvpn-s2s
 +
smeserver-openvpn-routed
 +
pydio
 +
dokuwiki
 +
smeserver-lemonldap-ng
 +
smeserver-jappix
 +
smeserver-dl
 +
smeserver-limesurvey
 +
smeserver-mailman
 +
ipasserelle-listes
 +
smeserver-ntop
 +
ipasserelle-im
 +
smeserver-freepbx
 +
smeserver-webfilter
 +
smeserver-grr
 +
smeserver-madsonic
 +
smeserver-bandwidthd
 +
smeserver-sarg
 +
smeserver-unifi
 +
smeserver-transmission
 +
smeserver-xt_geoip
 +
smeserver-nextcloud
 +
 +
</syntaxhighlight>
  
 
=== Configuration ===
 
=== Configuration ===
Line 70: Line 189:
 
|enabled,disabled
 
|enabled,disabled
 
|}
 
|}
 
 
  
 
=== Uninstall ===
 
=== Uninstall ===
Line 85: Line 202:
 
Only released version in smecontrib are listed here.
 
Only released version in smecontrib are listed here.
  
{{ #smechangelog: {{#var:smecontribname}} }}
+
{{#smechangelog: {{#var:smecontribname}} }}
  
  
Line 92: Line 209:
  
 
<!-- Please keep there the template revision  number as is -->
 
<!-- Please keep there the template revision  number as is -->
[[contribtemplate::2| ]]
 
[[contriblang:: {{#var:lang}} | ]]
 

Revision as of 23:08, 20 January 2020





migratehelper
NeedImage.svg
migratehelper logo
Maintainer[[user:Jean-Philippe Pialasse|Jean-Philippe Pialasse]]
Urlhttps://wiki.contribs.org
LicenceGPL
Category

Category you want

Tags backuprestorecontribs


Warning.png Work in Progress:
this is a work in progress, contrib is currently in development. Please follow the bug list at the end of the page. has marked this page as a Work in Progress. The contents off this page may be in flux, please have a look at this page history the to see list of changes.


Maintainer

Jean-Philippe Pialasse

Version

Contrib 10:
smeserver-migratehelper
The latest version of smeserver-migratehelper is available in the SME repository, click on the version number(s) for more information.


migratehelper
The latest version of migratehelper is available in the SME repository, click on the version number(s) for more information.


Description

This is a suite of script intended to help backup and restore when migrating to another box with same SME version or more recent.

It will create an archive similar to the console usb backup, hence allowing console restore at startup directly after install.

It will backup all the already known by the script locations for every installed contribs.

It will also backup some user space known to have potential manually added files.

It will create a list of rpm currently installed and break them down to ease the install later.

A WIP will be to download the rpms from the repos to allow quick reinstall. A script will be used later to allow download from a more recent version.

There is also an exclusion list. By default /home/e-smith/files is in this exclusion list So you can have a server backup and restore faster, It assumes you backup those files separately and restore them manually latter (or have them on a separate mount point you can easily remount latter), as the server can boot without them on install.


Installation

yum --enablerepo=smecontribs install smeserver-migratehelper

Usage and behaviour

You must first create the mount point and mount your external disk already formatted and with sufficient place to receive the archive:

mkdir /mnt/backup
mount /dev/mydisk /mnt/backup

You can then edit (WIP creation of db properties to handle that). Add you directories or files to include in the dir.list section, your exclusion in exclude.list section. Then check all your contribs are listed, and the associated destination are correct.

vim /usr/bin/migratehelper.sh

Then run the script

/usr/bin/migratehelper.sh

It will then process all the files to backup and display the progress on screen. After creating the definitive list depending on installed rpms, it will then Create a list of rpm installed and breakdown them in two easy to restore lists :

files description
/root/newrpms
/root/contribs
/root/rpmsextra

Default backup list

note we are not including /home/e-smith/{files,shares} and /home/e-smith/db/mysql*/{daily,hourly}

/etc/e-smith/templates-custom
/etc/e-smith/templates-user-custom
/etc/group
/etc/gshadow
/etc/passwd
/etc/samba/secrets.tdb
/etc/samba/smbpasswd
/etc/shadow
/etc/smbpasswd
/etc/ssh
/etc/sudoers
/root
/home/e-smith/Maildir
/home/e-smith/home
/home/e-smith/ssl.crt
/home/e-smith/ssl.key
/home/e-smith/dkim_keys
/home/e-smith/db
/var/lib/dhcpd/dhcpd.leases
/var/log/qpsmtpd
/var/log/sqpsmtpd
/var/log/qmail
/var/log/httpd/
/var/log/dovecot/
/var/log/squid

Default exclusions

/home/e-smith/db/mysql/daily
/home/e-smith/db/mysql/hourly
/home/e-smith/db/mysql55/daily
/home/e-smith/db/mysql55/hourly
/home/e-smith/db/mysql57/daily
/home/e-smith/db/mysql57/hourly

Supported contribs

this is a list of currently configured and known contribs to save in the process. Please be aware that it is not exhaustive. Check if your is in there, and check that all the needed files are indeed included.

smeserver-awstats
smeserver-clamav-unofficial-sigs
smeserver-durep
smeserver-isoqlog
smeserver-letsencrypt
smeserver-sme8admin 
smeserver-sme9admin
smeserver-sysmon
smeserver-webshares
smeserver-ezmlm-web
smeserver-dovecot
phpki
smeserver-openvpn-bridge
smeserver-openvpn-s2s
smeserver-openvpn-routed
pydio
dokuwiki
smeserver-lemonldap-ng
smeserver-jappix
smeserver-dl
smeserver-limesurvey
smeserver-mailman
ipasserelle-listes
smeserver-ntop
ipasserelle-im
smeserver-freepbx
smeserver-webfilter
smeserver-grr
smeserver-madsonic
smeserver-bandwidthd
smeserver-sarg
smeserver-unifi
smeserver-transmission
smeserver-xt_geoip
smeserver-nextcloud

Configuration

you can list the available configuration with the followinf command :

config show migratehelper

Some of the properties are not shown, but are defaulted in a template or a script. Here a more comprehensive list with default and expected values :

property default values
DbName nextcloud string for mysql db
DbPassword GENERATED string for mysql db
DbUser nextcloud string for mysql db
access private private, public
status enabled enabled,disabled

Uninstall

yum remove smeserver-migratehelper  migratehelper

Bugs

Please raise bugs under the SME-Contribs section in bugzilla and select the smeserver-migratehelper component or use this link


Below is an overview of the current issues for this contrib:

No open bugs found.

Changelog

Only released version in smecontrib are listed here.

smeserver-migratehelper Changelog: SME 10 (smecontribs)
2021/12/02 Jean-Philippe Pialasse 1.0-10.sme
- remove non existing standard path /home/e-smith/home
2021/11/14 John Crisp 1.0-9.sme
- Fix JPs typo
2021/11/14 John Crisp 1.0-8.sme
- fix mangled fail2ban conf backup lines
2021/11/14 John Crisp 1.0-7.sme
- remove debug line left by mistake

2021/10/29 John Crisp 1.0-6.sme
- add check/create for a /mnt/backup dir
- Fix typos
- Fix bash syntax errors via the IDE plugin

- Add some switches for help, test, no confirm