mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Optimized listmonk, wordpress and activity pub for wordpress
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
# Wordpress with Discourse Support
|
||||
|
||||
This folder contains the files to setup Discourse support for Wordpress.
|
||||
IT's realized with the [WP Discourse Plugin](https://de.wordpress.org/plugins/wp-discourse/)
|
@@ -1,38 +0,0 @@
|
||||
---
|
||||
- name: Add /var/www/discourse to Git safe.directory
|
||||
command: >
|
||||
docker exec {{ applications.discourse.container }} \
|
||||
git config --global --add safe.directory /var/www/discourse
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
changed_when: false
|
||||
|
||||
- name: Revoke old WP Discourse API keys via Rails
|
||||
command: >
|
||||
docker exec {{ applications.discourse.container }} bash -lc "\
|
||||
cd /var/www/discourse && \
|
||||
script/rails runner \"\
|
||||
ApiKey.where(\
|
||||
user_id: User.find_by_username('system').id,\
|
||||
description: 'WP Discourse Integration',\
|
||||
revoked_at: nil\
|
||||
).update_all(revoked_at: Time.current)\
|
||||
\""
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: Generate new WP Discourse API key via Rake task
|
||||
command: >
|
||||
docker exec {{ applications.discourse.container }} bash -lc "\
|
||||
cd /var/www/discourse && \
|
||||
bin/rake api_key:create_master['WP Discourse Integration']\
|
||||
"
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
register: discourse_generated_api_key
|
||||
|
||||
- name: Store the new WP Discourse API key in a fact
|
||||
set_fact:
|
||||
vault_discourse_api_key: "{{ discourse_generated_api_key.stdout | trim }}"
|
@@ -37,10 +37,15 @@
|
||||
- name: "Install wordpress"
|
||||
include_tasks: install.yml
|
||||
|
||||
- name: "Activating OIDC when enabled."
|
||||
include_tasks: oidc/install.yml
|
||||
when: applications[application_id].features.oidc | bool
|
||||
|
||||
- name: "Activating WP Discourse when enabled"
|
||||
include_tasks: discourse/install.yml
|
||||
when: applications[application_id].plugins.discourse | bool
|
||||
- name: "Install and activate WordPress plugins from application config"
|
||||
block:
|
||||
- name: "Iterate through WordPress plugins"
|
||||
include_tasks: plugin.yml
|
||||
loop: "{{ applications[application_id].plugins | dict2items }}"
|
||||
loop_control:
|
||||
label: "{{ item.key }}"
|
||||
vars:
|
||||
plugin_name: "{{ item.key }}"
|
||||
plugin_enabled: "{{ item.value.enabled | bool }}"
|
||||
plugin_task_path: "{{ role_path }}/tasks/plugins/{{ plugin_name }}/install.yml"
|
||||
when: plugin_enabled
|
||||
|
@@ -1,2 +0,0 @@
|
||||
# Wordpress with OIDC
|
||||
This folder contains the files to setup Wordpress with OIDC.
|
@@ -1,19 +0,0 @@
|
||||
---
|
||||
- name: "Install OpenID Connect Generic Plugin via WP CLI"
|
||||
command: >
|
||||
docker-compose exec -u www-data -T application
|
||||
wp plugin install daggerhart-openid-connect-generic
|
||||
--path={{ wordpress_docker_html_path }}
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
|
||||
- name: "Activate OpenID Connect Generic Plugin"
|
||||
command: >
|
||||
docker-compose exec -u www-data -T application
|
||||
wp plugin activate daggerhart-openid-connect-generic
|
||||
--path={{ wordpress_docker_html_path }}
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
|
||||
- name: "Setup OIDC settings"
|
||||
include_tasks: "settings.yml"
|
18
roles/docker-wordpress/tasks/plugin.yml
Normal file
18
roles/docker-wordpress/tasks/plugin.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
- name: "Check if plugin has a dedicated install task"
|
||||
stat:
|
||||
path: "{{ plugin_task_path }}"
|
||||
register: plugin_task_file
|
||||
|
||||
- name: "Include plugin-specific install task if it exists"
|
||||
include_tasks: "{{ plugin_task_path }}"
|
||||
when: plugin_task_file.stat.exists
|
||||
|
||||
- name: "Install and activate WordPress plugin via WP CLI"
|
||||
command: >
|
||||
docker-compose exec -u www-data -T application
|
||||
wp plugin install {{ plugin_name }} --activate
|
||||
--path={{ wordpress_docker_html_path }}
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
when: not plugin_task_file.stat.exists
|
15
roles/docker-wordpress/tasks/plugins/README.md
Normal file
15
roles/docker-wordpress/tasks/plugins/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# WordPress Plugins
|
||||
|
||||
This WordPress setup integrates several powerful plugins to extend functionality with authentication, federation, and external discussion platforms:
|
||||
|
||||
## 🔐 OpenID Connect Generic Client
|
||||
Enables secure login via OpenID Connect (OIDC).
|
||||
Plugin used: [daggerhart-openid-connect-generic](https://wordpress.org/plugins/daggerhart-openid-connect-generic/)
|
||||
|
||||
## 💬 WP Discourse
|
||||
Seamlessly connects WordPress with a Discourse forum for comments, discussions, and single sign-on (SSO).
|
||||
Plugin used: [wp-discourse](https://wordpress.org/plugins/wp-discourse/)
|
||||
|
||||
## 🌍 ActivityPub
|
||||
Federates your blog with the Fediverse, making it accessible on platforms like Mastodon and Friendica.
|
||||
Plugin used: [activitypub](https://wordpress.org/plugins/activitypub/)
|
@@ -10,8 +10,43 @@
|
||||
delay: 5
|
||||
timeout: 600
|
||||
|
||||
- name: "Generate Discourse API Key when WP Discourse is enabled"
|
||||
include_tasks: generate-api-key.yml
|
||||
- name: Add /var/www/discourse to Git safe.directory
|
||||
command: >
|
||||
docker exec {{ applications.discourse.container }} \
|
||||
git config --global --add safe.directory /var/www/discourse
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
changed_when: false
|
||||
|
||||
- name: Revoke old WP Discourse API keys via Rails
|
||||
command: >
|
||||
docker exec {{ applications.discourse.container }} bash -lc "\
|
||||
cd /var/www/discourse && \
|
||||
script/rails runner \"\
|
||||
ApiKey.where(\
|
||||
user_id: User.find_by_username('system').id,\
|
||||
description: 'WP Discourse Integration',\
|
||||
revoked_at: nil\
|
||||
).update_all(revoked_at: Time.current)\
|
||||
\""
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: Generate new WP Discourse API key via Rake task
|
||||
command: >
|
||||
docker exec {{ applications.discourse.container }} bash -lc "\
|
||||
cd /var/www/discourse && \
|
||||
bin/rake api_key:create_master['WP Discourse Integration']\
|
||||
"
|
||||
args:
|
||||
chdir: "{{ docker_compose.directories.instance }}"
|
||||
register: discourse_generated_api_key
|
||||
|
||||
- name: Store the new WP Discourse API key in a fact
|
||||
set_fact:
|
||||
vault_discourse_api_key: "{{ discourse_generated_api_key.stdout | trim }}"
|
||||
|
||||
- name: "Load WP Discourse settings"
|
||||
include_vars:
|
Reference in New Issue
Block a user