Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
docker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ansible
Roles
docker
Commits
9cb5967f
Commit
9cb5967f
authored
2 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
mobimo/support#2991 Add backup with borg
parent
82bafd2a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tasks/apps/maven.yml
+31
-0
31 additions, 0 deletions
tasks/apps/maven.yml
templates/maven/docker-compose.yml
+12
-0
12 additions, 0 deletions
templates/maven/docker-compose.yml
templates/maven/jobs.ini
+7
-0
7 additions, 0 deletions
templates/maven/jobs.ini
with
50 additions
and
0 deletions
tasks/apps/maven.yml
+
31
−
0
View file @
9cb5967f
...
...
@@ -28,6 +28,31 @@
Private-Token
:
'
{{
GITLAB_PRIVATE_TOKEN
}}'
dest
:
'
{{
appdir
}}/app/{{
app.id
}}.jar'
-
name
:
Ensure Crontab Directory
file
:
path
:
'
{{
appdir
}}/crontabs'
state
:
directory
when
:
app.dbimage is defined
-
name
:
Configuration Crontabs
template
:
src
:
maven/jobs.ini
dest
:
'
{{
appdir
}}/crontabs/jobs.ini'
mode
:
0664
when
:
app.dbimage is defined
-
name
:
Configure Backup
include_role
:
name
:
borgbackup
tasks_from
:
app
vars
:
application
:
docker
application_id
:
'
{{
app.id
}}'
application_remote_repo
:
'
ya0459m8@ya0459m8.repo.borgbase.com:repo'
application_root
:
'
{{
appdir
}}'
application_backup_source
:
'
{{
appdir
}}/dbbackup'
when
:
app.dbimage is defined
-
name
:
Docker compose file
template
:
src
:
maven/docker-compose.yml
...
...
@@ -41,3 +66,9 @@
with_items
:
-
pull --quiet
-
up -d
-
name
:
Set Permissions in Container
command
:
dc exec -it -u root db chown -R mysql /var/backups/mysql
args
:
chdir
:
'
{{
appdir
}}'
when
:
app.dbimage is defined
This diff is collapsed.
Click to expand it.
templates/maven/docker-compose.yml
+
12
−
0
View file @
9cb5967f
...
...
@@ -28,4 +28,16 @@ services:
-
/etc/timezone:/etc/timezone:ro
-
/etc/localtime:/etc/localtime:ro
-
{{
appdir
}}
/db:/var/lib/mysql
-
{{
appdir
}}
/dbbackup:/var/backups/mysql
cron
:
image
:
mcuadros/ofelia:latest
restart
:
unless-stopped
volumes
:
-
/etc/timezone:/etc/timezone:ro
-
/etc/localtime:/etc/localtime:ro
-
/var/run/docker.sock:/var/run/docker.sock:ro
-
{{
appdir
}}
/crontabs/jobs.ini:/etc/ofelia/config.ini
borgmatic
:
{{
docker_compose_borgmatic_service
}}
{
%
endif %
}
This diff is collapsed.
Click to expand it.
templates/maven/jobs.ini
0 → 100644
+
7
−
0
View file @
9cb5967f
[job-exec "Maven DB Backup: {{ app.id }}"]
no-overlap
=
true
tty
=
true
user
=
mysql
schedule
=
0 30 0 * * *
container
=
{{ app.id }}-db-1
command
=
sh -c
\"
mysqldump -u root --password={{ app.id }} {{ app.id }} >/var/backups/mysql/{{ app.id }}.sql && {{ lookup('healthchecks', '', user='root', jobname=['Maven DB Backup ', app.id]|join(''), schedule='30 0 * * *', disabled=crons_disabled|default(false)) }}
\"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment