Keep Hermes Matrix connection and edge certificates configured
This commit is contained in:
parent
f8adb4dcdb
commit
20b005be8d
|
|
@ -25,8 +25,8 @@ locals {
|
|||
jeannie_api_server_name = "api.${var.server_name}"
|
||||
office_server_name = var.office_server_name
|
||||
office_onlyoffice_server_name = var.office_onlyoffice_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, local.office_onlyoffice_server_name], var.additional_server_names))
|
||||
matrix_server_names = var.matrix_enabled ? [var.matrix_server_name, var.element_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, local.office_onlyoffice_server_name], local.matrix_server_names, var.additional_server_names))
|
||||
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, local.office_onlyoffice_server_name], name) && !contains(local.matrix_server_names, name)]
|
||||
default_conf = templatefile("${path.module}/templates/default.conf.tftpl", {
|
||||
server_name = var.server_name
|
||||
|
|
@ -116,6 +116,9 @@ resource "null_resource" "edge_services" {
|
|||
office_host = var.office_backend_host
|
||||
office_port = tostring(var.office_backend_port)
|
||||
matrix_server_name = var.matrix_server_name
|
||||
element_server_name = var.element_server_name
|
||||
matrix_enabled = tostring(var.matrix_enabled)
|
||||
certificate_sync_revision = "matrix-san-v1"
|
||||
enable_letsencrypt = tostring(var.enable_letsencrypt)
|
||||
letsencrypt_email = var.letsencrypt_email
|
||||
letsencrypt_staging = tostring(var.letsencrypt_staging)
|
||||
|
|
@ -193,6 +196,8 @@ tailscale_auth_key='${var.edge_tailscale_auth_key}'
|
|||
tailscale_tag='${var.edge_tailscale_tag}'
|
||||
server_name="${self.triggers.server_name}"
|
||||
matrix_server_name="${self.triggers.matrix_server_name}"
|
||||
element_server_name="${self.triggers.element_server_name}"
|
||||
matrix_enabled="${self.triggers.matrix_enabled}"
|
||||
server_names="${self.triggers.server_names}"
|
||||
certbot_domain_args="${self.triggers.certbot_domain_args}"
|
||||
backend_host="${self.triggers.backend_host}"
|
||||
|
|
@ -339,6 +344,18 @@ deploy_current_certificate() {
|
|||
sudo cp -L "$install_dir/letsencrypt/live/$server_name/privkey.pem" "$install_dir/certs/current.key"
|
||||
sudo chmod 0644 "$install_dir/certs/current.crt"
|
||||
sudo chmod 0600 "$install_dir/certs/current.key"
|
||||
if [ "$matrix_enabled" = "true" ]; then
|
||||
if sudo openssl x509 -in "$install_dir/certs/current.crt" -noout -checkend 0 >/dev/null &&
|
||||
sudo openssl x509 -in "$install_dir/certs/current.crt" -noout -checkhost "$matrix_server_name" | grep -Fq 'does match certificate' &&
|
||||
sudo openssl x509 -in "$install_dir/certs/current.crt" -noout -checkhost "$element_server_name" | grep -Fq 'does match certificate'; then
|
||||
sudo cp -L "$install_dir/certs/current.crt" "$install_dir/certs/matrix.crt"
|
||||
sudo cp -L "$install_dir/certs/current.key" "$install_dir/certs/matrix.key"
|
||||
sudo chmod 0644 "$install_dir/certs/matrix.crt"
|
||||
sudo chmod 0600 "$install_dir/certs/matrix.key"
|
||||
else
|
||||
echo "Shared certificate does not cover both Matrix and Element or has expired; retaining existing Matrix certificate." >&2
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
letsencrypt_certificate_present() {
|
||||
|
|
@ -377,6 +394,18 @@ if [ -s "$install_dir/letsencrypt/live/$server_name/fullchain.pem" ] &&
|
|||
cp -L "$install_dir/letsencrypt/live/$server_name/privkey.pem" "$install_dir/certs/current.key"
|
||||
chmod 0644 "$install_dir/certs/current.crt"
|
||||
chmod 0600 "$install_dir/certs/current.key"
|
||||
if [ "$matrix_enabled" = "true" ]; then
|
||||
if openssl x509 -in "$install_dir/certs/current.crt" -noout -checkend 0 >/dev/null &&
|
||||
openssl x509 -in "$install_dir/certs/current.crt" -noout -checkhost "$matrix_server_name" | grep -Fq 'does match certificate' &&
|
||||
openssl x509 -in "$install_dir/certs/current.crt" -noout -checkhost "$element_server_name" | grep -Fq 'does match certificate'; then
|
||||
cp -L "$install_dir/certs/current.crt" "$install_dir/certs/matrix.crt"
|
||||
cp -L "$install_dir/certs/current.key" "$install_dir/certs/matrix.key"
|
||||
chmod 0644 "$install_dir/certs/matrix.crt"
|
||||
chmod 0600 "$install_dir/certs/matrix.key"
|
||||
else
|
||||
echo "Shared certificate does not cover both Matrix and Element or has expired; retaining existing Matrix certificate." >&2
|
||||
fi
|
||||
fi
|
||||
cd "$install_dir"
|
||||
docker compose exec -T nginx-dev nginx -s reload || docker compose restart nginx-dev
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -114,6 +114,13 @@ ran `hermes-connect` is recorded as the plugin's Jeannie source. Runbook lookup
|
|||
requires an existing `./jeannie ai-index`. OmniRoute may use an external model
|
||||
provider, depending on the configured route.
|
||||
|
||||
Hermes uses the HTTPS Matrix homeserver URL. The edge requests Matrix and Element
|
||||
names on its shared Let's Encrypt certificate and copies it to their isolated
|
||||
files on deployment and renewal only when it is unexpired and covers both names.
|
||||
Otherwise it retains the existing Matrix certificate and logs a warning. Run
|
||||
`./jeannie edge apply` to install the updated renewal script. `./jeannie
|
||||
deploy-hermes` regenerates the Hermes environment and restarts its gateway.
|
||||
|
||||
## AI Evals
|
||||
|
||||
The repo includes a local eval harness for Jeannie explanations and homelab RAG
|
||||
|
|
|
|||
|
|
@ -114,6 +114,14 @@ ran `hermes-connect` is recorded as the plugin's Jeannie source. Runbook lookup
|
|||
requires an existing `./{{ main_script }} ai-index`. OmniRoute may use an
|
||||
external model provider, depending on the configured route.
|
||||
|
||||
Hermes uses the HTTPS Matrix homeserver URL. The edge requests Matrix and Element
|
||||
names on its shared Let's Encrypt certificate and copies it to their isolated
|
||||
files on deployment and renewal only when it is unexpired and covers both names.
|
||||
Otherwise it retains the existing Matrix certificate and logs a warning. Run
|
||||
`./{{ main_script }} edge apply` to install the updated renewal script.
|
||||
`./{{ main_script }} deploy-hermes` regenerates the Hermes environment and
|
||||
restarts its gateway.
|
||||
|
||||
## AI Evals
|
||||
|
||||
The repo includes a local eval harness for Jeannie explanations and homelab RAG
|
||||
|
|
|
|||
|
|
@ -6081,7 +6081,7 @@ OPENAI_BASE_URL=${hermes_openai_base_url}
|
|||
OPENAI_API_KEY=${hermes_omniroute_api_key}
|
||||
HERMES_MODEL=${hermes_model}
|
||||
HERMES_CUSTOM_LOCALHOST_${LAB_OMNIROUTE_PORT:-20128}_API_KEY=${hermes_omniroute_api_key}
|
||||
MATRIX_HOMESERVER=${LAB_MATRIX_SERVER_NAME:-matrix.lab2025.duckdns.org}
|
||||
MATRIX_HOMESERVER=https://${LAB_MATRIX_SERVER_NAME:-matrix.lab2025.duckdns.org}
|
||||
MATRIX_USER_ID=${HERMES_MATRIX_USER_ID:-@hermes:matrix.lab2025.duckdns.org}
|
||||
MATRIX_PASSWORD=${MATRIX_BOT_PASSWORD:-}
|
||||
MATRIX_ALLOWED_USERS=${HERMES_MATRIX_ALLOWED_USERS:-@jv:matrix.lab2025.duckdns.org}
|
||||
|
|
|
|||
Loading…
Reference in New Issue