Add pastebin legacy service
This commit is contained in:
parent
4b8b64d893
commit
af3fd29f1f
@ -15,3 +15,8 @@
|
|||||||
loop: "{{ services }}"
|
loop: "{{ services }}"
|
||||||
tags:
|
tags:
|
||||||
- always
|
- 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 }}"
|
user: "{{ ansible_user }}"
|
||||||
groups: docker
|
groups: docker
|
||||||
append: yes
|
append: yes
|
||||||
|
- name: "Add acl package"
|
||||||
|
apt:
|
||||||
|
name: acl
|
||||||
|
state: present
|
||||||
|
|
||||||
- name: Deploy services
|
- name: Deploy services
|
||||||
include_tasks: tasks/deploy.yml
|
import_playbook: deploy.yaml
|
||||||
vars:
|
|
||||||
service: "{{ item }}"
|
|
||||||
loop: "{{ services }}"
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
FROM php:{{ version }}-fpm-alpine
|
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 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
|
source: build
|
||||||
force_source: "{{ dockerfile.changed or update_images|default(false) }}"
|
force_source: "{{ dockerfile.changed or update_images|default(false) }}"
|
||||||
force_tag: "{{ 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/*"
|
with_fileglob: "{{ service_path }}/sites/*"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: file
|
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:
|
tags:
|
||||||
- config
|
- config
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
- name: Add users to www-data group
|
- name: Add users to www-data group
|
||||||
user:
|
user:
|
||||||
user: "{{ user }}"
|
user: "{{ user }}"
|
||||||
groups: docker
|
groups: www-data
|
||||||
append: yes
|
append: yes
|
||||||
loop: "{{ www_data_users }}"
|
loop: "{{ www_data_users }}"
|
||||||
loop_control:
|
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:
|
community.docker.docker_stack:
|
||||||
name: "{{ service }}"
|
name: "{{ service }}"
|
||||||
prune: yes
|
prune: yes
|
||||||
|
resolve_image: "always"
|
||||||
compose:
|
compose:
|
||||||
- "{{ remote_service_path }}/stack.yml"
|
- "{{ remote_service_path }}/stack.yml"
|
||||||
- version: "{{ compose_version }}"
|
- version: "{{ compose_version }}"
|
||||||
networks: "{{ dict(swarm_global_networks | map(attribute='name') | zip_longest([], fillvalue={ 'external': True })) }}"
|
networks: "{{ dict(swarm_global_networks | map(attribute='name') | zip_longest([], fillvalue={ 'external': True })) }}"
|
||||||
|
register: stack
|
||||||
tags:
|
tags:
|
||||||
- deploy
|
- 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 }}"
|
database_mysql_host: "{{ swarm_host_address }}"
|
||||||
|
|
||||||
|
services_to_restart: []
|
||||||
|
|
||||||
service_config:
|
service_config:
|
||||||
traefik:
|
traefik:
|
||||||
dashboard_users:
|
dashboard_users:
|
||||||
@ -35,3 +37,6 @@ service_config:
|
|||||||
|
|
||||||
legacy:
|
legacy:
|
||||||
www_data_users: ["{{ ansible_user }}"]
|
www_data_users: ["{{ ansible_user }}"]
|
||||||
|
|
||||||
|
www_data_users:
|
||||||
|
- vagrant
|
||||||
|
Loading…
Reference in New Issue
Block a user