An open API service indexing awesome lists of open source software.

https://github.com/colinwilson/terraform-docker-plausible

Terraform module to deploy Plausible Analytics on Docker Swarm
https://github.com/colinwilson/terraform-docker-plausible

docker docker-swarm plausible plausible-analytics terraform terraform-module

Last synced: 7 months ago
JSON representation

Terraform module to deploy Plausible Analytics on Docker Swarm

Awesome Lists containing this project

README

          

# Terraform Docker Plausible Module
A Terraform module to provision the self-hosted version of [Plausible Analytics](https://plausible.io) on a Docker Swarm cluster with the Traefik ingress controller. A great way to quickly deploy Plausible for development/testing or 'low traffic' sites.

![Plausible Analytics Dashboard](https://res.cloudinary.com/lotuslabs/image/upload/v1673015990/Lotus%20Docs/Social%20Media/plausible-analytics-screenshot_ds_rdd_c6bi3o.webp)

## Compatibility/Requirements

* Requires [Terraform](https://www.terraform.io/downloads.html) 1.2.0 or higher.
* Traefik ingress controller, see: [colinwilson/terraform-docker-traefik-v2](https://github.com/colinwilson/terraform-docker-traefik-v2) (or any other ingress controller e.g. nginx)

## Usage
Basic usage of this module is as follows:
```
module "plausible_docker" {
source = "github.com/colinwilson/terraform-docker-plausible"

hostname = "plausible.example.com"
base_url = "https://plausible.example.com"
networks = ["traefik"] # name of your Traefik Network
}
```
Example output:
```
connected_networks = [
"traefik",
]
options_status = {
"external_pg_enabled" = false
"maxmind_enabled" = false
"smtp_enabled" = false
}
```

Setup DNS records pointing your domain to your ingress and navigate to your `hostname` e.g. https://plausible.example.com

You'll be presented with a registration page to create the admin/owner account.

![Plausible Analytics Registration Page](https://res.cloudinary.com/lotuslabs/image/upload/v1672923448/Lotus%20Docs/Social%20Media/plausible-analytics-registration-page_bairzy.webp)

### Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [base\_url](#input\_base\_url) | Plausible base URL | `string` | `"http://localhost"` | no |
| [clickhouse\_container\_name](#input\_clickhouse\_container\_name) | ClickHouse Container name. | `string` | `"plausible_event_db"` | no |
| [clickhouse\_db\_name](#input\_clickhouse\_db\_name) | ClickHouse Database name. | `string` | `"plausible"` | no |
| [clickhouse\_version](#input\_clickhouse\_version) | ClickHouse image version. | `string` | `"22.6-alpine"` | no |
| [disable\_registration](#input\_disable\_registration) | Disables registration of new users. Valid options are true, false & invite\_only | `string` | `"invite_only"` | no |
| [ext\_postgres\_creds](#input\_ext\_postgres\_creds) | Postgres database credentials. |

object({
enabled = optional(bool, false)
config = optional(object({
username = optional(string)
password = optional(string)
host = optional(string)
port = optional(number, 5432)
db_name = optional(string)
ssl = optional(bool, false)
}), {})
})
| `{}` | no |
| [geoip\_creds](#input\_geoip\_creds) | MaxMind credentials. |
object({
acc = string
key = string
})
|
{
"acc": null,
"key": null
}
| no |
| [geoip\_db](#input\_geoip\_db) | Set which MaxMind Database Plausible will utilise? | `string` | `"GeoLite2-City"` | no |
| [geoip\_version](#input\_geoip\_version) | MaxMind GeoIP Update Tool image version. | `string` | `"v5.1.1"` | no |
| [google\_api\_creds](#input\_google\_api\_creds) | Google API Console credentials. |
object({
id = string
secret = string
})
|
{
"id": null,
"secret": null
}
| no |
| [hcaptcha\_creds](#input\_hcaptcha\_creds) | hCaptcha credentials. |
object({
sitekey = string
secret = string
})
|
{
"secret": null,
"sitekey": null
}
| no |
| [hostname](#input\_hostname) | Plausible hostname | `string` | `"localhost"` | no |
| [log\_level](#input\_log\_level) | Log level | `string` | `"warn"` | no |
| [networks](#input\_networks) | Set of existing networks to connect Plausible to. | `set(string)` | `[]` | no |
| [plausible\_version](#input\_plausible\_version) | Plausible Analytics image version. | `string` | `"v2.0.0"` | no |
| [postgres\_container\_name](#input\_postgres\_container\_name) | Postgres container name | `string` | `"plausible_db"` | no |
| [postgres\_version](#input\_postgres\_version) | PostgreSQL image version. | `string` | `"14-alpine"` | no |
| [reduce\_event\_logging](#input\_reduce\_event\_logging) | Reduce the level of query logging in ClickHouse? | `bool` | `true` | no |
| [smtp\_creds](#input\_smtp\_creds) | SMTP Credentials |
object({
mailname = string
host = string
port = number
username = string
password = string
})
|
{
"host": null,
"mailname": null,
"password": null,
"port": null,
"username": null
}
| no |

### Outputs

| Name | Description |
|------|-------------|
| [connected\_networks](#output\_connected\_networks) | List of existing networks the Plausible service is connected to. |
| [options\_status](#output\_options\_status) | Brief summary of which options are enabled? |