Commit b701088e authored by HongzheWang's avatar HongzheWang

software/matomo:use python3,change backup way

parent 667d73b1
...@@ -19,8 +19,8 @@ md5sum = 9940e05d5e624a7884f4e6e062355798 ...@@ -19,8 +19,8 @@ md5sum = 9940e05d5e624a7884f4e6e062355798
[template-matomo-instance] [template-matomo-instance]
filename = matomo-instance.cfg.in filename = matomo-instance.cfg.in
md5sum = cd5d8b83fef478b2fbb4ccc9489f47ed md5sum = 5d93bb438971167e7f9f39047cb83821
[template-matomo-backup.sh] [template-matomo-backup.sh]
filename = matomo-backup.sh.in filename = matomo-backup.sh.in
md5sum = d11e34a576e580d4253fbe787f85e5cc md5sum = 27f4925e3a5b235bdcd3e96117cbfcce
...@@ -13,20 +13,32 @@ if [ ! -f {{ parameter_dict['document-root'] }}/matomo/config/config.ini.php ]; ...@@ -13,20 +13,32 @@ if [ ! -f {{ parameter_dict['document-root'] }}/matomo/config/config.ini.php ];
exit 0; exit 0;
fi fi
#create plugins backup file #we reserve backup folder in a month
touch {{ parameter_dict['dir-backup'] }}/plugins_list find {{ parameter_dict['dir-backup'] }} -mtime +30 |xargs rm -rf
#remove backup file before #backup
if [ -d {{ parameter_dict['dir-backup'] }}/config ]; then mkdir {{ parameter_dict['dir-backup'] }}/temp
rm -rf {{ parameter_dict['dir-backup'] }}/config {{ php_bin }} {{ parameter_dict['document-root'] }}/matomo/console plugin:list > {{ parameter_dict['dir-backup'] }}/temp/plugins_list
cp -rf {{ parameter_dict['document-root'] }}/matomo/config {{ parameter_dict['dir-backup'] }}/temp/config
cp -rf {{ parameter_dict['document-root'] }}/matomo/plugins {{ parameter_dict['dir-backup'] }}/temp/plugins
#check if copy-action finish well
if test ! -z "$(diff -r {{ parameter_dict['dir-backup'] }}/temp/config {{ parameter_dict['document-root'] }}/matomo/config)"; then
rm -rf {{ parameter_dict['dir-backup'] }}/temp
fi fi
if [ -d {{ parameter_dict['dir-backup'] }}/plugins ]; then if test ! -z "$(diff -r {{ parameter_dict['dir-backup'] }}/temp/plugins {{ parameter_dict['document-root'] }}/matomo/plugins)"; then
rm -rf {{ parameter_dict['dir-backup'] }}/plugins rm -rf {{ parameter_dict['dir-backup'] }}/temp
fi
#check if the file plugins_list has been created
if [ ! -f {{ parameter_dict['dir-backup'] }}/temp/plugins_list ]; then
rm -rf {{ parameter_dict['dir-backup'] }}/temp
fi
#if all things go well, change the name of folder with date now
if [ -d {{ parameter_dict['dir-backup'] }}/temp ]; then
mv -f {{ parameter_dict['dir-backup'] }}/temp {{ parameter_dict['dir-backup'] }}/`date +%m-%d-%Y-%T`
fi fi
#backup
{{ php_bin }} {{ parameter_dict['document-root'] }}/matomo/console plugin:list > {{ parameter_dict['dir-backup'] }}/plugins_list
cp -rf {{ parameter_dict['document-root'] }}/matomo/config {{ parameter_dict['dir-backup'] }}
cp -rf {{ parameter_dict['document-root'] }}/matomo/plugins {{ parameter_dict['dir-backup'] }}
exit 0 exit 0
...@@ -40,9 +40,6 @@ rendered = ${directory:scripts}/matomo-backup ...@@ -40,9 +40,6 @@ rendered = ${directory:scripts}/matomo-backup
context = context =
section parameter_dict instance-parameter section parameter_dict instance-parameter
key php_bin php-bin:wrapper-path key php_bin php-bin:wrapper-path
depends =
${matomo-apache-httpd:recipe}
${matomo-backup-cron:recipe}
[slap-parameter] [slap-parameter]
instance.cli-url = ${apache-php-configuration:url} instance.cli-url = ${apache-php-configuration:url}
......
[buildout] [buildout]
extends = extends =
buildout.hash.cfg buildout.hash.cfg
#apache-php mariadb zilb ... # LAMP stands for Linux, Apache, MySQL, PHP
../../stack/lamp/buildout.cfg ../../stack/lamp/buildout.cfg
# "slapos" stack describes basic things needed for 99.9% of SlapOS Software # "slapos" stack describes basic things needed for 99.9% of SlapOS Software
../../stack/slapos.cfg ../../stack/slapos.cfg
...@@ -15,6 +15,10 @@ parts = ...@@ -15,6 +15,10 @@ parts =
# to create file instance.cfg of all instances # to create file instance.cfg of all instances
instance instance
#to make sure we use python3
[python]
part = python3
# download bas # download bas
# inherited by modules that need to download files # inherited by modules that need to download files
[matomo-download] [matomo-download]
...@@ -31,7 +35,7 @@ md5sum = 8d592676bc2c0d51363ad7b2caf171fe ...@@ -31,7 +35,7 @@ md5sum = 8d592676bc2c0d51363ad7b2caf171fe
# Without it the instance-matomo.cfg file will not be executed # Without it the instance-matomo.cfg file will not be executed
[custom-application-deployment] [custom-application-deployment]
path = ${template-matomo-instance:rendered} path = ${template-matomo-instance:rendered}
part-list = matomo-backup.sh part-list = matomo-backup.sh matomo-backup-cron matomo-apache-httpd
[template-matomo-instance] [template-matomo-instance]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment