Compare commits

...

8 Commits

30 changed files with 149 additions and 88 deletions

View File

@ -146,6 +146,7 @@ domains_wordpress: ["wordpress.{{top_domain}}","blog.{{top_domain}}
postgres_default_version: "16"
### Docker Role Specific Parameters
docker_restart_policy: "unless-stopped"
#### Akaunting
version_akaunting: "latest"
@ -153,6 +154,9 @@ akaunting_company_name: "DUMMY_VALUE_NEEDS_TO_BE_CHANGED"
akaunting_company_email: "DUMMY_VALUE_NEEDS_TO_BE_CHANGED"
akaunting_setup_admin_email: "DUMMY_VALUE_NEEDS_TO_BE_CHANGED"
#### Big Blue Button
bigbluebutton_enable_greenlight: "false"
#### Listmonk
listmonk_admin_username: "admin"

View File

@ -10,8 +10,8 @@ parser.add_argument('--maximum-backup-size-percent', type=int, dest='maximum_bac
parser.add_argument('--backups-folder-path',type=str,dest='backups_folder_path',required=True, help="The folder in which the backups are stored")
args = parser.parse_args()
def print_used_disc_space():
print("%d %% of disk %s are used" % (psutil.disk_usage(args.backups_folder_path).percent,args.backups_folder_path))
def print_used_disc_space(backups_folder_path):
print("%d %% of disk %s are used" % (psutil.disk_usage(backups_folder_path).percent,backups_folder_path))
def is_directory_used_by_another_process(directory_path):
command= "lsof " + directory_path
@ -22,8 +22,60 @@ def is_directory_used_by_another_process(directory_path):
return False
return True
for host_backup_directory_name in os.listdir(args.backups_folder_path):
host_backup_directory_path = os.path.join(args.backups_folder_path, host_backup_directory_name)
def isSmallerThenMaximumBackupSize(maximum_backup_size_percent,backups_folder_path):
current_disc_usage_percent=psutil.disk_usage(backups_folder_path).percent
return current_disc_usage_percent > maximum_backup_size_percent
def isDirectoryDeletable(version, versions, version_path):
print("Checking directory %s ..." % (version_path))
if version == versions[-1]:
print("Directory %s contains the last version of the backup. Skipped." % (version_path))
return False
if is_directory_used_by_another_process(version_path):
print("Directory %s is used by another process. Skipped." % (version_path))
return False
def deleteVersion(version_path, backups_folder_path):
print("Deleting %s to free space." % (version_path))
current_disc_usage_percent=psutil.disk_usage(backups_folder_path).percent
shutil.rmtree(version_path)
new_disc_usage_percent=psutil.disk_usage(backups_folder_path).percent
difference_percent=current_disc_usage_percent-new_disc_usage_percent
print("{:6.2f} %% of drive freed".format(difference_percent))
def count_total_application_directories(backups_folder_path):
total_app_directories = 0
for host_backup_directory_name in os.listdir(backups_folder_path):
host_backup_directory_path = os.path.join(backups_folder_path, host_backup_directory_name)
total_app_directories += sum(os.path.isdir(os.path.join(host_backup_directory_path, d)) for d in os.listdir(host_backup_directory_path))
return total_app_directories
def count_total_version_folders(backups_folder_path):
total_version_folders = 0
for host_backup_directory_name in os.listdir(backups_folder_path):
host_backup_directory_path = os.path.join(backups_folder_path, host_backup_directory_name)
for application_directory in os.listdir(host_backup_directory_path):
versions_directory = os.path.join(host_backup_directory_path, application_directory)
total_version_folders += sum(os.path.isdir(os.path.join(versions_directory, d)) for d in os.listdir(versions_directory))
return total_version_folders
def average_version_directories_per_application(backups_folder_path,blur=-1):
total_app_directories = count_total_application_directories(backups_folder_path)
total_version_folders = count_total_version_folders(backups_folder_path)
if total_app_directories == 0:
return 0
average = total_version_folders / total_app_directories
return int(average) - blur
def getAmountOfIteration(versions,average_version_directories_per_application):
return len(versions) - average_version_directories_per_application
def deleteIteration(backups_folder_path,average_version_directories_per_application):
for host_backup_directory_name in os.listdir(backups_folder_path):
host_backup_directory_path = os.path.join(backups_folder_path, host_backup_directory_name)
for application_directory in os.listdir(host_backup_directory_path):
# The directory which contains all backup versions of the application
@ -31,27 +83,28 @@ for host_backup_directory_name in os.listdir(args.backups_folder_path):
versions = os.listdir(versions_directory)
versions.sort(reverse=False)
print_used_disc_space()
for version in versions:
version_iteration=0
while version_iteration < getAmountOfIteration(versions,average_version_directories_per_application):
print_used_disc_space(backups_folder_path)
version = versions[version_iteration]
version_path=os.path.join(versions_directory, version)
print("Checking directory %s ..." % (version_path))
if version == versions[-1]:
print("Directory %s contains the last version of the backup. Skipped." % (version_path))
continue
if isDirectoryDeletable(version, versions, version_path):
deleteVersion(version_path, backups_folder_path)
version_iteration += 1
if is_directory_used_by_another_process(version_path):
print("Directory %s is used by another process. Skipped." % (version_path))
continue
backups_folder_path=args.backups_folder_path
maximum_backup_size_percent=args.maximum_backup_size_percent
old_disc_usage_percent=psutil.disk_usage(args.backups_folder_path).percent
if old_disc_usage_percent > args.maximum_backup_size_percent:
print("Deleting %s to free space." % (version_path))
shutil.rmtree(version_path)
new_disc_usage_percent=psutil.disk_usage(args.backups_folder_path).percent
difference_percent=old_disc_usage_percent-new_disc_usage_percent
print("{:6.2f} %% of drive freed".format(difference_percent))
continue
itteration_counter = 1
while isSmallerThenMaximumBackupSize(maximum_backup_size_percent, backups_folder_path):
if itteration_counter > 200:
raise Exception("Iteration limit exceeded")
print_used_disc_space()
print(f"Delete Iteration: {itteration_counter}")
average_version_directories = average_version_directories_per_application(backups_folder_path)
print(f"Average version directories per application directory: {average_version_directories}")
deleteIteration(backups_folder_path, average_version_directories)
itteration_counter += 1
print_used_disc_space(backups_folder_path)
print("Cleaning up finished.")

View File

@ -12,7 +12,7 @@ services:
- 127.0.0.1:{{http_port}}:80
volumes:
- data:/var/www/html
restart: unless-stopped
restart: {{docker_restart_policy}}
env_file:
- env/run.env
environment:

View File

@ -9,7 +9,7 @@ services:
application:
image: baserow/baserow:1.19.1
container_name: baserow-application
restart: always
restart: {{docker_restart_policy}}
logging:
driver: journald
env_file:

View File

@ -1,7 +1,7 @@
ENABLE_COTURN=true
COTURN_TLS_CERT_PATH=/etc/letsencrypt/live/{{domain}}/fullchain.pem
COTURN_TLS_KEY_PATH=/etc/letsencrypt/live/{{domain}}/privkey.pem
ENABLE_GREENLIGHT=true
ENABLE_GREENLIGHT={{bigbluebutton_enable_greenlight}}
# Enable Webhooks
# used by some integrations

View File

@ -5,7 +5,7 @@ services:
{% include 'templates/docker-service-redis.yml.j2' %}
celeryworker:
restart: always
restart: {{docker_restart_policy}}
image: funkwhale/api:${FUNKWHALE_VERSION:-latest}
env_file: .env
command: celery -A funkwhale_api.taskapp worker -l INFO --concurrency=${CELERYD_CONCURRENCY-0}
@ -18,7 +18,7 @@ services:
celerybeat:
restart: always
restart: {{docker_restart_policy}}
image: funkwhale/api:${FUNKWHALE_VERSION:-latest}
env_file: .env
command: celery -A funkwhale_api.taskapp beat --pidfile= -l INFO
@ -26,7 +26,7 @@ services:
{% include 'templates/docker-container-networks.yml.j2' %}
api:
restart: always
restart: {{docker_restart_policy}}
image: funkwhale/api:${FUNKWHALE_VERSION:-latest}
depends_on:
env_file: .env
@ -39,7 +39,7 @@ services:
{% include 'templates/docker-container-networks.yml.j2' %}
front:
restart: always
restart: {{docker_restart_policy}}
image: funkwhale/front:${FUNKWHALE_VERSION:-latest}
depends_on:
- api

View File

@ -7,7 +7,7 @@ services:
application:
logging:
driver: journald
restart: always
restart: {{docker_restart_policy}}
image: gitea/gitea:latest
environment:
- USER_UID=1000

View File

@ -7,7 +7,7 @@ services:
web:
image: 'gitlab/gitlab-ee:latest'
restart: always
restart: {{docker_restart_policy}}
hostname: '{{domain}}'
environment:
GITLAB_OMNIBUS_CONFIG: |

View File

@ -7,10 +7,9 @@
definition:
application:
image: jenkins/jenkins:lts
restart: always
restart: "{{docker_restart_policy}}"
ports:
- "127.0.0.1:{{http_port}}:8080"
restart: always
volumes:
- jenkins_data:/var/jenkins_home
log_driver: journald

View File

@ -13,7 +13,7 @@ services:
JOOMLA_DB_USER: "{{database_username}}"
JOOMLA_DB_PASSWORD: "{{database_password}}"
JOOMLA_DB_NAME: "{{database_name}}"
restart: always
restart: {{docker_restart_policy}}
volumes:
- data:/var/www/html
ports:

View File

@ -5,7 +5,7 @@ services:
{% include 'templates/docker-service-' + database_type + '.yml.j2' %}
application:
restart: unless-stopped
restart: {{docker_restart_policy}}
image: listmonk/listmonk:latest
ports:
- "127.0.0.1:{{http_port}}:9000"

View File

@ -10,7 +10,7 @@ services:
resolver:
image: ghcr.io/mailu/unbound:{{version_mailu}}
env_file: mailu.env
restart: always
restart: {{docker_restart_policy}}
{% include 'templates/docker-container-networks.yml.j2' %}
ipv4_address: 192.168.203.254
logging:
@ -18,7 +18,7 @@ services:
front:
image: ghcr.io/mailu/nginx:{{version_mailu}}
restart: always
restart: {{docker_restart_policy}}
env_file: mailu.env
logging:
driver: journald
@ -45,7 +45,7 @@ services:
admin:
image: ghcr.io/mailu/admin:{{version_mailu}}
restart: always
restart: {{docker_restart_policy}}
env_file: mailu.env
volumes:
- "admin_data:/data"
@ -63,7 +63,7 @@ services:
imap:
image: ghcr.io/mailu/dovecot:{{version_mailu}}
restart: always
restart: {{docker_restart_policy}}
env_file: mailu.env
volumes:
- "dovecot_mail:/mail"
@ -79,7 +79,7 @@ services:
smtp:
image: ghcr.io/mailu/postfix:{{version_mailu}}
restart: always
restart: {{docker_restart_policy}}
env_file: mailu.env
volumes:
- "/etc/mailu/overrides:/overrides:ro"
@ -96,7 +96,7 @@ services:
oletools:
image: ghcr.io/mailu/oletools:{{version_mailu}}
hostname: oletools
restart: always
restart: {{docker_restart_policy}}
depends_on:
- resolver
dns:
@ -106,7 +106,7 @@ services:
antispam:
image: ghcr.io/mailu/rspamd:{{version_mailu}}
restart: always
restart: {{docker_restart_policy}}
env_file: mailu.env
volumes:
- "filter:/var/lib/rspamd"
@ -128,7 +128,7 @@ services:
# Optional services
antivirus:
image: ghcr.io/mailu/clamav:{{version_mailu}}
restart: always
restart: {{docker_restart_policy}}
env_file: mailu.env
volumes:
- "filter:/data"
@ -142,7 +142,7 @@ services:
webdav:
image: ghcr.io/mailu/radicale:{{version_mailu}}
restart: always
restart: {{docker_restart_policy}}
env_file: mailu.env
volumes:
- "webdav_data:/data"
@ -159,7 +159,7 @@ services:
image: ghcr.io/mailu/fetchmail:{{version_mailu}}
volumes:
- "admin_data:/data"
restart: always
restart: {{docker_restart_policy}}
env_file: mailu.env
logging:
driver: journald
@ -174,7 +174,7 @@ services:
webmail:
image: ghcr.io/mailu/webmail:{{version_mailu}}
restart: always
restart: {{docker_restart_policy}}
env_file: mailu.env
volumes:
- "webmail_data:/data"

View File

@ -24,7 +24,7 @@
published_ports:
- "127.0.0.1:3306:3306" # can be that this will be removed if all applications use sockets
command: "--transaction-isolation=READ-COMMITTED --binlog-format=ROW" #for nextcloud
restart_policy: unless-stopped
restart_policy: "{{docker_restart_policy}}"
healthcheck:
test: "/usr/bin/mariadb --user=root --password={{central_mariadb_root_password}} --execute \"SHOW DATABASES;\""
interval: 3s

View File

@ -7,7 +7,7 @@ services:
web:
image: ghcr.io/mastodon/mastodon:{{version_mastodon}}
restart: always
restart: {{docker_restart_policy}}
env_file: .env.production
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
healthcheck:
@ -23,7 +23,7 @@ services:
streaming:
image: ghcr.io/mastodon/mastodon:{{version_mastodon}}
restart: always
restart: {{docker_restart_policy}}
env_file: .env.production
command: node ./streaming
healthcheck:
@ -37,7 +37,7 @@ services:
sidekiq:
image: ghcr.io/mastodon/mastodon:{{version_mastodon}}
restart: always
restart: {{docker_restart_policy}}
env_file: .env.production
command: bundle exec sidekiq
{% include 'templates/docker-container-depends-on-database-redis.yml.j2' %}

View File

@ -8,7 +8,7 @@ services:
logging:
driver: journald
image: matomo
restart: always
restart: {{docker_restart_policy}}
ports:
- "127.0.0.1:{{http_port}}:80"
environment:

View File

@ -6,7 +6,7 @@ services:
synapse:
image: matrixdotorg/synapse:latest
restart: always
restart: {{docker_restart_policy}}
logging:
driver: journald
volumes:
@ -23,7 +23,7 @@ services:
element:
image: vectorim/element-web:latest
restart: unless-stopped
restart: {{docker_restart_policy}}
volumes:
- ./element-config.json:/app/config.json
ports:
@ -34,28 +34,28 @@ services:
#mautrix-telegram:
# container_name: mautrix-telegram
# image: dock.mau.dev/mautrix/telegram:<version>
# restart: unless-stopped
# restart: {{docker_restart_policy}}
# volumes:
# - telegram_bridge_data:/data
#mautrix-whatsapp:
# container_name: mautrix-whatsapp
# image: dock.mau.dev/mautrix/whatsapp:latest
# restart: unless-stopped
# restart: {{docker_restart_policy}}
# volumes:
# - ./mautrix_whatsapp:/data
#mautrix-facebook:
# container_name: mautrix-facebook
# image: dock.mau.dev/mautrix/facebook:<version>
# restart: unless-stopped
# restart: {{docker_restart_policy}}
# volumes:
# - facebook_bridge_data:/data
#mautrix-instagram:
# container_name: mautrix-instagram
# image: dock.mau.dev/mautrix/instagram:<version>
# restart: unless-stopped
# restart: {{docker_restart_policy}}
# volumes:
# - instagram_bridge_data:/data

View File

@ -8,7 +8,7 @@
application:
log_driver: journald
image: mediawiki
restart: always
restart: "{{docker_restart_policy}}"
depends_on:
- database
volumes:
@ -26,4 +26,4 @@
MARIADB_AUTO_UPGRADE: "1"
volumes:
- database:/var/lib/mysql
restart: always
restart: "{{docker_restart_policy}}"

View File

@ -9,7 +9,7 @@ services:
options:
tag: "mybb_application"
image: mybb/mybb:latest
restart: always
restart: {{docker_restart_policy}}
volumes:
- data:/var/www/html
{% include 'templates/docker-container-depends-on-just-database.yml.j2' %}
@ -21,7 +21,7 @@ services:
options:
tag: "mybb_server"
image: nginx:mainline
restart: always
restart: {{docker_restart_policy}}
ports:
- "127.0.0.1:{{http_port}}:80"
volumes:

View File

@ -8,7 +8,7 @@ services:
application:
image: "nextcloud:{{version_nextcloud}}-fpm-alpine"
restart: always
restart: {{docker_restart_policy}}
logging:
driver: journald
volumes:
@ -25,7 +25,7 @@ services:
image: nginx:alpine
logging:
driver: journald
restart: always
restart: {{docker_restart_policy}}
ports:
- "127.0.0.1:{{http_port}}:80"
volumes:
@ -41,7 +41,7 @@ services:
cron:
image: "nextcloud:{{version_nextcloud}}-fpm-alpine"
restart: always
restart: {{docker_restart_policy}}
logging:
driver: journald
volumes:

View File

@ -1,7 +1,7 @@
version: "3.7"
x-op-app: &app
restart: unless-stopped
restart: {{docker_restart_policy}}
image: openproject/community:${TAG:-13}
environment:
OPENPROJECT_HTTPS: "${OPENPROJECT_HTTPS}"
@ -25,11 +25,11 @@ services:
cache:
image: memcached
restart: unless-stopped
restart: {{docker_restart_policy}}
{% include 'templates/docker-container-networks.yml.j2' %}
proxy:
restart: unless-stopped
restart: {{docker_restart_policy}}
image: openproject/community:${TAG:-13}
command: "./docker/prod/proxy"
ports:

View File

@ -8,7 +8,7 @@ services:
application:
image: zknt/pixelfed
restart: always
restart: {{docker_restart_policy}}
logging:
driver: journald
env_file:
@ -23,7 +23,7 @@ services:
{% include 'templates/docker-container-networks.yml.j2' %}
worker:
image: zknt/pixelfed
restart: always
restart: {{docker_restart_policy}}
logging:
driver: journald
env_file:

View File

@ -18,7 +18,7 @@
- "127.0.0.1:5432:5432"
volumes:
- central_postgres_database:/var/lib/postgresql/data
restart_policy: unless-stopped
restart_policy: "{{docker_restart_policy}}"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s

View File

@ -6,4 +6,4 @@ services:
context: .
ports:
- 127.0.0.1:{{http_port}}:8080
restart: always
restart: {{docker_restart_policy}}

View File

@ -10,7 +10,7 @@ services:
image: custom_wordpress
build:
context: .
restart: always
restart: {{docker_restart_policy}}
ports:
- "127.0.0.1:{{http_port}}:80"
environment:

View File

@ -8,7 +8,7 @@ services:
logging:
driver: journald
image: yourls
restart: always
restart: {{docker_restart_policy}}
ports:
- "127.0.0.1:{{http_port}}:80"
environment:

View File

@ -6,6 +6,7 @@
template:
src: "msmtprc.conf.j2"
dest: "/root/.msmtprc"
mode: 600
when: run_once_systemd_notifier_email is not defined
- name: "create {{systemd_notifier_email_folder}}"

View File

@ -7,5 +7,9 @@ Subject: $1
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=UTF-8
$(systemctl status --full "$1")
A problem with the service $1 occured:
$(systemctl status --full "$1" | head -n 30)
ERRMAIL

View File

@ -5,7 +5,7 @@
logging:
driver: journald
image: mariadb
restart: always
restart: {{docker_restart_policy}}
environment:
MYSQL_DATABASE: "{{database_name}}"
MYSQL_USER: "{{database_username}}"

View File

@ -8,7 +8,7 @@
- POSTGRES_USER={{database_username}}
- POSTGRES_DB={{database_name}}
- POSTGRES_INITDB_ARGS=--encoding=UTF8 --locale=C
restart: always
restart: {{docker_restart_policy}}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U {{database_name}}"]
interval: 10s

View File

@ -2,7 +2,7 @@
redis:
image: redis:alpine
container_name: {{docker_compose_project_name}}-redis
restart: always
restart: {{docker_restart_policy}}
logging:
driver: journald
volumes: