mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-22 04:31:13 +01:00
Compare commits
6 Commits
d1b2d8e653
...
c2fe8a95c0
Author | SHA1 | Date | |
---|---|---|---|
c2fe8a95c0 | |||
647206b803 | |||
309e237f5c | |||
9fec9efcb1 | |||
7e694d71c0 | |||
6c0c8e0fc0 |
@ -2,18 +2,6 @@
|
|||||||
- name: "include tasks nginx-docker-proxy-domain.yml"
|
- name: "include tasks nginx-docker-proxy-domain.yml"
|
||||||
include_tasks: nginx-docker-proxy-domain.yml
|
include_tasks: nginx-docker-proxy-domain.yml
|
||||||
|
|
||||||
- name: register repository_directory_register
|
|
||||||
stat:
|
|
||||||
path: "{{repository_directory}}"
|
|
||||||
register: repository_directory_register
|
|
||||||
|
|
||||||
- name: checkout repository
|
|
||||||
ansible.builtin.shell: git checkout .
|
|
||||||
become: true
|
|
||||||
args:
|
|
||||||
chdir: "{{repository_directory}}"
|
|
||||||
when: repository_directory_register.stat.exists
|
|
||||||
|
|
||||||
- name: "backup docker-compose.yml if it exists"
|
- name: "backup docker-compose.yml if it exists"
|
||||||
command: >
|
command: >
|
||||||
mv "{{ docker_compose_file_path }}" "{{ docker_compose_backup_path }}"
|
mv "{{ docker_compose_file_path }}" "{{ docker_compose_backup_path }}"
|
||||||
@ -21,6 +9,18 @@
|
|||||||
removes: "{{ docker_compose_file_path }}"
|
removes: "{{ docker_compose_file_path }}"
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
|
- name: register directory
|
||||||
|
stat:
|
||||||
|
path: "{{docker_compose_instance_directory}}"
|
||||||
|
register: docker_compose_instance_directory_register
|
||||||
|
|
||||||
|
- name: checkout repository
|
||||||
|
ansible.builtin.shell: git checkout .
|
||||||
|
become: true
|
||||||
|
args:
|
||||||
|
chdir: "{{docker_compose_instance_directory}}"
|
||||||
|
when: docker_compose_instance_directory_register.stat.exists
|
||||||
|
|
||||||
- name: pull docker repository
|
- name: pull docker repository
|
||||||
git:
|
git:
|
||||||
repo: "https://github.com/opf/openproject-deploy"
|
repo: "https://github.com/opf/openproject-deploy"
|
||||||
|
@ -27,7 +27,8 @@ x-op-app: &app
|
|||||||
# set to true to enable the email receiving feature. See ./docker/cron for more options
|
# set to true to enable the email receiving feature. See ./docker/cron for more options
|
||||||
IMAP_ENABLED: "${IMAP_ENABLED:-false}"
|
IMAP_ENABLED: "${IMAP_ENABLED:-false}"
|
||||||
volumes:
|
volumes:
|
||||||
- "${OPDATA:-opdata}:/var/openproject/assets"
|
- "${OPDATA}:/var/openproject/assets"
|
||||||
|
- "${PGDATA}:/var/openproject/pgdata"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
@ -35,9 +36,9 @@ services:
|
|||||||
<<: *restart_policy
|
<<: *restart_policy
|
||||||
stop_grace_period: "3s"
|
stop_grace_period: "3s"
|
||||||
volumes:
|
volumes:
|
||||||
- "${PGDATA:-pgdata}:/var/lib/postgresql/data"
|
- "${PGDATA}:/var/lib/postgresql/data"
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-p4ssw0rd}
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||||
POSTGRES_DB: openproject
|
POSTGRES_DB: openproject
|
||||||
networks:
|
networks:
|
||||||
- backend
|
- backend
|
||||||
@ -60,6 +61,9 @@ services:
|
|||||||
- web
|
- web
|
||||||
networks:
|
networks:
|
||||||
- frontend
|
- frontend
|
||||||
|
volumes:
|
||||||
|
- "${OPDATA}:/var/openproject/assets"
|
||||||
|
- "${PGDATA}:/var/openproject/pgdata"
|
||||||
|
|
||||||
web:
|
web:
|
||||||
<<: *app
|
<<: *app
|
||||||
|
@ -17,6 +17,5 @@ DATABASE_URL="postgres://postgres:{{ openproject_database_password }}@db/openpro
|
|||||||
RAILS_MIN_THREADS=4
|
RAILS_MIN_THREADS=4
|
||||||
RAILS_MAX_THREADS=16
|
RAILS_MAX_THREADS=16
|
||||||
|
|
||||||
# The following volumes are default
|
|
||||||
PGDATA="pgdata"
|
PGDATA="pgdata"
|
||||||
OPDATA="opdata"
|
OPDATA="opdata"
|
@ -64,7 +64,8 @@ for filtered_failed_docker_compose_repository in filtered_failed_docker_compose_
|
|||||||
|
|
||||||
if compose_file_path:
|
if compose_file_path:
|
||||||
print("Restarting unhealthy container in:", compose_file_path)
|
print("Restarting unhealthy container in:", compose_file_path)
|
||||||
print_bash(f'cd {os.path.dirname(compose_file_path)} && docker-compose restart')
|
# Propably the cd is not necessary. But in rare cases it could be. To lazzy to test it now.
|
||||||
|
print_bash(f'cd {os.path.dirname(compose_file_path)} && docker-compose -p "{filtered_failed_docker_compose_repository}" restart')
|
||||||
else:
|
else:
|
||||||
print("Error: Docker Compose file not found for:", filtered_failed_docker_compose_repository)
|
print("Error: Docker Compose file not found for:", filtered_failed_docker_compose_repository)
|
||||||
errors += 1
|
errors += 1
|
||||||
|
@ -1,20 +1,30 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
docker_ps_grep_unhealthy="$(docker ps --filter health=unhealthy --format '{{.Names}}')"
|
docker_ps_grep_unhealthy="$(docker ps --filter health=unhealthy --format '{{.Names}}')"
|
||||||
docker_ps_grep_exited="$(docker ps --filter status=exited --format '{{.Names}}')"
|
docker_ps_grep_exited="$(docker ps --filter status=exited --format '{{.ID}}')"
|
||||||
|
|
||||||
exitcode=0
|
exitcode=0
|
||||||
if [ ! -z "$docker_ps_grep_unhealthy" ]
|
|
||||||
then
|
if [ -n "$docker_ps_grep_unhealthy" ]; then
|
||||||
echo "Some docker containers are unhealthy: $docker_ps_grep_unhealthy"
|
echo "Some docker containers are unhealthy: $docker_ps_grep_unhealthy"
|
||||||
exitcode=1
|
exitcode=1
|
||||||
fi
|
fi
|
||||||
if [ ! -z "$docker_ps_grep_exited" ]
|
|
||||||
then
|
if [ -n "$docker_ps_grep_exited" ]; then
|
||||||
echo "Some docker containers exited: $docker_ps_grep_exited"
|
for container_id in $docker_ps_grep_exited
|
||||||
exitcode=2
|
do
|
||||||
|
container_exit_code="$(docker inspect "$container_id" --format='{{.State.ExitCode}}')"
|
||||||
|
container_name="$(docker inspect "$container_id" --format='{{.Name}}')"
|
||||||
|
container_name="${container_name#/}" # Entfernt das führende '/'
|
||||||
|
if [ "$container_exit_code" -ne "0" ]; then
|
||||||
|
echo "Container $container_name exited with code $container_exit_code"
|
||||||
|
exitcode=2
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
if [ "$exitcode" -ne "0" ]
|
|
||||||
then
|
if [ "$exitcode" -ne "0" ]; then
|
||||||
exit $exitcode
|
exit $exitcode
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "All docker containers are healthy."
|
echo "All docker containers are healthy."
|
||||||
exit
|
exit
|
@ -10,7 +10,7 @@ anonymous_volumes=$(docker volume ls --format "{{.Name}}" | grep -E '^[a-f0-9]{6
|
|||||||
|
|
||||||
if [ -z "$anonymous_volumes" ]; then
|
if [ -z "$anonymous_volumes" ]; then
|
||||||
echo "No anonymous volumes found."
|
echo "No anonymous volumes found."
|
||||||
exit $status
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Anonymous volumes found:"
|
echo "Anonymous volumes found:"
|
||||||
@ -41,4 +41,12 @@ for volume in $anonymous_volumes; do
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Additional warning for dangling volumes
|
||||||
|
dangling_volumes=$(docker volume ls -f dangling=true --format "{{.Name}}")
|
||||||
|
if [ -n "$dangling_volumes" ]; then
|
||||||
|
status=2
|
||||||
|
echo "The following dangling volumes were found:"
|
||||||
|
echo "$dangling_volumes"
|
||||||
|
fi
|
||||||
|
|
||||||
exit $status
|
exit $status
|
||||||
|
Loading…
Reference in New Issue
Block a user