2022-09-09 19:37:52 +08:00
# Setting up Cactus Comments (optional)
2024-01-09 15:53:01 +08:00
The playbook can install and configure the [Cactus Comments ](https://cactus.chat ) system for you.
2022-09-09 19:37:52 +08:00
2024-01-09 15:53:01 +08:00
Cactus Comments is a **federated comment system** built on Matrix. It respects your privacy, and puts you in control.
2022-09-09 19:37:52 +08:00
See the project's [documentation ](https://cactus.chat/docs/getting-started/introduction/ ) to learn what it
does and why it might be useful to you.
2024-01-09 15:53:01 +08:00
The playbook contains 2 roles for configuring different pieces of the Cactus Comments system:
- `matrix-cactus-comments` - the backend appservice integrating with the Matrix homeserver
- `matrix-cactus-comments-client` - a static website server serving the [cactus-client ](https://cactus.chat/docs/client/introduction/ ) static assets (`cactus.js` and `styles.css` )
You can enable whichever component you need (typically both).
2022-09-09 19:37:52 +08:00
## Configuration
2024-10-17 19:46:53 +08:00
Add the following configuration to your `inventory/host_vars/matrix.DOMAIN/vars.yml` file:
2022-09-09 19:37:52 +08:00
2022-09-09 19:43:49 +08:00
```yaml
2022-09-09 19:37:52 +08:00
#################
2024-10-11 02:15:07 +08:00
## Cactus Comments ##
2022-09-09 19:37:52 +08:00
#################
2024-01-09 01:57:18 +08:00
# This enables the backend (appservice)
2022-09-09 19:37:52 +08:00
matrix_cactus_comments_enabled: true
# To allow guest comments without users needing to log in, you need to have guest registration enabled.
2024-01-09 01:57:18 +08:00
# To do this you need to uncomment one of the following lines (depending if you are using Synapse or Dendrite as a homeserver)
# If you don't know which one you use: The default is Synapse ;)
2022-09-09 19:37:52 +08:00
# matrix_synapse_allow_guest_access: true
2024-01-09 01:57:18 +08:00
# matrix_dendrite_allow_guest_access: true
2024-01-09 15:53:01 +08:00
2024-10-17 21:17:56 +08:00
# This enables client assets static files serving on `https://matrix.example.com/cactus-comments`.
2024-01-09 15:53:01 +08:00
# When the backend (appservice) is enabled, this is also enabled automatically,
# but we explicitly enable it here.
matrix_cactus_comments_client_enabled: true
2024-10-14 13:42:02 +08:00
# Uncomment and adjust this part if you'd like to host the client assets at a different location.
2024-01-09 15:53:01 +08:00
# These variables are only make used if (`matrix_cactus_comments_client_enabled: true`)
# matrix_cactus_comments_client_hostname: "{{ matrix_server_fqn_matrix }}"
# matrix_cactus_comments_client_path_prefix: /cactus-comments
2022-09-09 19:37:52 +08:00
```
## Installing
2024-10-13 02:03:46 +08:00
After configuring the playbook, run the [installation ](installing.md ) command: `just install-all` or `just setup-all`
2022-09-09 19:37:52 +08:00
## Usage
2022-09-09 20:13:35 +08:00
Upon starting Cactus Comments, a `bot.cactusbot` user account is created automatically.
2024-10-18 01:33:36 +08:00
To get started, send a `help` message to the `@bot.cactusbot:example.com` bot to confirm it's working.
2024-10-11 03:01:07 +08:00
2022-09-09 20:13:35 +08:00
Then, register a site by typing: `register <sitename>` . You will then be invited into a moderation room.
2024-10-11 03:01:07 +08:00
2022-09-09 19:37:52 +08:00
Now you are good to go and can include the comment section on your website!
2024-10-11 03:01:07 +08:00
**Careful**: To really make use of self-hosting you need change a few things in comparison to the official docs!
2022-09-09 19:37:52 +08:00
Insert the following snippet into you page and make sure to replace `example.com` with your base domain!
```html
< script type = "text/javascript" src = "https://matrix.example.com/cactus-comments/cactus.js" > < / script >
< link rel = "stylesheet" href = "https://matrix.example.com/cactus-comments/style.css" type = "text/css" >
< div id = "comment-section" > < / div >
< script >
initComments({
node: document.getElementById("comment-section"),
defaultHomeserverUrl: "https://matrix.example.com:8448",
serverName: "example.com",
siteName: "YourSiteName",
commentSectionId: "1"
})
< / script >
```