wipe: Initial service config

This commit is contained in:
Kacper Donat 2022-10-24 22:16:06 +02:00
parent 2d75338f38
commit 0452e0fd82
5 changed files with 109 additions and 1 deletions

27
services/wipe/config/.env Normal file
View File

@ -0,0 +1,27 @@
APP_ENV=prod
APP_KEY=base64:JUvCdfoHz5Ua1NSjPcIt3V1l/9hShgqjI4VXkUXJFC8=
APP_DEBUG=false
APP_URL=https://wipe.kadet.net
APP_DATABASE=mysql://{{ wipe_database.user }}:{{ wipe_database.password }}@{{ database_mysql_host }}/{{ wipe_database.name }}
BROADCAST_DRIVER=log
CACHE_DRIVER=array
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=35895ef47fc7126f1
MAIL_PASSWORD=f799648da025ad
MAIL_ENCRYPTION=null
PUSHER_KEY=
PUSHER_SECRET=
PUSHER_APP_ID=
STEAM_API_KEY=1E459AF45B31FDFCACA5914F0E3C83DB

66
services/wipe/stack.yml Normal file
View File

@ -0,0 +1,66 @@
version: '{{ compose_version }}'
services:
site:
image: rycus86/podlike
command: -logs -ipc=false
networks: ['{{ ingress_network }}']
deploy:
mode: replicated
replicas: 1
update_config:
parallelism: 1
order: start-first
labels:
- traefik.enable=true
- traefik.http.routers.{{ service }}.rule=Host(`{{ service }}.{{ main_domain }}`)
- traefik.http.routers.{{ service }}.priority=100
- traefik.http.routers.{{ service }}.tls=true
- traefik.http.routers.{{ service }}.tls.certresolver=lets-encrypt
- traefik.http.services.{{ service }}.loadbalancer.server.port=80
restart_policy:
condition: any
max_attempts: 3
labels:
pod.component.fpm: |
image: registry.kadet.net/wipe/php-fpm:{{ wipe_version }}
volumes:
- www-data:/var/www
pod.component.nginx: |
image: nginx:latest
volumes:
- www-data:/var/www
- nginx-config:/etc/nginx/templates
pod.copy.fpm: /var/conf/wipe/.env:/var/www/.env
pod.init.components: |
- image: registry.kadet.net/wipe/php-fpm:{{ wipe_version }}
entrypoint: ["/bin/sh", "-c"]
command: ["cp -r /var/www/* /mnt/www"]
volumes:
- www-data:/mnt/www
- image: registry.kadet.net/wipe/php-fpm:{{ wipe_version }}
entrypoint: ["/bin/sh", "-c"]
command: ["cp -r /var/www/nginx/* /mnt/config"]
volumes:
- nginx-config:/mnt/config
configs:
- source: dotenv_{{ dotenv_file.checksum }}
target: /var/conf/wipe/.env
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- nginx-config:/mnt/nginx-config
- www-data:/mnt/www-data
configs:
dotenv_{{ dotenv_file.checksum }}:
file: ./config/.env
volumes:
nginx-config:
name: {{'nginx-config.{{.Task.ID}}'}}
labels:
com.github.rycus86.podlike.volume-ref: nginx-config
www-data:
name: {{'www-data.{{.Task.ID}}'}}
labels:
com.github.rycus86.podlike.volume-ref: www-data

View File

@ -0,0 +1,8 @@
---
- name: 'Copy .env file for "{{ service }}"'
template:
src: "{{ service_path }}/config/.env"
dest: "{{ remote_service_path }}/config/.env"
register: dotenv_file
tags:
- config

View File

@ -0,0 +1,7 @@
---
wipe_host: https://wipe.kadet.net
wipe_version: latest
wipe_database:
name: wipe
user: wipe
password: "{{ mysql_user_passwords['wipe'] }}"

View File

@ -7,7 +7,7 @@ services: "{{ lookup('pipe', 'ls -1 ' + services_root).split('\n') | list }}"
remote_services_root: /var/services
remote_service_path: "{{ remote_services_root }}/{{ service }}"
compose_version: "3.7"
compose_version: "3.9"
ingress_network: traefik
database_mysql_host: "{{ swarm_host_address }}"