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
- Host: GitHub
- URL: https://github.com/colinwilson/terraform-docker-plausible
- Owner: colinwilson
- License: mit
- Created: 2022-12-31T02:42:59.000Z (almost 3 years ago)
- Default Branch: release
- Last Pushed: 2023-07-13T10:27:24.000Z (over 2 years ago)
- Last Synced: 2025-01-16T11:56:45.909Z (9 months ago)
- Topics: docker, docker-swarm, plausible, plausible-analytics, terraform, terraform-module
- Language: HCL
- Homepage: https://registry.terraform.io/modules/colinwilson/plausible/docker/latest
- Size: 57.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.
## 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.

### 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({| `{}` | no |
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)
}), {})
})
| [geoip\_creds](#input\_geoip\_creds) | MaxMind credentials. |object({|
acc = string
key = string
}){| no |
"acc": null,
"key": null
}
| [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
}){| no |
"id": null,
"secret": null
}
| [hcaptcha\_creds](#input\_hcaptcha\_creds) | hCaptcha credentials. |object({|
sitekey = string
secret = string
}){| no |
"secret": null,
"sitekey": null
}
| [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
}){| no |
"host": null,
"mailname": null,
"password": null,
"port": null,
"username": null
}### 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? |