Deploy homepage to replicant
This commit is contained in:
parent
8ae030c00a
commit
e8d2cd68a0
2 changed files with 89 additions and 0 deletions
27
compose-files/replicant/homepage/docker-compose.yml
Normal file
27
compose-files/replicant/homepage/docker-compose.yml
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
services:
|
||||||
|
homepage:
|
||||||
|
image: ghcr.io/gethomepage/homepage:latest
|
||||||
|
container_name: homepage
|
||||||
|
environment:
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
|
- HOMEPAGE_ALLOWED_HOSTS=192.168.1.80:3305,home.3ddbrewery.com,*
|
||||||
|
volumes:
|
||||||
|
- ./config:/app/config
|
||||||
|
ports:
|
||||||
|
- "3305:3000"
|
||||||
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- proxy
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 512M
|
||||||
|
cpus: '1.0'
|
||||||
|
labels:
|
||||||
|
- "autoheal=true"
|
||||||
|
- "com.centurylinklabs.watchtower.enable=true"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
proxy:
|
||||||
|
external: true
|
||||||
62
playbooks/deploy-homepage.yml
Normal file
62
playbooks/deploy-homepage.yml
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
---
|
||||||
|
- name: Deploy Homepage to replicant
|
||||||
|
hosts: replicant
|
||||||
|
vars:
|
||||||
|
service_name: homepage
|
||||||
|
service_dir: "{{ docker_appdata }}/{{ service_name }}"
|
||||||
|
compose_src: "{{ playbook_dir }}/../compose-files/replicant/{{ service_name }}"
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Create service directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ service_dir }}"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy docker-compose.yml
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ compose_src }}/docker-compose.yml"
|
||||||
|
dest: "{{ service_dir }}/docker-compose.yml"
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Create config directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ service_dir }}/config"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Pull latest image
|
||||||
|
community.docker.docker_image:
|
||||||
|
name: ghcr.io/gethomepage/homepage:latest
|
||||||
|
source: pull
|
||||||
|
force_source: yes
|
||||||
|
|
||||||
|
- name: Deploy Homepage
|
||||||
|
community.docker.docker_compose_v2:
|
||||||
|
project_src: "{{ service_dir }}"
|
||||||
|
state: present
|
||||||
|
pull: missing
|
||||||
|
register: deploy_result
|
||||||
|
|
||||||
|
- name: Show deployment result
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "Homepage deployed: {{ deploy_result.changed }}"
|
||||||
|
|
||||||
|
- name: Wait for container to be healthy
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
for i in {1..30}; do
|
||||||
|
status=$(docker inspect --format='{{ "{{" }}.State.Health.Status{{ "}}" }}' homepage 2>/dev/null || echo "starting")
|
||||||
|
if [ "$status" = "healthy" ]; then
|
||||||
|
echo "Container is healthy"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
echo "Warning: Container not healthy after 60s"
|
||||||
|
docker logs homepage 2>&1 | tail -20
|
||||||
|
register: health_check
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Display health status
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: "{{ health_check.stdout }}"
|
||||||
Loading…
Reference in a new issue