mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-04-28 18:30:24 +02:00
Optimized listmonk, wordpress and activity pub for wordpress
This commit is contained in:
parent
fd0a978a16
commit
3b3ec5196a
@ -2,10 +2,13 @@ application_id: "bigbluebutton"
|
||||
bbb_repository_directory: "{{ docker_compose.directories.services }}"
|
||||
docker_compose_file_origine: "{{ docker_compose.directories.services }}docker-compose.yml"
|
||||
docker_compose_file_final: "{{ docker_compose.directories.instance }}docker-compose.yml"
|
||||
|
||||
# Database configuration
|
||||
database_instance: "bigbluebutton"
|
||||
database_name: "multiple_databases"
|
||||
database_username: "postgres"
|
||||
database_password: "{{ applications.bigbluebutton.credentials.postgresql_secret }}"
|
||||
|
||||
domain: "{{ domains[application_id] }}"
|
||||
http_port: "{{ ports.localhost.http[application_id] }}"
|
||||
bbb_env_file_link: "{{ docker_compose.directories.instance }}.env"
|
||||
|
@ -19,21 +19,17 @@
|
||||
domain: "{{ domains[application_id] }}"
|
||||
http_port: "{{ ports.localhost.http[application_id] }}"
|
||||
|
||||
- name: "copy docker-compose.yml and env file"
|
||||
include_tasks: copy-docker-compose-and-env.yml
|
||||
|
||||
- name: add config.toml
|
||||
template:
|
||||
src: "config.toml.j2"
|
||||
dest: "{{docker_compose.directories.config}}config.toml"
|
||||
notify: docker compose project setup
|
||||
|
||||
- name: flush docker service
|
||||
meta: flush_handlers
|
||||
when: applications.listmonk.setup |bool
|
||||
- name: "copy docker-compose.yml and env file"
|
||||
include_tasks: copy-docker-compose-and-env.yml
|
||||
|
||||
- name: setup routine for listmonk
|
||||
command:
|
||||
cmd: docker compose run -T --rm application sh -c "yes | ./listmonk --install"
|
||||
chdir: "{{docker_compose.directories.instance}}"
|
||||
when: applications.listmonk.setup |bool
|
||||
ignore_errors: true # Ignore errors if already setup
|
@ -5,14 +5,6 @@
|
||||
# port, use port 80 (this will require running with elevated permissions).
|
||||
address = "0.0.0.0:9000"
|
||||
|
||||
# BasicAuth authentication for the admin dashboard. This will eventually
|
||||
# be replaced with a better multi-user, role-based authentication system.
|
||||
# IMPORTANT: Leave both values empty to disable authentication on admin
|
||||
# only where an external authentication is already setup.
|
||||
# admin_username = "{{applications.listmonk.users.administrator.username}}"
|
||||
# admin_password = "{{listmonk_admin_password}}"
|
||||
# Deactivated for newer versions
|
||||
|
||||
# Database.
|
||||
[db]
|
||||
host = "{{database_host}}"
|
||||
|
@ -2,8 +2,8 @@ TZ=Etc/UTC
|
||||
|
||||
# Administrator setup
|
||||
|
||||
LISTMONK_ADMIN_USER={{users.administrator.username}}
|
||||
LISTMONK_ADMIN_PASSWORD={{users.administrator.password}}
|
||||
LISTMONK_ADMIN_USER={{ applications[application_id].users.administrator.username }}
|
||||
LISTMONK_ADMIN_PASSWORD={{ applications[application_id].users.administrator.password }}
|
||||
|
||||
{% if applications[application_id].features.oidc | bool %}
|
||||
###################################
|
||||
|
@ -1,3 +1,3 @@
|
||||
application_id: "listmonk"
|
||||
database_password: "{{listmonk_database_password}}"
|
||||
database_password: "{{applications[application_id].credentials.database.password}}"
|
||||
database_type: "postgres"
|
@ -1,6 +1,9 @@
|
||||
application_id: "mailu"
|
||||
|
||||
# Database Configuration
|
||||
database_password: "{{applications.mailu.credentials.database.password}}"
|
||||
database_type: "mariadb"
|
||||
|
||||
cert_mount_directory: "{{docker_compose.directories.volumes}}certs/"
|
||||
enable_wildcard_certificate: false
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
application_id: "mastodon"
|
||||
database_password: "{{applications.mastodon.credentials.database.password}}"
|
||||
database_password: "{{applications[application_id].credentials.database.password}}"
|
||||
database_type: "postgres"
|
@ -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:
|
@ -273,6 +273,9 @@ defaults_applications:
|
||||
administrator:
|
||||
username: "{{users.administrator.username}}" # Listmonk administrator account username
|
||||
# password: "{{users.administrator.password}}" # Password to initialized Listmonk administrator with
|
||||
credentials:
|
||||
database:
|
||||
# password: "" # Database password
|
||||
public_api_activated: False # Security hole. Can be used for spaming
|
||||
version: "latest" # Docker Image version
|
||||
setup: false # Set true in inventory file to execute the setup and initializing procedures
|
||||
@ -817,8 +820,13 @@ defaults_applications:
|
||||
# password: # Password of the wordpress administrator
|
||||
email: "{{users.administrator.email}}" # Email of the wordpress adminsitrator
|
||||
plugins:
|
||||
discourse: "{{ 'discourse' in group_names | lower }}"
|
||||
oidc: true
|
||||
wp-discourse:
|
||||
enabled: "{{ 'discourse' in group_names | lower }}"
|
||||
daggerhart-openid-connect-generic:
|
||||
enabled: true
|
||||
activitypub:
|
||||
enabled: true
|
||||
|
||||
{% endraw %}{{ features.render_features({
|
||||
'matomo': true,
|
||||
'css': false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user