ugoviti / izpbx

izPBX is a Turnkey Cloud Native Telephony System powered by Asterisk Engine and FreePBX Management GUI
GNU General Public License v3.0
169 stars 71 forks source link

Backup data dir? #4

Closed RobertBerger closed 3 years ago

RobertBerger commented 3 years ago

I copied /data via rsync elsewhere, pulled my fork of izdock-izpbx (which is basically identical), restored via rsync the data dir, but it didn't start up. Is this intentionally?

How would you backup/restore data?

ugoviti commented 3 years ago

what rsync command have you used? anyway, rsyncing the data dir is sufficient to clone the installation wherever you want.

example:

cd /opt/izpbx
docker-compose down
rsync -a -P /opt/izpbx/ root@otherhost:/opt/izpbx/

ssh root@otherhost
cd /opt/izpbx/
docker-compose up -d

docker-compose down is useful because you clone the mysql db also, so it's better shutdown to avoid corrupted data.

Kind Regards

RobertBerger commented 3 years ago

Hi,

I used this to create the backup rsync -avp ../../../izdock-izpbx/data/* . and this to restore it rsync -avp ../izdock-izpbx-backup/2020-08-26/data . as a normal user - not root, which might be the problem?

I do use docker-compose up and docker-compose down and plan to write a systemd unit file to start it all up and shut it down via systemd.

ugoviti commented 3 years ago

Yes, the UID and GID of files/dir must be preserved for security and functionality, so you must run rsync using root account or via sudo command.

Can you retry using root account and let me know if it worked?

Kind Regards

RobertBerger commented 3 years ago

My custom default.env is now live-default.env and I made a symlink to .env

I started it up, updated all installed modules and did a backup.

I hacked up 2 scripts: https://github.com/RobertBerger/izdock-izpbx/blob/dev/scripts/backup-data.sh and https://github.com/RobertBerger/izdock-izpbx/blob/dev/scripts/restore-data.sh

Afterwards I killed the dir, checked out my version from git, restored the backup and everything looks good so far. admin login works, modules are up to date.

Great! You can close this issue if you like.

ugoviti commented 3 years ago

Good! Thank you for the feedback