Compare commits

...

130 Commits

Author SHA1 Message Date
1ecedd7c00 build 2025-06-19 17:22:26 +02:00
87c671d23b build 2025-06-19 13:16:04 +02:00
97297f0c4e build 2025-06-19 12:55:12 +02:00
58e2596d3d build 2025-06-19 12:51:55 +02:00
ff736e20f1 build 2025-06-19 12:46:06 +02:00
94f5a08920 build 2025-06-19 12:20:01 +02:00
3f7a77b7b0 build 2025-05-26 19:23:19 +02:00
687ffc828d build 2025-05-26 07:40:12 +02:00
f17f1ca372 build 2025-05-26 07:39:42 +02:00
d5b114e771 build 2025-05-26 07:37:06 +02:00
edb3091b2a build 2025-05-24 20:25:59 +02:00
10edb2b533 Merge branch 'main' of gitlab.sectorq.eu:jaydee/omv_backup 2025-05-24 20:25:39 +02:00
3bffbd872d build 2025-05-24 20:25:35 +02:00
af5d64200c Update .gitlab-ci.yml file 2025-05-24 20:25:24 +02:00
95dd8fb52b build 2025-05-24 20:24:15 +02:00
45476954cc build 2025-05-24 20:23:26 +02:00
386e3ec75c Merge branch 'main' of gitlab.sectorq.eu:jaydee/omv_backup 2025-05-24 20:22:53 +02:00
854f0c828a build 2025-05-24 20:22:45 +02:00
06c776ee90 Update .gitlab-ci.yml file 2025-05-24 20:22:37 +02:00
71d661dfb5 build 2025-05-24 20:16:00 +02:00
ca518405ff build 2025-05-24 20:05:33 +02:00
a1b4aff656 build 2025-05-24 19:37:01 +02:00
b40a7f795e build 2025-05-24 19:32:21 +02:00
50d9f18969 Merge branch 'main' of gitlab.sectorq.eu:jaydee/omv_backup 2025-05-24 19:31:39 +02:00
baa26b3a09 build 2025-05-24 19:31:33 +02:00
eff8120428 Update .gitlab-ci.yml file 2025-05-24 19:30:58 +02:00
25151a5776 build 2025-05-24 19:29:55 +02:00
82b9f93e13 build 2025-05-24 19:27:30 +02:00
6fa3c016b2 Merge branch 'main' of gitlab.sectorq.eu:jaydee/omv_backup 2025-05-24 19:26:45 +02:00
23d32537c7 build 2025-05-24 19:26:39 +02:00
607f58ae0a buil 2025-05-24 19:26:29 +02:00
dce4ccb711 Update .gitlab-ci.yml file 2025-05-24 19:24:53 +02:00
b66a4598de buil 2025-05-24 19:20:34 +02:00
3d2d8e5c3d build 2025-05-24 19:19:05 +02:00
b12359c373 Update .gitlab-ci.yml file 2025-05-24 19:18:44 +02:00
cc698871f6 build 2025-05-24 19:17:21 +02:00
66867ae717 build 2025-05-24 19:16:19 +02:00
9554f194ac build 2025-05-24 19:15:18 +02:00
4ea82d55a8 build 2025-05-24 19:13:53 +02:00
d855defac0 build 2025-05-24 19:13:25 +02:00
a90c1d5589 Update .gitlab-ci.yml file 2025-05-24 19:13:13 +02:00
5cae7332d5 build 2025-05-24 19:11:47 +02:00
e17d538c2b Update .gitlab-ci.yml file 2025-05-24 19:11:29 +02:00
f9266b0bc9 Update .gitlab-ci.yml file 2025-05-24 19:10:53 +02:00
7909eadad5 build 2025-05-24 19:09:37 +02:00
c5a71ef749 Update .gitlab-ci.yml file 2025-05-24 19:09:28 +02:00
7a3da9ee7d Merge branch 'main' of gitlab.sectorq.eu:jaydee/omv_backup 2025-05-24 19:09:04 +02:00
ab5ba0e10d build 2025-05-24 19:09:01 +02:00
db3d4245d9 Update .gitlab-ci.yml file 2025-05-24 19:08:50 +02:00
6b522f6cbc build 2025-05-24 19:08:04 +02:00
39d16f6f2c Merge branch 'main' of gitlab.sectorq.eu:jaydee/omv_backup 2025-05-24 19:07:18 +02:00
5ed0031208 build 2025-05-24 19:07:16 +02:00
fded5b677c Update .gitlab-ci.yml file 2025-05-24 19:07:05 +02:00
67b73319e0 build 2025-05-24 19:05:53 +02:00
9daa539028 Update .gitlab-ci.yml file 2025-05-24 19:05:19 +02:00
f22b99030b Update .gitlab-ci.yml file 2025-05-24 19:04:47 +02:00
ac2d7d212e Merge branch 'main' of gitlab.sectorq.eu:jaydee/omv_backup 2025-05-24 19:01:46 +02:00
6a52d29803 build 2025-05-24 19:01:38 +02:00
fd99f4ef78 Update .gitlab-ci.yml file 2025-05-24 19:01:29 +02:00
daeb2901f2 build 2025-05-24 19:00:15 +02:00
59f6d1669b added v3 2025-05-24 18:59:45 +02:00
ca9a2d0969 added v3 2025-05-24 18:58:53 +02:00
6ff4833e0b added v3 2025-05-24 18:57:33 +02:00
506e4cc7df added v3 2025-05-24 18:57:07 +02:00
ccf4d16c55 added v3 2025-05-24 18:56:51 +02:00
6acf13de4e added v3 2025-05-24 18:54:50 +02:00
e9b1c18bb7 added v3 2025-05-24 18:52:54 +02:00
6f70dbc83c Update .gitlab-ci.yml file 2025-05-24 18:52:40 +02:00
2951d204a6 Update .gitlab-ci.yml file 2025-05-24 18:48:58 +02:00
15e1275c5a Update .gitlab-ci.yml file 2025-05-24 18:45:30 +02:00
c636e1f2e5 Update .gitlab-ci.yml file 2025-05-24 18:44:47 +02:00
97ff1a3197 added v3 2025-05-24 18:43:06 +02:00
6bd7d5dde6 Update .gitlab-ci.yml file 2025-05-21 13:47:56 +02:00
bfefa386a5 Update .gitlab-ci.yml file 2025-05-21 13:46:50 +02:00
afe5faae8a Update .gitlab-ci.yml file 2025-05-21 13:45:23 +02:00
047001a93b renamed customer user group 2025-05-21 13:41:29 +02:00
8f860f1180 Update .gitlab-ci.yml file 2025-05-21 13:38:54 +02:00
58c9816677 Update .gitlab-ci.yml file 2025-05-21 13:38:22 +02:00
665b0b36b4 build 2025-05-20 13:46:00 +02:00
987d04fc86 build 2025-05-20 13:44:18 +02:00
94bab11c58 build 2025-05-20 13:43:26 +02:00
69b2ab1920 build 2025-05-20 13:42:50 +02:00
120a2127c4 bui11 2025-05-20 13:42:26 +02:00
341edd4399 bui11 2025-05-20 13:38:06 +02:00
0797e69619 bui11 2025-05-20 13:35:51 +02:00
19d039ec13 bui11 2025-05-20 13:34:02 +02:00
f2d6f3f391 Merge branch 'main' of gitlab.sectorq.eu:jaydee/omv_backup 2025-05-20 13:30:01 +02:00
0307bf4aff bui11 2025-05-20 13:29:58 +02:00
da25006c74 Delete .gitlab-ci.yml 2025-05-20 13:29:33 +02:00
cded28f0cc Update .gitlab-ci.yml file 2025-05-20 13:25:19 +02:00
4134d56c98 bui11 2025-05-20 13:24:53 +02:00
99e111d089 Update .gitlab-ci.yml file 2025-05-20 13:23:01 +02:00
1e0ee17dda bui11 2025-05-20 13:17:00 +02:00
59b8436596 bui11 2025-05-20 13:15:07 +02:00
9d07b227fb Update .gitlab-ci.yml file 2025-05-20 13:14:50 +02:00
a42a9ac8b7 Merge branch 'main' of gitlab.sectorq.eu:jaydee/omv_backup 2025-05-20 13:14:29 +02:00
c4c8f6421a bui11 2025-05-20 13:14:22 +02:00
62c235ff4c Update .gitlab-ci.yml file 2025-05-20 13:13:15 +02:00
459a58cdc7 Update .gitlab-ci.yml file 2025-05-20 13:13:01 +02:00
29f2e7dd95 bui11 2025-05-20 13:11:49 +02:00
703a67f516 Update .gitlab-ci.yml file 2025-05-20 13:11:44 +02:00
9f7f13e7cb bui11 2025-05-20 13:07:57 +02:00
9c34880ba9 bui11 2025-05-20 13:05:24 +02:00
7eb37d2184 bui11 2025-05-20 13:04:23 +02:00
69a404ccad Merge branch 'main' of gitlab.sectorq.eu:jaydee/omv_backup 2025-05-20 13:02:57 +02:00
6d4602aeaa build 2025-05-20 13:02:53 +02:00
a50bdeb9d3 Update .gitlab-ci.yml file 2025-05-20 13:02:36 +02:00
b7342433bf build 2025-05-20 12:59:09 +02:00
41c5628fbb build 2025-05-20 12:57:50 +02:00
7fadea9fa7 build 2025-05-20 12:55:49 +02:00
16b0e0e7e4 Merge branch 'main' of gitlab.sectorq.eu:jaydee/omv_backup 2025-05-20 12:55:04 +02:00
0082963725 added v3 2025-05-20 12:54:41 +02:00
004a737215 Update .gitlab-ci.yml file 2025-05-20 12:53:34 +02:00
d795a5e4cd build 2025-05-20 12:04:47 +02:00
d9c9b010a9 Update .gitlab-ci.yml file 2025-05-20 12:03:46 +02:00
a3e804c80d Update .gitlab-ci.yml file 2025-05-20 12:01:07 +02:00
dd9d7e1241 added v3 2025-05-20 11:44:56 +02:00
134e538b1f added v3 2025-05-20 09:28:18 +02:00
a2f42d41c2 added v3 2025-05-20 09:27:04 +02:00
9e51ed3707 added v3 2025-05-06 18:04:02 +02:00
f03a7362bd added v3 2025-05-06 11:36:56 +02:00
2913f8c5cd added v3 2025-05-06 04:23:46 +02:00
7bafeb227a added v3 2025-05-06 03:32:34 +02:00
2fbe457fde added v3 2025-05-06 03:26:37 +02:00
8c53b07cf5 added v3 2025-05-05 22:20:27 +02:00
420423066a build 2025-05-05 18:34:57 +02:00
02999e5619 build 2025-05-05 18:34:30 +02:00
a414a04bd0 build 2025-05-05 18:32:42 +02:00
0365c5e4e2 build 2025-05-05 18:29:43 +02:00
1ee67ce3e9 build 2025-05-05 18:27:55 +02:00
5 changed files with 649 additions and 335 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.gitlab-ci.yml

