add Booklore Container
This commit is contained in:
parent
0b8c5754f3
commit
8ff70bfaad
8 changed files with 113 additions and 1 deletions
|
@ -46,3 +46,8 @@
|
||||||
tags:
|
tags:
|
||||||
- lldap
|
- lldap
|
||||||
- docker-container
|
- docker-container
|
||||||
|
|
||||||
|
- role: deploy_container_booklore
|
||||||
|
tags:
|
||||||
|
- booklore
|
||||||
|
- docker-container
|
||||||
|
|
6
roles/deploy_container_booklore/defaults/main.yml
Normal file
6
roles/deploy_container_booklore/defaults/main.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
container_booklore_version: latest
|
||||||
|
container_booklore_domain: booklore.example.com
|
||||||
|
container_booklore_directory: /opt/docker/booklore
|
||||||
|
container_booklore_db_root_password: super_duper_secret_root_password
|
||||||
|
container_booklore_db_user: db_user
|
||||||
|
container_booklore_db_password: super_secret_password
|
0
roles/deploy_container_booklore/handlers/main.yml
Normal file
0
roles/deploy_container_booklore/handlers/main.yml
Normal file
0
roles/deploy_container_booklore/meta/main.yml
Normal file
0
roles/deploy_container_booklore/meta/main.yml
Normal file
28
roles/deploy_container_booklore/tasks/main.yml
Normal file
28
roles/deploy_container_booklore/tasks/main.yml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
---
|
||||||
|
- name: Ensure data directories exist
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ container_booklore_directory }}/data/{{ item }}"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
loop:
|
||||||
|
- "app"
|
||||||
|
- "books"
|
||||||
|
- "db"
|
||||||
|
become: false
|
||||||
|
|
||||||
|
- name: Deploy Docker Compose and .env files
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: "{{ item.src }}"
|
||||||
|
dest: "{{ container_booklore_directory }}/{{ item.dest }}"
|
||||||
|
mode: '0644'
|
||||||
|
loop:
|
||||||
|
- { src: 'docker-compose.yml.j2', dest: 'docker-compose.yml' }
|
||||||
|
- { src: '.env.j2', dest: '.env' }
|
||||||
|
become: false
|
||||||
|
|
||||||
|
- name: Start Container
|
||||||
|
community.docker.docker_compose_v2:
|
||||||
|
project_src: "{{ container_booklore_directory }}"
|
||||||
|
pull: always
|
||||||
|
docker_host: "unix:///run/user/1000/docker.sock"
|
||||||
|
become: false
|
10
roles/deploy_container_booklore/templates/.env.j2
Normal file
10
roles/deploy_container_booklore/templates/.env.j2
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# Booklore Version (Standard: latest) # Excalidraw Version (Standard: latest)
|
||||||
|
BOOKLORE_VERSION={{ container_booklore_version }}
|
||||||
|
|
||||||
|
# Booklore Domain
|
||||||
|
BOOKLORE_DOMAIN={{ container_booklore_domain }}
|
||||||
|
|
||||||
|
# Booklore DB
|
||||||
|
BOOKLORE_DB_ROOT_PASSWORD={{ container_booklore_db_root_password }}
|
||||||
|
BOOKLORE_DB_USER={{ container_booklore_db_user }}
|
||||||
|
BOOKLORE_DB_PASSWORD={{ container_booklore_db_password }}
|
|
@ -0,0 +1,63 @@
|
||||||
|
---
|
||||||
|
services:
|
||||||
|
booklore:
|
||||||
|
image: ghcr.io/adityachandelgit/booklore-app:${BOOKLORE_VERSION:-latest}
|
||||||
|
container_name: booklore
|
||||||
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
mariadb:
|
||||||
|
condition: service_healthy
|
||||||
|
networks:
|
||||||
|
- traefik
|
||||||
|
- booklore
|
||||||
|
volumes:
|
||||||
|
- ./data/app:/app/data
|
||||||
|
- ./data/books:/books
|
||||||
|
environment:
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
|
- TZ=Europe/Berlin
|
||||||
|
- DATABASE_URL=jdbc:mariadb://mariadb:3306/booklore
|
||||||
|
- DATABASE_USERNAME=${BOOKLORE_DB_USER:-booklore}
|
||||||
|
- DATABASE_PASSWORD=${BOOKLORE_DB_PASSWORD}
|
||||||
|
- SWAGGER_ENABLED=false
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.docker.network=traefik"
|
||||||
|
- "traefik.http.routers.booklore.entrypoints=http"
|
||||||
|
- "traefik.http.routers.booklore.rule=Host(`${BOOKLORE_DOMAIN:?error}`)"
|
||||||
|
- "traefik.http.middlewares.booklore-https-redirect.redirectscheme.scheme=https"
|
||||||
|
- "traefik.http.routers.booklore.middlewares=booklore-https-redirect"
|
||||||
|
- "traefik.http.routers.booklore-secure.entrypoints=https"
|
||||||
|
- "traefik.http.routers.booklore-secure.rule=Host(`${BOOKLORE_DOMAIN:?error}`)"
|
||||||
|
- "traefik.http.routers.booklore-secure.tls=true"
|
||||||
|
- "traefik.http.routers.booklore-secure.service=booklore"
|
||||||
|
- "traefik.http.services.booklore.loadbalancer.server.port=6060"
|
||||||
|
|
||||||
|
mariadb:
|
||||||
|
image: lscr.io/linuxserver/mariadb:11.4.5
|
||||||
|
container_name: mariadb
|
||||||
|
networks:
|
||||||
|
- booklore
|
||||||
|
environment:
|
||||||
|
- PUID=1000
|
||||||
|
- PGID=1000
|
||||||
|
- TZ=Etc/UTC
|
||||||
|
- MYSQL_ROOT_PASSWORD=${BOOKLORE_DB_ROOT_PASSWORD}
|
||||||
|
- MYSQL_DATABASE=booklore
|
||||||
|
- MYSQL_USER=${BOOKLORE_DB_USER:-booklore}
|
||||||
|
- MYSQL_PASSWORD=${BOOKLORE_DB_PASSWORD}
|
||||||
|
volumes:
|
||||||
|
- ./data/db:/config
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "mariadb-admin", "ping", "-h", "localhost"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 10
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
||||||
|
booklore:
|
||||||
|
driver: bridge
|
0
roles/deploy_container_booklore/vars/main.yml
Normal file
0
roles/deploy_container_booklore/vars/main.yml
Normal file
Loading…
Add table
Reference in a new issue