chore: added wordpress (wip)
parent
0e9c26e439
commit
736c89b6c1
@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
wordpress_mysql_root_password: "wordpress-mysql-root-password"
|
||||||
|
wordpress_mysql_database: "wordpress-mysql"
|
||||||
|
wordpress_mysql_username: "wordpress-mysql-admin"
|
||||||
|
wordpress_mysql_password: "wordpress-mysql-admin"
|
||||||
|
|
||||||
|
wordpress_domain_external: "{{ http_s }}://{{ stage_server_url_host }}"
|
||||||
|
|
||||||
|
wordpress_client_id: "{{ cluster_name }}"
|
||||||
|
wordpress_buergerportal_username: "wordpress-admin"
|
||||||
|
wordpress_buergerportal_password: "wordpress-admin"
|
||||||
|
|
||||||
|
current_realm_users: [
|
||||||
|
{
|
||||||
|
"username": "{{ wordpress_buergerportal_username }}",
|
||||||
|
"password": "{{ wordpress_buergerportal_password }}",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
current_realm_clients: [
|
||||||
|
{
|
||||||
|
clientId: "{{ wordpress_client_id }}",
|
||||||
|
name: '{{ wordpress_client_id }}',
|
||||||
|
admin_url: '',
|
||||||
|
root_url: '',
|
||||||
|
redirect_uris: '
|
||||||
|
[
|
||||||
|
"https://{{ service_name }}.{{ domain }}/*",
|
||||||
|
]',
|
||||||
|
secret: '{{ cluster_name }}',
|
||||||
|
web_origins: '
|
||||||
|
[
|
||||||
|
"https://{{ service_name }}.{{ domain }}/*",
|
||||||
|
]',
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
wordpress_oidc_client_id: "{{ wordpress_client_id }}"
|
||||||
|
wordpress_oidc_client_secret: "{{ cluster_name }}"
|
||||||
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
connect_postgres_service_name: "{{ service_name }}-connectpostgres"
|
|
||||||
|
|
||||||
connect_postgres_version: "12"
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
connect_postgres_id: "{{ service_name }}-postgres-connect"
|
|
||||||
|
|
||||||
connect_docker: {
|
|
||||||
networks: [
|
|
||||||
{
|
|
||||||
name: back-tier,
|
|
||||||
external: true,
|
|
||||||
}
|
|
||||||
],
|
|
||||||
volumes: [
|
|
||||||
{
|
|
||||||
name: "{{ connect_postgres_id }}-data"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
services: [
|
|
||||||
{
|
|
||||||
name: "{{ connect_postgres_id }}",
|
|
||||||
image_name: "postgres",
|
|
||||||
image_version: "{{ connect_postgres_version }}",
|
|
||||||
environment: [
|
|
||||||
'POSTGRES_DB: "{{ connect_postgres_database }}"',
|
|
||||||
'POSTGRES_USER: "{{ connect_postgres_admin_username }}"',
|
|
||||||
'POSTGRES_PASSWORD: "{{ connect_postgres_admin_password }}"',
|
|
||||||
],
|
|
||||||
volumes: [
|
|
||||||
'"{{ connect_postgres_id }}-data:/var/lib/postgresql/data"',
|
|
||||||
],
|
|
||||||
networks: [
|
|
||||||
'"back-tier"',
|
|
||||||
],
|
|
||||||
ports: "{{ connect_postgres_ports | default([]) }}",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
postgres_image_name: "postgres"
|
||||||
|
postgres_image_version: "12"
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
postgres_id: "{{ service_name }}-postgres_{{ cluster_service }}"
|
||||||
|
|
||||||
|
postgres_docker: {
|
||||||
|
networks: [
|
||||||
|
{
|
||||||
|
name: back-tier,
|
||||||
|
external: true,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
volumes: [
|
||||||
|
{
|
||||||
|
name: "{{ postgres_id }}-data"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
services: [
|
||||||
|
{
|
||||||
|
name: "{{ postgres_id }}",
|
||||||
|
image_name: "{{ postgres_image_name }}",
|
||||||
|
image_version: "{{ postgres_image_version }}",
|
||||||
|
environment: [
|
||||||
|
"POSTGRES_DB: \"{{ hostvars[inventory_hostname][cluster_service + '_postgres_database'] | default('postgres') }}\"",
|
||||||
|
"POSTGRES_USER: \"{{ hostvars[inventory_hostname][cluster_service + '_postgres_admin_username'] | default('postgres-admin') }}\"",
|
||||||
|
"POSTGRES_PASSWORD: \"{{ hostvars[inventory_hostname][cluster_service + '_postgres_admin_password'] | default('postgres-admin') }}\"",
|
||||||
|
],
|
||||||
|
volumes: [
|
||||||
|
'"{{ postgres_id }}-data:/var/lib/postgresql/data"',
|
||||||
|
],
|
||||||
|
networks: [
|
||||||
|
'"back-tier"',
|
||||||
|
],
|
||||||
|
ports: "{{ postgres_ports | default([]) }}",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
wordpress_image_name: "wordpress"
|
||||||
|
wordpress_image_version: '5.7.2'
|
||||||
|
|
||||||
|
wordpress_mysql_image_name: "mysql"
|
||||||
|
wordpress_mysql_image_version: "8.0.22"
|
||||||
|
|
||||||
|
wordpress_admin_username: "wordpress-admin"
|
||||||
|
wordpress_admin_password: "wordpress-admin"
|
||||||
@ -0,0 +1 @@
|
|||||||
|
---
|
||||||
@ -0,0 +1 @@
|
|||||||
|
---
|
||||||
@ -0,0 +1,108 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
### tags:
|
||||||
|
### update_deployment
|
||||||
|
|
||||||
|
- name: "Send mattermost message"
|
||||||
|
uri:
|
||||||
|
url: "{{ mattermost_hook_smardigo }}"
|
||||||
|
method: POST
|
||||||
|
body: "{{ lookup('template','mattermost-deploy-start.json.j2') }}"
|
||||||
|
body_format: json
|
||||||
|
headers:
|
||||||
|
Content-Type: "application/json"
|
||||||
|
delegate_to: 127.0.0.1
|
||||||
|
become: false
|
||||||
|
when:
|
||||||
|
- send_status_messages
|
||||||
|
|
||||||
|
- name: "Setup DNS configuration for {{ wordpress_id }}"
|
||||||
|
include_role:
|
||||||
|
name: _digitalocean
|
||||||
|
tasks_from: domain
|
||||||
|
vars:
|
||||||
|
record_data: "{{ stage_server_ip }}"
|
||||||
|
record_name: "{{ service_name }}"
|
||||||
|
|
||||||
|
- name: "Check if {{ wordpress_id }}/docker-compose.yml exists"
|
||||||
|
stat:
|
||||||
|
path: '{{ service_base_path }}/{{ wordpress_id }}/docker-compose.yml'
|
||||||
|
register: check_docker_compose_file
|
||||||
|
tags:
|
||||||
|
- update_deployment
|
||||||
|
|
||||||
|
- name: "Stop {{ wordpress_id }}"
|
||||||
|
shell: docker-compose down
|
||||||
|
args:
|
||||||
|
chdir: '{{ service_base_path }}/{{ wordpress_id }}'
|
||||||
|
when: check_docker_compose_file.stat.exists
|
||||||
|
ignore_errors: yes
|
||||||
|
tags:
|
||||||
|
- update_deployment
|
||||||
|
|
||||||
|
- name: "Deploy docker templates for {{ wordpress_id }}"
|
||||||
|
include_role:
|
||||||
|
name: _deploy
|
||||||
|
tasks_from: templates
|
||||||
|
vars:
|
||||||
|
current_config: "_docker"
|
||||||
|
current_base_path: "{{ service_base_path }}"
|
||||||
|
current_destination: "{{ wordpress_id }}"
|
||||||
|
current_owner: "{{ docker_owner }}"
|
||||||
|
current_group: "{{ docker_group }}"
|
||||||
|
current_docker: "{{ wordpress_docker }}"
|
||||||
|
|
||||||
|
- name: "Deploy service templates for {{ wordpress_id }}"
|
||||||
|
include_role:
|
||||||
|
name: _deploy
|
||||||
|
tasks_from: templates
|
||||||
|
vars:
|
||||||
|
current_config: "wordpress"
|
||||||
|
current_base_path: "{{ service_base_path }}"
|
||||||
|
current_destination: "{{ wordpress_id }}"
|
||||||
|
current_owner: "{{ docker_owner }}"
|
||||||
|
current_group: "{{ docker_group }}"
|
||||||
|
|
||||||
|
- name: "Update {{ wordpress_id }}"
|
||||||
|
shell: docker-compose pull
|
||||||
|
args:
|
||||||
|
chdir: '{{ service_base_path }}/{{ wordpress_id }}'
|
||||||
|
tags:
|
||||||
|
- update_deployment
|
||||||
|
|
||||||
|
- name: "Start {{ wordpress_id }}"
|
||||||
|
shell: docker-compose up -d
|
||||||
|
args:
|
||||||
|
chdir: '{{ service_base_path }}/{{ wordpress_id }}'
|
||||||
|
tags:
|
||||||
|
- update_deployment
|
||||||
|
|
||||||
|
- name: "Update landing page entries for {{ wordpress_id }}"
|
||||||
|
include_role:
|
||||||
|
name: _deploy
|
||||||
|
tasks_from: caddy_landing_page
|
||||||
|
vars:
|
||||||
|
current_services: [
|
||||||
|
{
|
||||||
|
current_name: "{{ wordpress_id }}",
|
||||||
|
current_url: "{{ http_s }}://{{ wordpress_id }}.{{ domain }}",
|
||||||
|
current_version: "{{ wordpress_image_version }}",
|
||||||
|
current_date: "{{ ansible_date_time.iso8601 }}",
|
||||||
|
management: "{{ http_s }}://{{ wordpress_id }}.{{ domain }}:{{ monitor_port_service }}/management",
|
||||||
|
},
|
||||||
|
]
|
||||||
|
tags:
|
||||||
|
- update_deployment
|
||||||
|
|
||||||
|
- name: "Send mattermost messsge"
|
||||||
|
uri:
|
||||||
|
url: "{{ mattermost_hook_smardigo }}"
|
||||||
|
method: POST
|
||||||
|
body: "{{ lookup('template','mattermost-deploy-end.json.j2') }}"
|
||||||
|
body_format: json
|
||||||
|
headers:
|
||||||
|
Content-Type: "application/json"
|
||||||
|
delegate_to: 127.0.0.1
|
||||||
|
become: false
|
||||||
|
when:
|
||||||
|
- send_status_messages
|
||||||
@ -0,0 +1,88 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
wordpress_id: "{{ service_name }}-wordpress"
|
||||||
|
wordpress_mysql_id: "{{ service_name }}-mysql_wordpress"
|
||||||
|
|
||||||
|
wordpress_labels: [
|
||||||
|
'"traefik.enable=true"',
|
||||||
|
'"traefik.http.routers.{{ wordpress_id }}.service={{ wordpress_id }}"',
|
||||||
|
'"traefik.http.routers.{{ wordpress_id }}.rule=Host(`{{ stage_server_url_host }}`)"',
|
||||||
|
'"traefik.http.routers.{{ wordpress_id }}.entrypoints=websecure"',
|
||||||
|
'"traefik.http.routers.{{ wordpress_id }}.tls=true"',
|
||||||
|
'"traefik.http.routers.{{ wordpress_id }}.tls.certresolver=letsencrypt"',
|
||||||
|
'"traefik.http.services.{{ wordpress_id }}.loadbalancer.server.port=80"',
|
||||||
|
]
|
||||||
|
|
||||||
|
wordpress_docker: {
|
||||||
|
networks: [
|
||||||
|
{
|
||||||
|
name: back-tier,
|
||||||
|
external: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: front-tier,
|
||||||
|
external: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
volumes: [
|
||||||
|
{
|
||||||
|
name: "{{ wordpress_id }}-content"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "{{ wordpress_mysql_id }}-data"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
services: [
|
||||||
|
{
|
||||||
|
name: "{{ wordpress_id }}",
|
||||||
|
image_name: "{{ wordpress_image_name }}",
|
||||||
|
image_version: "{{ wordpress_image_version }}",
|
||||||
|
labels: "{{ wordpress_labels + ( wordpress_labels_additional | default([])) }}",
|
||||||
|
environment: [
|
||||||
|
"WORDPRESS_DB_HOST: \"{{ wordpress_mysql_id }}:{{ service_port_mysql }}\"",
|
||||||
|
"WORDPRESS_DB_USER: \"{{ wordpress_mysql_username }}\"",
|
||||||
|
"WORDPRESS_DB_PASSWORD: \"{{ wordpress_mysql_password }}\"",
|
||||||
|
"WORDPRESS_DB_NAME: \"{{ wordpress_mysql_database }}\"",
|
||||||
|
"WORDPRESS_DEBUG: \"{{ wordpress_debug | default(1) }}\"",
|
||||||
|
"WORDPRESS_DOMAIN: \"{{ wordpress_domain_external }}\"",
|
||||||
|
"WORDPRESS_CONFIG_EXTRA: |",
|
||||||
|
" define( 'WP_HOME', 'https://dev-sken-test04-01.smardigo.digital' );",
|
||||||
|
" define( 'WP_SITEURL', 'https://dev-sken-test04-01.smardigo.digital' );",
|
||||||
|
"AUTH_API: \"{{ http_s }}://{{ shared_service_keycloak_hostname }}\"",
|
||||||
|
"RESOURCE_API: \"{{ http_s }}://{{ stage_server_url_host }}\"",
|
||||||
|
"REALM_ID: \"{{ current_realm_name }}\"",
|
||||||
|
"REGISTRATION_ID: \"{{ wordpress_oidc_client_id }}\"",
|
||||||
|
"CLIENT_ID: \"{{ wordpress_oidc_client_id }}\"",
|
||||||
|
"CLIENT_SECRET: \"{{ wordpress_oidc_client_secret }}\"",
|
||||||
|
"CLIENT_USERNAME: \"{{ wordpress_buergerportal_username }}\"",
|
||||||
|
"CLIENT_PASSWORD: \"{{ wordpress_buergerportal_password }}\"",
|
||||||
|
],
|
||||||
|
volumes: [
|
||||||
|
'"{{ wordpress_id }}-content:/var/www/html/wp-content"',
|
||||||
|
],
|
||||||
|
networks: [
|
||||||
|
'"back-tier"',
|
||||||
|
'"front-tier"',
|
||||||
|
],
|
||||||
|
extra_hosts: "{{ wordpress_extra_hosts | default([]) }}",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "{{ wordpress_mysql_id }}",
|
||||||
|
image_name: "{{ wordpress_mysql_image_name }}",
|
||||||
|
image_version: "{{ wordpress_mysql_image_version }}",
|
||||||
|
environment: [
|
||||||
|
"MYSQL_ROOT_PASSWORD: \"{{ wordpress_mysql_root_password }}\"",
|
||||||
|
"MYSQL_DATABASE: \"{{ wordpress_mysql_database }}\"",
|
||||||
|
"MYSQL_USER: \"{{ wordpress_mysql_username }}\"",
|
||||||
|
"MYSQL_PASSWORD: \"{{ wordpress_mysql_password }}\"",
|
||||||
|
],
|
||||||
|
volumes: [
|
||||||
|
'"{{ wordpress_mysql_id }}-data:/var/lib/mysql"',
|
||||||
|
],
|
||||||
|
networks: [
|
||||||
|
'"back-tier"',
|
||||||
|
],
|
||||||
|
ports: "{{ wordpress_mysql_ports | default([]) }}",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
<?php
|
||||||
|
// Silence is golden.
|
||||||
Loading…
Reference in New Issue