diff --git a/services/wipe/config/.env b/services/wipe/config/.env new file mode 100644 index 0000000..667202b --- /dev/null +++ b/services/wipe/config/.env @@ -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 diff --git a/services/wipe/stack.yml b/services/wipe/stack.yml new file mode 100644 index 0000000..975cfc4 --- /dev/null +++ b/services/wipe/stack.yml @@ -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 diff --git a/services/wipe/tasks/config.yml b/services/wipe/tasks/config.yml new file mode 100644 index 0000000..7c1c505 --- /dev/null +++ b/services/wipe/tasks/config.yml @@ -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 diff --git a/services/wipe/vars/main.yml b/services/wipe/vars/main.yml new file mode 100644 index 0000000..d3c4ab8 --- /dev/null +++ b/services/wipe/vars/main.yml @@ -0,0 +1,7 @@ +--- +wipe_host: https://wipe.kadet.net +wipe_version: latest +wipe_database: + name: wipe + user: wipe + password: "{{ mysql_user_passwords['wipe'] }}" diff --git a/vars/services.yml b/vars/services.yml index 8a098af..5aefc26 100644 --- a/vars/services.yml +++ b/vars/services.yml @@ -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 }}"