Add pastebin legacy service
This commit is contained in:
parent
4b8b64d893
commit
af3fd29f1f
@ -15,3 +15,8 @@
|
||||
loop: "{{ services }}"
|
||||
tags:
|
||||
- always
|
||||
|
||||
handlers:
|
||||
- name: Restart services
|
||||
loop: "{{ services_to_restart | unique }}"
|
||||
shell: "docker service update {{ item }} --force"
|
||||
|
11
init.yaml
11
init.yaml
@ -19,9 +19,10 @@
|
||||
user: "{{ ansible_user }}"
|
||||
groups: docker
|
||||
append: yes
|
||||
- name: "Add acl package"
|
||||
apt:
|
||||
name: acl
|
||||
state: present
|
||||
|
||||
- name: Deploy services
|
||||
include_tasks: tasks/deploy.yml
|
||||
vars:
|
||||
service: "{{ item }}"
|
||||
loop: "{{ services }}"
|
||||
- name: Deploy services
|
||||
import_playbook: deploy.yaml
|
||||
|
@ -1,5 +1,9 @@
|
||||
FROM php:{{ version }}-fpm-alpine
|
||||
|
||||
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||
LABEL maintainer="Kacper Donat <kacper@kadet.net>"
|
||||
|
||||
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
|
||||
RUN install-php-extensions {{ php_extensions|join(" ") }}
|
||||
|
||||
RUN apk update && apk add acl
|
||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||
|
19
services/legacy/sites/pastebin.conf
Normal file
19
services/legacy/sites/pastebin.conf
Normal file
@ -0,0 +1,19 @@
|
||||
server {
|
||||
listen 80;
|
||||
root /var/www/pastebin/current/web/;
|
||||
server_name bin.{{ main_domain }};
|
||||
|
||||
index index.php;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
}
|
||||
|
||||
# pass the PHP scripts to FastCGI server listening on php-71:9000 x
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass php-71:9000;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
@ -19,3 +19,10 @@
|
||||
source: build
|
||||
force_source: "{{ dockerfile.changed or update_images|default(false) }}"
|
||||
force_tag: "{{ dockerfile.changed or update_images|default(false) }}"
|
||||
register: image
|
||||
notify: Restart services
|
||||
|
||||
- name: "Restart services if needed"
|
||||
when: image.changed
|
||||
set_fact:
|
||||
services_to_restart: "{{ services_to_restart + ['legacy_php-' + version|replace('.', '')] }}"
|
||||
|
@ -14,6 +14,16 @@
|
||||
with_fileglob: "{{ service_path }}/sites/*"
|
||||
loop_control:
|
||||
loop_var: file
|
||||
notify:
|
||||
- Restart services
|
||||
tags:
|
||||
- config
|
||||
register: legacy_sites
|
||||
|
||||
- name: Force nginx restart after play
|
||||
set_fact:
|
||||
services_to_restart: "{{ services_to_restart + ['legacy_nginx'] }}"
|
||||
when: legacy_sites.changed
|
||||
tags:
|
||||
- config
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
- name: Add users to www-data group
|
||||
user:
|
||||
user: "{{ user }}"
|
||||
groups: docker
|
||||
groups: www-data
|
||||
append: yes
|
||||
loop: "{{ www_data_users }}"
|
||||
loop_control:
|
||||
|
6
services/traefik/config/dynamic/pastebin.yaml
Normal file
6
services/traefik/config/dynamic/pastebin.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
http:
|
||||
routers:
|
||||
pastebin:
|
||||
rule: Host(`bin.{{ main_domain }}`)
|
||||
service: legacy@docker
|
@ -45,10 +45,16 @@
|
||||
community.docker.docker_stack:
|
||||
name: "{{ service }}"
|
||||
prune: yes
|
||||
resolve_image: "always"
|
||||
compose:
|
||||
- "{{ remote_service_path }}/stack.yml"
|
||||
- version: "{{ compose_version }}"
|
||||
networks: "{{ dict(swarm_global_networks | map(attribute='name') | zip_longest([], fillvalue={ 'external': True })) }}"
|
||||
register: stack
|
||||
tags:
|
||||
- deploy
|
||||
|
||||
- name: "Mark updated services as restarted"
|
||||
set_fact:
|
||||
services_to_restart: "{{ services_to_restart | difference((stack.stack_spec_diff | default('{}') | from_json).keys()) }}"
|
||||
|
||||
|
@ -15,6 +15,8 @@ main_domain: kadet.local
|
||||
|
||||
database_mysql_host: "{{ swarm_host_address }}"
|
||||
|
||||
services_to_restart: []
|
||||
|
||||
service_config:
|
||||
traefik:
|
||||
dashboard_users:
|
||||
@ -35,3 +37,6 @@ service_config:
|
||||
|
||||
legacy:
|
||||
www_data_users: ["{{ ansible_user }}"]
|
||||
|
||||
www_data_users:
|
||||
- vagrant
|
||||
|
Loading…
Reference in New Issue
Block a user