feat: add glance
This commit is contained in:
77
modules/20-services-apps/glance/README.md
Normal file
77
modules/20-services-apps/glance/README.md
Normal file
@@ -0,0 +1,77 @@
|
||||
# Glance Module
|
||||
|
||||
This module deploys [Glance](https://glanceapp.io/), a dashboard application, as a Docker container in the homelab environment.
|
||||
|
||||
## Overview
|
||||
|
||||
The Glance module:
|
||||
|
||||
- Deploys the `glanceapp/glance` Docker container
|
||||
- Persists configuration to a volume on the host
|
||||
- Provides service definition for integration with networking modules
|
||||
|
||||
## Usage
|
||||
|
||||
```hcl
|
||||
module "glance" {
|
||||
source = "./modules/20-services-apps/glance"
|
||||
volume_path = "/path/to/volumes/glance"
|
||||
networks = ["homelab-network"]
|
||||
}
|
||||
```
|
||||
|
||||
## Variables
|
||||
|
||||
| Variable | Description | Type | Default |
|
||||
| ------------- | ---------------------------------------------------------- | -------------- | ---------- |
|
||||
| `image_tag` | Tag of the Glance image to use | `string` | `"latest"` |
|
||||
| `volume_path` | Host path for Glance data volume | `string` | - |
|
||||
| `networks` | List of networks to which the container should be attached | `list(string)` | - |
|
||||
|
||||
## Outputs
|
||||
|
||||
| Output | Description |
|
||||
| -------------------- | ---------------------------------------------------------- |
|
||||
| `service_definition` | Service definition for integration with networking modules |
|
||||
|
||||
## Service Definition
|
||||
|
||||
This module outputs a service definition that is used by the networking modules to expose the service.
|
||||
|
||||
```hcl
|
||||
{
|
||||
name = "glance"
|
||||
primary_port = 4921
|
||||
endpoint = "http://glance:4921"
|
||||
subdomains = ["glance"]
|
||||
publish_via = "tunnel" # Only publish through Cloudflare tunnel
|
||||
}
|
||||
```
|
||||
|
||||
## Data Persistence
|
||||
|
||||
Glance stores its configuration in the `/app/config` directory inside the container. This is mapped to a volume on the host at `${volume_path}/config`.
|
||||
|
||||
## Integration with Networking Modules
|
||||
|
||||
This service is configured to be exposed through a Cloudflare tunnel for secure remote access, set by `publish_via = "tunnel"`.
|
||||
|
||||
## Example Integration in Main Configuration
|
||||
|
||||
```hcl
|
||||
module "glance" {
|
||||
source = "./modules/20-services-apps/glance"
|
||||
volume_path = module.system_globals.volume_host
|
||||
networks = [module.services.homelab_docker_network_name]
|
||||
}
|
||||
|
||||
# The service definition is automatically included in the services output
|
||||
module "services" {
|
||||
source = "./modules/services"
|
||||
# ...
|
||||
service_definitions = [
|
||||
module.glance.service_definition,
|
||||
# Other service definitions
|
||||
]
|
||||
}
|
||||
```
|
||||
52
modules/20-services-apps/glance/main.tf
Normal file
52
modules/20-services-apps/glance/main.tf
Normal file
@@ -0,0 +1,52 @@
|
||||
variable "image_tag" {
|
||||
description = "Tag of the Glance image to use"
|
||||
type = string
|
||||
default = "latest"
|
||||
}
|
||||
|
||||
variable "volume_path" {
|
||||
description = "Host path for Glance data volume"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "networks" {
|
||||
description = "List of networks to which the container should be attached"
|
||||
type = list(string)
|
||||
}
|
||||
|
||||
locals {
|
||||
container_name = "glance"
|
||||
image = "glanceapp/glance"
|
||||
image_tag = var.image_tag != "" ? var.image_tag : "latest"
|
||||
monitoring = true
|
||||
host_port = 8080
|
||||
subdomains = ["glance"]
|
||||
default_volumes = [
|
||||
{
|
||||
container_path = "/app/config"
|
||||
host_path = "${var.volume_path}/config"
|
||||
read_only = false
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
module "glance" {
|
||||
source = "../../10-services-generic/docker-service"
|
||||
container_name = local.container_name
|
||||
image = local.image
|
||||
tag = local.image_tag
|
||||
volumes = local.default_volumes
|
||||
networks = var.networks
|
||||
monitoring = local.monitoring
|
||||
}
|
||||
|
||||
output "service_definition" {
|
||||
description = "General service definition with optional ingress configuration"
|
||||
value = {
|
||||
name = local.container_name
|
||||
primary_port = local.host_port
|
||||
endpoint = "http://${local.container_name}:${local.host_port}"
|
||||
subdomains = local.subdomains
|
||||
publish_via = "tunnel"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user