Compare commits
No commits in common. "ccca1af0045eccd91b85eb8f23f243bc9c3cdccc" and "1bb0e4f6f66e72d3fb00576997a51a15722bb3aa" have entirely different histories.
ccca1af004
...
1bb0e4f6f6
|
|
@ -23,10 +23,9 @@ locals {
|
|||
)
|
||||
jellyfin_backend_host = var.jellyfin_backend_host != "" ? var.jellyfin_backend_host : var.gitea_backend_host
|
||||
jeannie_api_server_name = "api.${var.server_name}"
|
||||
office_server_name = var.office_server_name
|
||||
server_names = distinct(concat([var.server_name, local.heimdall_server_name, local.homepage_server_name, local.oidc_server_name, local.jellyfin_server_name, local.jeannie_api_server_name, local.office_server_name], var.additional_server_names))
|
||||
server_names = distinct(concat([var.server_name, local.heimdall_server_name, local.homepage_server_name, local.oidc_server_name, local.jellyfin_server_name, local.jeannie_api_server_name], var.additional_server_names))
|
||||
matrix_server_names = var.matrix_enabled ? [var.matrix_server_name, var.element_server_name] : []
|
||||
main_server_names = [for name in local.server_names : name if !contains([local.heimdall_server_name, local.homepage_server_name, local.oidc_server_name, local.jellyfin_server_name, local.jeannie_api_server_name, local.office_server_name], name) && !contains(local.matrix_server_names, name)]
|
||||
main_server_names = [for name in local.server_names : name if !contains([local.heimdall_server_name, local.homepage_server_name, local.oidc_server_name, local.jellyfin_server_name, local.jeannie_api_server_name], name) && !contains(local.matrix_server_names, name)]
|
||||
default_conf = templatefile("${path.module}/templates/default.conf.tftpl", {
|
||||
server_name = var.server_name
|
||||
server_names = join(" ", local.server_names)
|
||||
|
|
@ -51,10 +50,6 @@ locals {
|
|||
jeannie_api_server_name = local.jeannie_api_server_name
|
||||
jeannie_api_backend_host = var.jeannie_api_backend_host
|
||||
jeannie_api_backend_port = tostring(var.jeannie_api_backend_port)
|
||||
office_server_name = local.office_server_name
|
||||
office_backend_host = var.office_backend_host
|
||||
office_backend_port = tostring(var.office_backend_port)
|
||||
office_tailscale_cidr = var.office_tailscale_cidr
|
||||
})
|
||||
default_vcl = templatefile("${path.module}/templates/default.vcl.tftpl", {
|
||||
backend_host = var.backend_host
|
||||
|
|
@ -91,33 +86,30 @@ locals {
|
|||
|
||||
resource "null_resource" "edge_services" {
|
||||
triggers = {
|
||||
host = var.edge_host
|
||||
user = var.edge_user
|
||||
install_dir = var.edge_install_dir
|
||||
install_docker = tostring(var.edge_install_docker)
|
||||
server_name = var.server_name
|
||||
server_names = join(" ", local.server_names)
|
||||
certbot_domain_args = join(" ", [for name in local.server_names : "-d ${name}"])
|
||||
backend_host = var.backend_host
|
||||
backend_port = tostring(var.backend_port)
|
||||
gitea_backend_host = var.gitea_backend_host
|
||||
gitea_backend_port = tostring(var.gitea_backend_port)
|
||||
heimdall_host = local.heimdall_backend_host
|
||||
heimdall_port = tostring(var.heimdall_backend_port)
|
||||
oidc_host = local.oidc_backend_host
|
||||
oidc_port = tostring(var.oidc_backend_port)
|
||||
jellyfin_host = local.jellyfin_backend_host
|
||||
jellyfin_port = tostring(var.jellyfin_backend_port)
|
||||
jeannie_api_host = var.jeannie_api_backend_host
|
||||
jeannie_api_port = tostring(var.jeannie_api_backend_port)
|
||||
office_host = var.office_backend_host
|
||||
office_port = tostring(var.office_backend_port)
|
||||
office_tailscale_cidr = var.office_tailscale_cidr
|
||||
enable_letsencrypt = tostring(var.enable_letsencrypt)
|
||||
letsencrypt_email = var.letsencrypt_email
|
||||
letsencrypt_staging = tostring(var.letsencrypt_staging)
|
||||
certbot_version = "2"
|
||||
config_hash = local.config_hash
|
||||
host = var.edge_host
|
||||
user = var.edge_user
|
||||
install_dir = var.edge_install_dir
|
||||
install_docker = tostring(var.edge_install_docker)
|
||||
server_name = var.server_name
|
||||
server_names = join(" ", local.server_names)
|
||||
certbot_domain_args = join(" ", [for name in local.server_names : "-d ${name}"])
|
||||
backend_host = var.backend_host
|
||||
backend_port = tostring(var.backend_port)
|
||||
gitea_backend_host = var.gitea_backend_host
|
||||
gitea_backend_port = tostring(var.gitea_backend_port)
|
||||
heimdall_host = local.heimdall_backend_host
|
||||
heimdall_port = tostring(var.heimdall_backend_port)
|
||||
oidc_host = local.oidc_backend_host
|
||||
oidc_port = tostring(var.oidc_backend_port)
|
||||
jellyfin_host = local.jellyfin_backend_host
|
||||
jellyfin_port = tostring(var.jellyfin_backend_port)
|
||||
jeannie_api_host = var.jeannie_api_backend_host
|
||||
jeannie_api_port = tostring(var.jeannie_api_backend_port)
|
||||
enable_letsencrypt = tostring(var.enable_letsencrypt)
|
||||
letsencrypt_email = var.letsencrypt_email
|
||||
letsencrypt_staging = tostring(var.letsencrypt_staging)
|
||||
certbot_version = "2"
|
||||
config_hash = local.config_hash
|
||||
}
|
||||
|
||||
connection {
|
||||
|
|
|
|||
|
|
@ -208,39 +208,6 @@ server {
|
|||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
http2 on;
|
||||
server_name ${office_server_name};
|
||||
|
||||
ssl_certificate /etc/nginx/certs/current.crt;
|
||||
ssl_certificate_key /etc/nginx/certs/current.key;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
|
||||
# The office data plane is reachable only from the Tailscale CGNAT range.
|
||||
allow ${office_tailscale_cidr};
|
||||
deny all;
|
||||
client_max_body_size 2g;
|
||||
|
||||
location / {
|
||||
proxy_pass http://${office_backend_host}:${office_backend_port};
|
||||
proxy_http_version 1.1;
|
||||
proxy_buffering off;
|
||||
proxy_request_buffering off;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header X-Forwarded-Port 443;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
http2 on;
|
||||
|
|
|
|||
|
|
@ -148,26 +148,6 @@ variable "jeannie_api_backend_port" {
|
|||
default = 8787
|
||||
}
|
||||
|
||||
variable "office_server_name" {
|
||||
type = string
|
||||
default = "office.lab2025.duckdns.org"
|
||||
}
|
||||
|
||||
variable "office_backend_host" {
|
||||
type = string
|
||||
default = "192.168.100.73"
|
||||
}
|
||||
|
||||
variable "office_backend_port" {
|
||||
type = number
|
||||
default = 8090
|
||||
}
|
||||
|
||||
variable "office_tailscale_cidr" {
|
||||
type = string
|
||||
default = "100.64.0.0/10"
|
||||
}
|
||||
|
||||
# Matrix (isolated vhost + its own cert; does NOT touch shared current.crt)
|
||||
variable "matrix_enabled" {
|
||||
type = bool
|
||||
|
|
|
|||
|
|
@ -1799,9 +1799,6 @@ resource "null_resource" "prometheus_stack_helm_recovery" {
|
|||
depends_on = [helm_release.mimir]
|
||||
|
||||
triggers = {
|
||||
# This recovery must run before every targeted Helm upgrade because a
|
||||
# failed upgrade can leave a new pending revision after the previous run.
|
||||
recovery_run = timestamp()
|
||||
kubeconfig_path = var.kubeconfig_path
|
||||
namespace = var.observability.namespace
|
||||
release_name = "prometheus-stack"
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ var allowedCommands = map[string]bool{
|
|||
"website-ollama-listen": true, "ollama-setup": true,
|
||||
"deploy-gitea": true, "deploy-api": true, "deploy-heimdall": true,
|
||||
"deploy-dex": true, "deploy-matrix": true, "deploy-ai-stack": true,
|
||||
"deploy-office": true,
|
||||
"deploy-ai-tools": true, "deploy-omniroute": true, "deploy-hermes": true,
|
||||
"rpi-services": true, "bootstrap-gitea-repo": true, "backup-gitea": true,
|
||||
"backup": true, "drill-restore": true, "drill-gitea-restore": true,
|
||||
|
|
|
|||
|
|
@ -144,12 +144,6 @@ services:
|
|||
http_port: 5556
|
||||
telemetry_port: 5558
|
||||
public_url: https://auth.lab2025.duckdns.org/
|
||||
office:
|
||||
host: debian
|
||||
install_dir: /data/homelab-office
|
||||
http_port: 8090
|
||||
collabora_port: 9980
|
||||
public_url: https://office.lab2025.duckdns.org/
|
||||
jellyfin:
|
||||
host: debian
|
||||
http_port: 8096
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
# Online office stack
|
||||
|
||||
This stack provides browser-based LibreOffice-compatible editing through
|
||||
Nextcloud and Collabora Online. It stores documents in the dedicated
|
||||
`/data/homelab-office` tree on Debian and uses PostgreSQL and Redis instead of
|
||||
SQLite or in-container state.
|
||||
|
||||
The pipeline deploys the stack independently with:
|
||||
|
||||
```sh
|
||||
./jeannie deploy-office
|
||||
```
|
||||
|
||||
The edge route is `https://office.lab2025.duckdns.org` and is restricted to the
|
||||
Tailscale CGNAT range. Dex SSO is configured by the pipeline after the first
|
||||
Nextcloud boot when `DEX_OFFICE_CLIENT_SECRET` exists in the encrypted Dex
|
||||
secret. Existing older Dex secret files must be regenerated or supplied with
|
||||
`LAB_OFFICE_OIDC_CLIENT_SECRET`; credentials are never committed to the
|
||||
repository.
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
services:
|
||||
postgres:
|
||||
image: ${OFFICE_POSTGRES_IMAGE:-postgres:16-alpine}
|
||||
container_name: ${OFFICE_POSTGRES_CONTAINER_NAME:-homelab-office-postgres}
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: ${OFFICE_POSTGRES_DB:-nextcloud}
|
||||
POSTGRES_USER: ${OFFICE_POSTGRES_USER:-nextcloud}
|
||||
POSTGRES_PASSWORD: ${OFFICE_POSTGRES_PASSWORD:?OFFICE_POSTGRES_PASSWORD is required}
|
||||
volumes:
|
||||
- ${OFFICE_POSTGRES_DATA_DIR:-/data/homelab-office/postgres}:/var/lib/postgresql/data
|
||||
networks: [office]
|
||||
|
||||
redis:
|
||||
image: ${OFFICE_REDIS_IMAGE:-redis:7-alpine}
|
||||
container_name: ${OFFICE_REDIS_CONTAINER_NAME:-homelab-office-redis}
|
||||
restart: unless-stopped
|
||||
command: ["redis-server", "--requirepass", "${OFFICE_REDIS_PASSWORD:?OFFICE_REDIS_PASSWORD is required}"]
|
||||
volumes:
|
||||
- ${OFFICE_REDIS_DATA_DIR:-/data/homelab-office/redis}:/data
|
||||
networks: [office]
|
||||
|
||||
nextcloud:
|
||||
image: ${OFFICE_NEXTCLOUD_IMAGE:-nextcloud:31-apache}
|
||||
container_name: ${OFFICE_NEXTCLOUD_CONTAINER_NAME:-homelab-office-nextcloud}
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- postgres
|
||||
- redis
|
||||
environment:
|
||||
POSTGRES_HOST: postgres
|
||||
POSTGRES_DB: ${OFFICE_POSTGRES_DB:-nextcloud}
|
||||
POSTGRES_USER: ${OFFICE_POSTGRES_USER:-nextcloud}
|
||||
POSTGRES_PASSWORD: ${OFFICE_POSTGRES_PASSWORD:?OFFICE_POSTGRES_PASSWORD is required}
|
||||
REDIS_HOST: redis
|
||||
REDIS_HOST_PASSWORD: ${OFFICE_REDIS_PASSWORD:?OFFICE_REDIS_PASSWORD is required}
|
||||
NEXTCLOUD_TRUSTED_DOMAINS: ${OFFICE_PUBLIC_HOST:-office.lab2025.duckdns.org} localhost
|
||||
NEXTCLOUD_ADMIN_USER: ${OFFICE_ADMIN_USER:-jv}
|
||||
NEXTCLOUD_ADMIN_PASSWORD: ${OFFICE_ADMIN_PASSWORD:?OFFICE_ADMIN_PASSWORD is required}
|
||||
OVERWRITEHOST: ${OFFICE_PUBLIC_HOST:-office.lab2025.duckdns.org}
|
||||
OVERWRITEPROTOCOL: https
|
||||
OVERWRITECLIURL: https://${OFFICE_PUBLIC_HOST:-office.lab2025.duckdns.org}
|
||||
ports:
|
||||
- "${OFFICE_BIND_IP:-127.0.0.1}:${OFFICE_HTTP_PORT:-8090}:80"
|
||||
volumes:
|
||||
- ${OFFICE_NEXTCLOUD_DATA_DIR:-/data/homelab-office/nextcloud}:/var/www/html
|
||||
networks: [office]
|
||||
|
||||
collabora:
|
||||
image: ${OFFICE_COLLABORA_IMAGE:-collabora/code:latest}
|
||||
container_name: ${OFFICE_COLLABORA_CONTAINER_NAME:-homelab-office-collabora}
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
aliasgroup1: https://${OFFICE_PUBLIC_HOST:-office.lab2025.duckdns.org}:443
|
||||
dictionaries: ${OFFICE_COLLABORA_DICTIONARIES:-en_US es_MX}
|
||||
extra_params: >-
|
||||
--o:ssl.enable=false
|
||||
--o:ssl.termination=true
|
||||
--o:welcome.enable=false
|
||||
--o:logging.level=warning
|
||||
ports:
|
||||
- "${OFFICE_BIND_IP:-127.0.0.1}:${OFFICE_COLLABORA_PORT:-9980}:9980"
|
||||
networks: [office]
|
||||
|
||||
networks:
|
||||
office:
|
||||
name: ${OFFICE_NETWORK:-homelab-office}
|
||||
5
jeannie
5
jeannie
|
|
@ -56,7 +56,6 @@ Build And Bootstrap
|
|||
deploy-api Deploy the Temporal-backed Jeannie API on Debian.
|
||||
deploy-heimdall Deploy the Debian-hosted Heimdall dashboard.
|
||||
deploy-dex Deploy the Debian-hosted Dex SSO stack.
|
||||
deploy-office Deploy Nextcloud + Collabora online office.
|
||||
deploy-matrix Deploy the Matrix homeserver (Synapse + Element + Postgres).
|
||||
deploy-ai-stack Deploy the Debian-hosted AI gateway stack.
|
||||
deploy-ai-tools Install/wire local AI CLIs to the AI gateway.
|
||||
|
|
@ -410,10 +409,6 @@ case "${1:-}" in
|
|||
record_change_journal "deploy-dex" "$@"
|
||||
deploy_dex
|
||||
;;
|
||||
deploy-office)
|
||||
record_change_journal "deploy-office" "$@"
|
||||
deploy_office
|
||||
;;
|
||||
deploy-matrix)
|
||||
record_change_journal "deploy-matrix" "$@"
|
||||
deploy_matrix
|
||||
|
|
|
|||
|
|
@ -54,10 +54,6 @@ mapping = {
|
|||
"services.dex.http_port": "LAB_DEX_HTTP_PORT",
|
||||
"services.dex.telemetry_port": "LAB_DEX_TELEMETRY_PORT",
|
||||
"services.dex.public_url": "LAB_DEX_PUBLIC_URL",
|
||||
"services.office.install_dir": "LAB_OFFICE_INSTALL_DIR",
|
||||
"services.office.http_port": "LAB_OFFICE_HTTP_PORT",
|
||||
"services.office.collabora_port": "LAB_OFFICE_COLLABORA_PORT",
|
||||
"services.office.public_url": "LAB_OFFICE_PUBLIC_URL",
|
||||
"services.jellyfin.http_port": "LAB_JELLYFIN_HTTP_PORT",
|
||||
"services.jellyfin.public_url": "LAB_JELLYFIN_PUBLIC_URL",
|
||||
"services.jeannie_api.http_port": "LAB_JEANNIE_API_BACKEND_PORT",
|
||||
|
|
@ -287,10 +283,6 @@ export_homelab_inventory_tf_vars() {
|
|||
export_if_unset TF_VAR_gitea_auth_source_name "${LAB_GITEA_DEX_SOURCE_NAME:-dex}"
|
||||
export_if_unset TF_VAR_jellyfin_backend_host "${LAB_JELLYFIN_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-}}"
|
||||
export_if_unset TF_VAR_jellyfin_backend_port "${LAB_JELLYFIN_HTTP_PORT:-}"
|
||||
export_if_unset TF_VAR_office_server_name "${LAB_OFFICE_PUBLIC_HOST:-office.${LAB_DOMAIN:-lab2025.duckdns.org}}"
|
||||
export_if_unset TF_VAR_office_backend_host "${LAB_OFFICE_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-${LAB_DEBIAN_LAN_IP:-}}}"
|
||||
export_if_unset TF_VAR_office_backend_port "${LAB_OFFICE_HTTP_PORT:-8090}"
|
||||
export_if_unset TF_VAR_office_tailscale_cidr "${LAB_TAILSCALE_CGNAT_CIDR:-100.64.0.0/10}"
|
||||
export_if_unset TF_VAR_jeannie_api_backend_host "${LAB_JEANNIE_API_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-${LAB_DEBIAN_LAN_IP:-}}}"
|
||||
export_if_unset TF_VAR_jeannie_api_backend_port "${LAB_JEANNIE_API_BACKEND_PORT:-8787}"
|
||||
export_if_unset TF_VAR_gitops_repo_url "${LAB_GITOPS_REPO_URL:-}"
|
||||
|
|
|
|||
|
|
@ -796,20 +796,6 @@ render_dex_config() {
|
|||
local user_name="$8"
|
||||
local user_id="$9"
|
||||
local user_password_hash="${10}"
|
||||
local office_public_url="${11:-}"
|
||||
local office_client_secret="${12:-}"
|
||||
local office_client_block=""
|
||||
|
||||
if [[ -n "${office_public_url}" && -n "${office_client_secret}" ]]; then
|
||||
office_client_block="$(cat <<OFFICE_CLIENT_EOF
|
||||
- id: nextcloud
|
||||
name: Nextcloud
|
||||
secret: "${office_client_secret}"
|
||||
redirectURIs:
|
||||
- ${office_public_url%/}/apps/user_oidc/code
|
||||
OFFICE_CLIENT_EOF
|
||||
)"
|
||||
fi
|
||||
|
||||
cat <<CONFIG_EOF
|
||||
issuer: ${public_url}
|
||||
|
|
@ -843,7 +829,6 @@ staticClients:
|
|||
secret: "${gitea_client_secret}"
|
||||
redirectURIs:
|
||||
- ${gitea_public_url}/user/oauth2/${gitea_source_name}/callback
|
||||
${office_client_block}
|
||||
|
||||
staticPasswords:
|
||||
- email: "${user_email}"
|
||||
|
|
@ -866,8 +851,6 @@ deploy_dex() {
|
|||
local gitea_url="${LAB_GITEA_ROOT_URL:-}"
|
||||
local grafana_url="https://grafana.${LAB_DOMAIN:-lab2025.duckdns.org}"
|
||||
local gitea_source_name="${LAB_GITEA_DEX_SOURCE_NAME:-dex}"
|
||||
local office_public_url="${LAB_OFFICE_PUBLIC_URL:-https://office.${LAB_DOMAIN:-lab2025.duckdns.org}}"
|
||||
local office_client_secret="${LAB_OFFICE_OIDC_CLIENT_SECRET:-}"
|
||||
local dex_env
|
||||
local dex_user_password_hash
|
||||
local dex_uid="${LAB_DEX_CONTAINER_UID:-1001}"
|
||||
|
|
@ -900,7 +883,6 @@ deploy_dex() {
|
|||
|
||||
dex_env="$(dex_secret_values)" || exit 1
|
||||
eval "${dex_env}"
|
||||
office_client_secret="${office_client_secret:-${DEX_OFFICE_CLIENT_SECRET:-}}"
|
||||
|
||||
echo "Deploying Dex on the Debian host at ${install_dir}..."
|
||||
|
||||
|
|
@ -926,9 +908,7 @@ deploy_dex() {
|
|||
"${DEX_USER_EMAIL}" \
|
||||
"${DEX_USER_NAME}" \
|
||||
"${DEX_USER_ID}" \
|
||||
"${dex_user_password_hash}" \
|
||||
"${office_public_url}" \
|
||||
"${office_client_secret}" |
|
||||
"${dex_user_password_hash}" |
|
||||
sudo tee "${install_dir}/config.yaml" >/dev/null
|
||||
sudo chown "${dex_uid}:${dex_gid}" "${install_dir}/config.yaml"
|
||||
sudo chown -R "${dex_uid}:${dex_gid}" "${data_dir}"
|
||||
|
|
@ -966,104 +946,6 @@ ENV_EOF
|
|||
echo "Initial Dex user: ${DEX_USER_EMAIL}"
|
||||
}
|
||||
|
||||
deploy_office() {
|
||||
local mode="${LAB_OFFICE_DEPLOY:-true}"
|
||||
local install_dir="${LAB_OFFICE_INSTALL_DIR:-/data/homelab-office}"
|
||||
local source_dir="${REPO_ROOT}/infra/office"
|
||||
local public_host="${LAB_OFFICE_PUBLIC_HOST:-office.${LAB_DOMAIN:-lab2025.duckdns.org}}"
|
||||
local bind_ip="${LAB_OFFICE_BIND_IP:-0.0.0.0}"
|
||||
local http_port="${LAB_OFFICE_HTTP_PORT:-8090}"
|
||||
local collabora_port="${LAB_OFFICE_COLLABORA_PORT:-9980}"
|
||||
local env_file="${install_dir}/.env"
|
||||
local nextcloud_data_dir="${install_dir}/nextcloud"
|
||||
local postgres_data_dir="${install_dir}/postgres"
|
||||
local redis_data_dir="${install_dir}/redis"
|
||||
local random_value
|
||||
local dex_env
|
||||
local office_oidc_secret="${LAB_OFFICE_OIDC_CLIENT_SECRET:-}"
|
||||
|
||||
require_debian_server "deploy-office"
|
||||
if disabled_value "${mode}"; then
|
||||
return 0
|
||||
fi
|
||||
if [[ ! -s "${source_dir}/docker-compose.yml" ]]; then
|
||||
echo "Missing office stack source files in ${source_dir}." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ensure_local_docker_compose "OFFICE" "${LAB_OFFICE_INSTALL_DOCKER:-false}"
|
||||
repair_local_docker_iptables
|
||||
if [[ -z "${office_oidc_secret}" ]]; then
|
||||
dex_env="$(dex_secret_values)" || exit 1
|
||||
eval "${dex_env}"
|
||||
office_oidc_secret="${DEX_OFFICE_CLIENT_SECRET:-}"
|
||||
fi
|
||||
if [[ -z "${office_oidc_secret}" ]]; then
|
||||
echo "Office SSO secret is missing. Run ./jeannie dex-secret ensure or set LAB_OFFICE_OIDC_CLIENT_SECRET." >&2
|
||||
exit 1
|
||||
fi
|
||||
sudo mkdir -p "${install_dir}" "${nextcloud_data_dir}" "${postgres_data_dir}" "${redis_data_dir}"
|
||||
sudo cp "${source_dir}/docker-compose.yml" "${install_dir}/docker-compose.yml"
|
||||
|
||||
if ! sudo test -s "${env_file}"; then
|
||||
random_value() {
|
||||
if command -v openssl >/dev/null 2>&1; then
|
||||
openssl rand -hex 32
|
||||
else
|
||||
python3 - <<'PY'
|
||||
import secrets
|
||||
print(secrets.token_hex(32))
|
||||
PY
|
||||
fi
|
||||
}
|
||||
random_value="$(random_value)"
|
||||
sudo tee "${env_file}" >/dev/null <<ENV_EOF
|
||||
OFFICE_PUBLIC_HOST=${public_host}
|
||||
OFFICE_BIND_IP=${bind_ip}
|
||||
OFFICE_HTTP_PORT=${http_port}
|
||||
OFFICE_COLLABORA_PORT=${collabora_port}
|
||||
OFFICE_POSTGRES_PASSWORD=${random_value}
|
||||
OFFICE_REDIS_PASSWORD=$(random_value)
|
||||
OFFICE_ADMIN_USER=${LAB_OFFICE_ADMIN_USER:-jv}
|
||||
OFFICE_ADMIN_PASSWORD=$(random_value)
|
||||
OFFICE_OIDC_CLIENT_ID=nextcloud
|
||||
OFFICE_OIDC_CLIENT_SECRET=${office_oidc_secret}
|
||||
OFFICE_OIDC_ISSUER_URL=${LAB_DEX_PUBLIC_URL:-https://auth.${LAB_DOMAIN:-lab2025.duckdns.org}}
|
||||
OFFICE_NEXTCLOUD_DATA_DIR=${nextcloud_data_dir}
|
||||
OFFICE_POSTGRES_DATA_DIR=${postgres_data_dir}
|
||||
OFFICE_REDIS_DATA_DIR=${redis_data_dir}
|
||||
ENV_EOF
|
||||
sudo chmod 600 "${env_file}"
|
||||
elif ! sudo grep -q '^OFFICE_ADMIN_PASSWORD=' "${env_file}"; then
|
||||
random_value="$(openssl rand -hex 32 2>/dev/null || python3 -c 'import secrets; print(secrets.token_hex(32))')"
|
||||
printf 'OFFICE_ADMIN_USER=%s\nOFFICE_ADMIN_PASSWORD=%s\n' \
|
||||
"${LAB_OFFICE_ADMIN_USER:-jv}" "${random_value}" | sudo tee -a "${env_file}" >/dev/null
|
||||
sudo chmod 600 "${env_file}"
|
||||
fi
|
||||
|
||||
(
|
||||
cd "${install_dir}"
|
||||
sudo docker compose --env-file "${env_file}" pull
|
||||
sudo docker compose --env-file "${env_file}" up -d --remove-orphans
|
||||
sudo docker compose --env-file "${env_file}" ps
|
||||
)
|
||||
|
||||
if ! curl -fsS --connect-timeout 5 "http://127.0.0.1:${http_port}/status.php" >/dev/null; then
|
||||
echo "Nextcloud did not become reachable at http://127.0.0.1:${http_port}/status.php." >&2
|
||||
(cd "${install_dir}" && sudo docker compose --env-file "${env_file}" logs --tail=120) >&2 || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo docker exec "${OFFICE_NEXTCLOUD_CONTAINER_NAME:-homelab-office-nextcloud}" \
|
||||
sh -lc 'su -s /bin/sh www-data -c "php occ app:install richdocuments 2>/dev/null || true; php occ app:enable richdocuments 2>/dev/null || true; php occ config:app:set richdocuments wopi_url --value=http://collabora:9980 2>/dev/null || true; php occ app:install user_oidc 2>/dev/null || true; php occ app:enable user_oidc 2>/dev/null || true"' || true
|
||||
sudo docker exec -e "OIDC_CLIENT_SECRET=${office_oidc_secret}" \
|
||||
-e "OIDC_ISSUER=${LAB_DEX_PUBLIC_URL:-https://auth.${LAB_DOMAIN:-lab2025.duckdns.org}}" \
|
||||
"${OFFICE_NEXTCLOUD_CONTAINER_NAME:-homelab-office-nextcloud}" \
|
||||
sh -lc 'su -s /bin/sh www-data -c "php occ user_oidc:provider nextcloud --clientid=nextcloud --clientsecret=\"$OIDC_CLIENT_SECRET\" --discoveryuri=\"$OIDC_ISSUER/.well-known/openid-configuration\" --scope=openid,profile,email 2>/dev/null || true"' || true
|
||||
echo "Office stack is running at https://${public_host}/ through the Tailscale-restricted edge route."
|
||||
echo "Nextcloud data: ${nextcloud_data_dir}; Collabora backend: http://127.0.0.1:${collabora_port}."
|
||||
}
|
||||
|
||||
configure_grafana_dex_secret() {
|
||||
local namespace="${TF_VAR_grafana_namespace:-monitoring}"
|
||||
local secret_name="${TF_VAR_grafana_oauth_secret_name:-grafana-dex-oauth}"
|
||||
|
|
|
|||
|
|
@ -229,7 +229,6 @@ ensure_dex_secret_file() {
|
|||
local tmp_file
|
||||
local grafana_client_secret
|
||||
local gitea_client_secret
|
||||
local office_client_secret
|
||||
local user_password
|
||||
local user_email="${HOMELAB_DEX_USER_EMAIL:-jv@lab2025.duckdns.org}"
|
||||
local user_name="${HOMELAB_DEX_USER_NAME:-jv}"
|
||||
|
|
@ -248,7 +247,6 @@ ensure_dex_secret_file() {
|
|||
tmp_file="$(mktemp)"
|
||||
grafana_client_secret="$(generate_dex_secret_value)"
|
||||
gitea_client_secret="$(generate_dex_secret_value)"
|
||||
office_client_secret="$(generate_dex_secret_value)"
|
||||
user_password="$(generate_dex_secret_value)"
|
||||
user_id="$(generate_dex_user_id)"
|
||||
|
||||
|
|
@ -266,7 +264,6 @@ ensure_dex_secret_file() {
|
|||
printf 'stringData:\n'
|
||||
printf ' DEX_GRAFANA_CLIENT_SECRET: "%s"\n' "${grafana_client_secret}"
|
||||
printf ' DEX_GITEA_CLIENT_SECRET: "%s"\n' "${gitea_client_secret}"
|
||||
printf ' DEX_OFFICE_CLIENT_SECRET: "%s"\n' "${office_client_secret}"
|
||||
printf ' DEX_USER_EMAIL: "%s"\n' "${user_email}"
|
||||
printf ' DEX_USER_NAME: "%s"\n' "${user_name}"
|
||||
printf ' DEX_USER_ID: "%s"\n' "${user_id}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue