Add game-thumbs container
This commit is contained in:
22
ansible/roles/game-thumbs/tasks/main.yml
Normal file
22
ansible/roles/game-thumbs/tasks/main.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
- name: Create install directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ install_directory }}/{{ role_name }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ docker_user }}"
|
||||||
|
mode: "{{ docker_compose_directory_mask }}"
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Copy docker-compose file to destination
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: docker-compose.yml
|
||||||
|
dest: "{{ install_directory }}/{{ role_name }}/docker-compose.yml"
|
||||||
|
owner: "{{ docker_user }}"
|
||||||
|
mode: "{{ docker_compose_file_mask }}"
|
||||||
|
validate: docker compose -f %s config
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Start docker container
|
||||||
|
community.docker.docker_compose_v2:
|
||||||
|
project_src: "{{ install_directory }}/{{ role_name }}"
|
||||||
|
pull: always
|
||||||
|
remove_orphans: yes
|
||||||
31
ansible/roles/game-thumbs/templates/docker-compose.yml
Normal file
31
ansible/roles/game-thumbs/templates/docker-compose.yml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
services:
|
||||||
|
game-thumbs:
|
||||||
|
image: ghcr.io/sethwv/game-thumbs:latest
|
||||||
|
container_name: game-thumbs
|
||||||
|
restart: unless-stopped
|
||||||
|
labels:
|
||||||
|
- "autoheal=true"
|
||||||
|
ports:
|
||||||
|
- 3050:3050
|
||||||
|
environment:
|
||||||
|
PORT: 3050
|
||||||
|
NODE_ENV: ${NODE_ENV:-production}
|
||||||
|
SHOW_TIMESTAMP: ${SHOW_TIMESTAMP:-true}
|
||||||
|
LOG_TO_FILE: ${LOG_TO_FILE:-false}
|
||||||
|
MAX_LOG_FILES: ${MAX_LOG_FILES:-10}
|
||||||
|
volumes:
|
||||||
|
- "{{ data_dir }}/game-thumbs/cache:/app/.cache
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3050/health', (r) => {let d='';r.on('data', (c) => d+=c);r.on('end', () => {if (r.statusCode !== 200) process.exit(1);const j=JSON.parse(d);process.exit(j.status==='ok'?0:1)})}).on('error', () => process.exit(1))"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 5s
|
||||||
|
start_period: 10s
|
||||||
|
retries: 3
|
||||||
|
autoheal:
|
||||||
|
image: willfarrell/autoheal:latest
|
||||||
|
container_name: autoheal
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
environment:
|
||||||
|
AUTOHEAL_CONTAINER_LABEL: "autoheal"
|
||||||
Reference in New Issue
Block a user