View File

@ -1,9 +1,30 @@
stages:
- build
# This file is a template, and might need editing before it works on your project.
# This is a sample GitLab CI/CD configuration file that should run without any modifications.
# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
# it uses echo commands to simulate the pipeline execution.
#
# A pipeline is composed of independent jobs that run scripts, grouped into stages.
# Stages run in sequential order, but jobs within stages run in parallel.
#
# For more information, see: https://docs.gitlab.com/ee/ci/yaml/#stages
#
# You can copy and paste this template into a new `.gitlab-ci.yml` file.
# You should not add this template to an existing `.gitlab-ci.yml` file by using the `include:` keyword.
#
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/development/cicd/templates/
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
build_job:
stages: # List of stages for jobs, and their order of execution
- build
build-job: # This job runs in the build stage, which runs first.
stage: build
script:
- echo "Running build pipeline"
- column=":"
- echo "${flow_id}"
- curl -X POST https://kestra.sectorq.eu/api/v1/executions/webhook/jaydee/ansible-all/${flow_id} -d '{"tag":["setup","omv_backup"],"target":["servers"]}' -H "Content-Type${column} application/json"
rules:
- if: '$CI_COMMIT_MESSAGE =~ /build/'

View File

@ -1,18 +1,52 @@
import subprocess
import requests
import datetime
import os
import shutil
now = datetime.datetime.now()
PASSWORD = "l4c1j4yd33Du5lo"
DATETIME = now.strftime("%Y%m%d%H%M%S")
os.chdir("/share/docker_data/__backups/")
print("Backup gitlab")
cmnd = 'docker exec -t gitlab gitlab-backup create SKIP=artifacts,repositories,registry,uploads,builds,pages,lfs,packages,terraform_state'
status, output = subprocess.getstatusoutput(cmnd)
allfiles = os.listdir("/share/docker_data/gitlab/data/backups/")
for f in allfiles:
shutil.move(f"/share/docker_data/gitlab/data/backups/{f}", "/share/docker_data/__backups/")
print("Backup nextcloud")
cmnd = 'docker exec --user www-data nextcloud-app-1 php occ maintenance:mode --on'
status, output = subprocess.getstatusoutput(cmnd)
cmnd = f"docker exec nextcloud-db-1 sh -c 'exec mysqldump --single-transaction -h localhost -u nextcloud -pl4c1j4yd33Du5lo nextcloud' > /share/docker_data/__backups/nextcloudDB_{DATETIME}.sql"
cmnd = f"docker exec nextcloud-db-1 sh -c 'exec mysqldump --single-transaction -h localhost -u nextcloud -p{PASSWORD} nextcloud' > /share/docker_data/__backups/nextcloudDB_{DATETIME}.sql"
status, output = subprocess.getstatusoutput(cmnd)
cmnd = "docker exec --user www-data nextcloud-app-1 php occ maintenance:mode --off"
status, output = subprocess.getstatusoutput(cmnd)
cmnd = f"zip -P {PASSWORD} nextcloudDB_{DATETIME}.sql.zip nextcloudDB_{DATETIME}.sql"
status, output = subprocess.getstatusoutput(cmnd)
os.remove(f"nextcloudDB_{DATETIME}.sql")
print("Backup Bookstack")
cmnd = f"docker exec bookstack-db-1 sh -c 'exec mysqldump --single-transaction -h localhost -u bookstack -p{PASSWORD} bookstackapp' > /share/docker_data/__backups/bookstack_{DATETIME}.sql"
status, output = subprocess.getstatusoutput(cmnd)
cmnd = f"zip -P {PASSWORD} bookstack_{DATETIME}.sql.zip bookstack_{DATETIME}.sql"
status, output = subprocess.getstatusoutput(cmnd)
os.remove(f"bookstack_{DATETIME}.sql")
print("Backup Kestra")
cmnd = f"docker exec kestra-postgres-1 sh -c 'pg_dump -h localhost -p 5432 -U kestra -d kestra' > /share/docker_data/__backups/kestra_{DATETIME}.sql"
status, output = subprocess.getstatusoutput(cmnd)
cmnd = f"zip -P {PASSWORD} kestra_{DATETIME}.sql.zip kestra_{DATETIME}.sql"
status, output = subprocess.getstatusoutput(cmnd)
os.remove(f"kestra_{DATETIME}.sql")
print("Backup Authentik")
cmnd = f"docker exec authentik-postgresql-1 sh -c 'pg_dump -h localhost -p 5432 -U authentik -d authentik' > /share/docker_data/__backups/authentik_{DATETIME}.sql"
status, output = subprocess.getstatusoutput(cmnd)
cmnd = f"zip -P {PASSWORD} authentik_{DATETIME}.sql.zip authentik_{DATETIME}.sql"
status, output = subprocess.getstatusoutput(cmnd)
os.remove(f"authentik_{DATETIME}.sql")
print("Backup portainer")
headers = {
@ -21,7 +55,7 @@ headers = {
}
json_data = {
'password': 'l4c1j4yd33Du5lo',
'password': PASSWORD,
}
response = requests.post('https://portainer.sectorq.eu/api/backup', headers=headers, json=json_data, verify=True)
@ -32,4 +66,8 @@ response = requests.post('https://portainer.sectorq.eu/api/backup', headers=head
#response = requests.post('https://portainer.sectorq.eu/api/backup', headers=headers, data=data, verify=False)
with open(f'/share/docker_data/__backups/portainer_snapshot_{DATETIME}.tar.gz', 'wb') as f:
f.write(response.content)
f.write(response.content)
os.chdir("/share/docker_data/__backups/")
print("Remove Old Files")
cmnd = f" find ./ -maxdepth 1 -type f -mtime +15 -exec rm -f {{}} \\;"
status, output = subprocess.getstatusoutput(cmnd)

File diff suppressed because it is too large Load Diff