mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-22 20:51:07 +01:00
Compare commits
No commits in common. "c2fe8a95c0b9c4b204f4b5b8f0c9e222c1c26f34" and "d1b2d8e6537f5b4beeefe3a9381a6795554e8a79" have entirely different histories.
c2fe8a95c0
...
d1b2d8e653
@ -2,6 +2,18 @@
|
|||||||
- 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 }}"
|
||||||
@ -9,18 +21,6 @@
|
|||||||
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,8 +27,7 @@ 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}:/var/openproject/assets"
|
- "${OPDATA:-opdata}:/var/openproject/assets"
|
||||||
- "${PGDATA}:/var/openproject/pgdata"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
@ -36,9 +35,9 @@ services:
|
|||||||
<<: *restart_policy
|
<<: *restart_policy
|
||||||
stop_grace_period: "3s"
|
stop_grace_period: "3s"
|
||||||
volumes:
|
volumes:
|
||||||
- "${PGDATA}:/var/lib/postgresql/data"
|
- "${PGDATA:-pgdata}:/var/lib/postgresql/data"
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-p4ssw0rd}
|
||||||
POSTGRES_DB: openproject
|
POSTGRES_DB: openproject
|
||||||
networks:
|
networks:
|
||||||
- backend
|
- backend
|
||||||
@ -61,9 +60,6 @@ services:
|
|||||||
- web
|
- web
|
||||||
networks:
|
networks:
|
||||||
- frontend
|
- frontend
|
||||||
volumes:
|
|
||||||
- "${OPDATA}:/var/openproject/assets"
|
|
||||||
- "${PGDATA}:/var/openproject/pgdata"
|
|
||||||
|
|
||||||
web:
|
web:
|
||||||
<<: *app
|
<<: *app
|
||||||
|
@ -17,5 +17,6 @@ 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,8 +64,7 @@ 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)
|
||||||
# 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 restart')
|
||||||
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,30 +1,20 @@
|
|||||||
#!/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 '{{.ID}}')"
|
docker_ps_grep_exited="$(docker ps --filter status=exited --format '{{.Names}}')"
|
||||||
|
|
||||||
exitcode=0
|
exitcode=0
|
||||||
|
if [ ! -z "$docker_ps_grep_unhealthy" ]
|
||||||
if [ -n "$docker_ps_grep_unhealthy" ]; then
|
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" ]
|
||||||
if [ -n "$docker_ps_grep_exited" ]; then
|
then
|
||||||
for container_id in $docker_ps_grep_exited
|
echo "Some docker containers exited: $docker_ps_grep_exited"
|
||||||
do
|
exitcode=2
|
||||||
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" ]
|
||||||
if [ "$exitcode" -ne "0" ]; then
|
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
|
exit $status
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Anonymous volumes found:"
|
echo "Anonymous volumes found:"
|
||||||
@ -41,12 +41,4 @@ 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