Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HongzheWang
slapos
Commits
0054135b
Commit
0054135b
authored
Jun 17, 2022
by
HongzheWang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
matomo-tutorial:Add backup function
parent
33ff2ac8
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
2 deletions
+79
-2
software/matomo-tutorial/buildout.hash.cfg
software/matomo-tutorial/buildout.hash.cfg
+5
-1
software/matomo-tutorial/matomo-backup.sh.in
software/matomo-tutorial/matomo-backup.sh.in
+49
-0
software/matomo-tutorial/matomo-instance.cfg.in
software/matomo-tutorial/matomo-instance.cfg.in
+14
-0
software/matomo-tutorial/software.cfg
software/matomo-tutorial/software.cfg
+11
-1
No files found.
software/matomo-tutorial/buildout.hash.cfg
View file @
0054135b
...
@@ -15,4 +15,8 @@
...
@@ -15,4 +15,8 @@
[template-matomo-instance]
[template-matomo-instance]
filename = matomo-instance.cfg.in
filename = matomo-instance.cfg.in
md5sum = d41d8cd98f00b204e9800998ecf8427e
md5sum = 2183607e3c22bc57d3898742ea0c1ef5
[template-matomo-backup.sh]
filename = matomo-backup.sh.in
md5sum = fb29ad59813ef62c3f5934d4a0d90e14
software/matomo-tutorial/matomo-backup.sh.in
0 → 100644
View file @
0054135b
#!/bin/sh
set
-e
set
-x
#checkout if directory and matomo resources exist
if
[
!
-d
{{
parameter_dict[
'document-root'
]
}}
/matomo/config
]
;
then
exit
1
;
fi
if
[
!
-f
{{
parameter_dict[
'document-root'
]
}}
/matomo/config/config.ini.php
]
;
then
exit
0
;
fi
trap
'rm -rf "$TMPFILE"'
EXIT TERM INT
#we reserve backup folder in a month
{{
parameter_dict[
'find-bin'
]
}}
/bin/find
{{
parameter_dict[
'dir-backup'
]
}}
-mtime
+30
-type
d |
{{
parameter_dict[
'find-bin'
]
}}
/bin/xargs
rm
-rf
#backup
TMPFILE
=
$(
mktemp
-d
-p
"{{ parameter_dict['dir-backup'] }}"
)
{{
php_bin
}}
{{
parameter_dict[
'document-root'
]
}}
/matomo/console plugin:list
>
$TMPFILE
/plugins_list
cp
-rf
{{
parameter_dict[
'document-root'
]
}}
/matomo/config
$TMPFILE
/config
cp
-rf
{{
parameter_dict[
'document-root'
]
}}
/matomo/plugins
$TMPFILE
/plugins
#check if copy-action finish well
if
test
!
-z
"
$(
{{
parameter_dict[
'diff-bin'
]
}}
/bin/diff
-r
$TMPFILE
/config
{{
parameter_dict[
'document-root'
]
}}
/matomo/config
)
"
;
then
exit
1
fi
if
test
!
-z
"
$(
{{
parameter_dict[
'diff-bin'
]
}}
/bin/diff
-r
$TMPFILE
/plugins
{{
parameter_dict[
'document-root'
]
}}
/matomo/plugins
)
"
;
then
exit
1
fi
#check if the file plugins_list has been created
if
[
!
-f
$TMPFILE
/plugins_list
]
;
then
exit
1
fi
#if all things go well, change the name of folder with date now
if
[
-d
$TMPFILE
]
;
then
mv
-f
$TMPFILE
{{
parameter_dict[
'dir-backup'
]
}}
/
`
date
+%m-%d-%Y-%T
`
fi
exit
0
software/matomo-tutorial/matomo-instance.cfg.in
View file @
0054135b
# parameters required by the configuration instance
[instance-parameter]
matomo = ${:document-root}
dir-backup = ${directory:backup}
find-bin = {{ findutils_location }}
diff-bin = {{ diffutils_location }}
[matomo-backup.sh]
recipe = slapos.recipe.template:jinja2
url = {{ matomo_backup_sh }}
output = ${directory:scripts}/matomo-backup
context =
section parameter_dict instance-parameter
key php_bin php-bin:wrapper-path
software/matomo-tutorial/software.cfg
View file @
0054135b
...
@@ -6,6 +6,8 @@ extends =
...
@@ -6,6 +6,8 @@ extends =
# "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
../../component/diffutils/buildout.cfg
parts =
parts =
# Call installation of slapos.cookbook egg defined in stack/slapos.cfg (needed
# Call installation of slapos.cookbook egg defined in stack/slapos.cfg (needed
# in 99,9% of Slapos Software Releases)
# in 99,9% of Slapos Software Releases)
...
@@ -30,7 +32,7 @@ archive-root = matomo
...
@@ -30,7 +32,7 @@ archive-root = matomo
# 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:output}
path = ${template-matomo-instance:output}
part-list =
part-list =
matomo-backup.sh
db-name = matomo
db-name = matomo
db-user = matomo
db-user = matomo
db-password = 12345678
db-password = 12345678
...
@@ -40,3 +42,11 @@ recipe = slapos.recipe.template:jinja2
...
@@ -40,3 +42,11 @@ recipe = slapos.recipe.template:jinja2
url = ${:_profile_base_location_}/${:filename}
url = ${:_profile_base_location_}/${:filename}
output = ${buildout:directory}/instance-matomo.cfg
output = ${buildout:directory}/instance-matomo.cfg
context =
context =
key findutils_location findutils:location
key diffutils_location diffutils:location
key php_location apache-php:location
key matomo_backup_sh template-matomo-backup.sh:target
# download matomo-backup.sh.in
[template-matomo-backup.sh]
<= matomo-download
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment