Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
de9de2716a | |||
c8543f2ce7 | |||
5b894d0007 | |||
8dd4256576 | |||
32fbfc761c | |||
fc2331f951 | |||
f2400f2144 | |||
37dcd82f2d | |||
e2bdccb8fa | |||
3ed6a4ec45 | |||
298901b14a | |||
f74286c0e2 | |||
3017d80d8a | |||
1abe0f8d37 | |||
b78d74390b | |||
abb225d362 | |||
2f4e00a44e | |||
1212109d47 |
8
.env
8
.env
@ -1,6 +1,8 @@
|
|||||||
PROD_URL=matrix.gmoker.com
|
PROD_URL=matrix.gmoker.com
|
||||||
SERVER_NAME=gmoker.com
|
SERVER_NAME=gmoker.com
|
||||||
IMAGEAPP=ghcr.io/element-hq/synapse:v1.106.0
|
IMAGEAPP=ghcr.io/element-hq/synapse:v1.121.1
|
||||||
|
|
||||||
TURN_URL=turn.test.gmoker.com
|
#TURN_URL=turn.test.gmoker.com
|
||||||
IMAGECOTURN=docker.io/coturn/coturn:4.6.2
|
#IMAGECOTURN=docker.io/coturn/coturn:4.6.2-r12
|
||||||
|
|
||||||
|
MAX_UPLOAD_SIZE=50M
|
||||||
|
@ -12,10 +12,11 @@ jobs:
|
|||||||
BASE_URL="$PROD_URL"
|
BASE_URL="$PROD_URL"
|
||||||
else
|
else
|
||||||
BASE_URL="${{ gitea.ref_name }}.$(tr / '\n' <<< "${{ gitea.repository }}" | tac | tr '\n' .)k8s.gmoker.com"
|
BASE_URL="${{ gitea.ref_name }}.$(tr / '\n' <<< "${{ gitea.repository }}" | tac | tr '\n' .)k8s.gmoker.com"
|
||||||
|
SERVER_NAME="$BASE_URL"
|
||||||
fi
|
fi
|
||||||
cat <<EOF >> .env
|
cat <<EOF >> .env
|
||||||
BASE_URL="$BASE_URL"
|
BASE_URL="$BASE_URL"
|
||||||
PUBLIC_URL="${PUBLIC_URL:-$BASE_URL}"
|
SERVER_NAME="$SERVER_NAME"
|
||||||
EOF
|
EOF
|
||||||
cat .env
|
cat .env
|
||||||
|
|
||||||
|
13
compose.yaml
13
compose.yaml
@ -1,12 +1,12 @@
|
|||||||
---
|
---
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
image: docker.io/postgres:15
|
image: docker.io/postgres:17
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_DB
|
- POSTGRES_DB=db
|
||||||
- POSTGRES_USER
|
- POSTGRES_USER=db
|
||||||
- POSTGRES_PASSWORD
|
- POSTGRES_PASSWORD=db
|
||||||
volumes:
|
volumes:
|
||||||
- db:/var/lib/postgresql/data/
|
- db:/var/lib/postgresql/data/
|
||||||
|
|
||||||
@ -16,6 +16,11 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "8080:8008"
|
- "8080:8008"
|
||||||
- "8448:8448"
|
- "8448:8448"
|
||||||
|
environment:
|
||||||
|
- POSTGRES_HOST=db
|
||||||
|
- POSTGRES_DB=db
|
||||||
|
- POSTGRES_USER=db
|
||||||
|
- POSTGRES_PASSWORD=db
|
||||||
volumes:
|
volumes:
|
||||||
- synapse_config:/config/
|
- synapse_config:/config/
|
||||||
- synapse_data:/data/
|
- synapse_data:/data/
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
server_name: "$SERVER_NAME"
|
server_name: "$SERVER_NAME"
|
||||||
public_baseurl: "https://$BASE_URL"
|
public_baseurl: "https://$BASE_URL"
|
||||||
pid_file: /homeserver.pid
|
pid_file: /homeserver.pid
|
||||||
web_client: false
|
web_client: False
|
||||||
soft_file_limit: 0
|
soft_file_limit: 0
|
||||||
log_config: "/config/log.config"
|
log_config: "/config/log.config"
|
||||||
|
|
||||||
listeners:
|
listeners:
|
||||||
- port: 8008
|
- port: 8008
|
||||||
tls: false
|
tls: False
|
||||||
type: http
|
|
||||||
x_forwarded: true
|
|
||||||
bind_addresses: ['::']
|
bind_addresses: ['::']
|
||||||
|
type: http
|
||||||
|
x_forwarded: False
|
||||||
resources:
|
resources:
|
||||||
- names: [client, federation]
|
- names: [client, federation]
|
||||||
compress: true
|
compress: true
|
||||||
@ -39,7 +39,7 @@ federation_rc_concurrent: 3
|
|||||||
media_store_path: "/data/media"
|
media_store_path: "/data/media"
|
||||||
max_upload_size: "50M"
|
max_upload_size: "50M"
|
||||||
max_image_pixels: "32M"
|
max_image_pixels: "32M"
|
||||||
dynamic_thumbnails: false
|
dynamic_thumbnails: False
|
||||||
|
|
||||||
thumbnail_sizes:
|
thumbnail_sizes:
|
||||||
- width: 32
|
- width: 32
|
||||||
@ -58,24 +58,23 @@ thumbnail_sizes:
|
|||||||
height: 600
|
height: 600
|
||||||
method: scale
|
method: scale
|
||||||
|
|
||||||
url_preview_enabled: false
|
url_preview_enabled: False
|
||||||
max_spider_size: "10M"
|
max_spider_size: "10M"
|
||||||
|
|
||||||
enable_registration_captcha: false
|
enable_registration_captcha: False
|
||||||
|
|
||||||
turn_uris: [ "turn:$TURN_URL?transport=tcp", "turn:$TURN_URL?transport=udp" ]
|
turn_uris: [ "turn:$TURN_URL?transport=tcp", "turn:$TURN_URL?transport=udp" ]
|
||||||
turn_shared_secret: "$TURN_SHARED_SECRET"
|
turn_shared_secret: "$TURN_SHARED_SECRET"
|
||||||
turn_user_lifetime: "1h"
|
turn_user_lifetime: "1h"
|
||||||
turn_allow_guests: true
|
turn_allow_guests: True
|
||||||
|
|
||||||
enable_registration: false
|
enable_registration: False
|
||||||
registration_shared_secret: "$REGISTRATION_SECRET"
|
registration_shared_secret: "$REGISTRATION_SECRET"
|
||||||
|
|
||||||
enable_metrics: true
|
enable_metrics: True
|
||||||
report_stats: true
|
report_stats: True
|
||||||
|
|
||||||
macaroon_secret_key: "$API_SECRET"
|
macaroon_secret_key: "$API_SECRET"
|
||||||
expire_access_token: false
|
|
||||||
|
|
||||||
signing_key_path: "/keys/signing.key"
|
signing_key_path: "/keys/signing.key"
|
||||||
key_refresh_interval: "1d"
|
key_refresh_interval: "1d"
|
||||||
@ -86,6 +85,6 @@ trusted_key_servers:
|
|||||||
"ed25519:auto": "Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw"
|
"ed25519:auto": "Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw"
|
||||||
|
|
||||||
password_config:
|
password_config:
|
||||||
enabled: true
|
enabled: True
|
||||||
|
|
||||||
encryption_enabled_by_default_for_room_type: "all"
|
encryption_enabled_by_default_for_room_type: "all"
|
@ -1,37 +1,40 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash
|
||||||
set -o pipefail
|
set -xeo pipefail
|
||||||
|
|
||||||
function kapply() {
|
function kapply() {
|
||||||
for f in "$@"; do
|
for f in "$@"; do
|
||||||
kubectl apply -f \
|
kubectl apply -f <(envsubst < "manifests/$f")
|
||||||
<(envsubst "$(env | xargs printf '$%s ')" < "manifests/$f")
|
|
||||||
done
|
done
|
||||||
}
|
}; export -f kapply
|
||||||
|
|
||||||
function kcreatesec() {
|
function kcreatesec() {
|
||||||
kubectl create secret generic --save-config --dry-run=client -oyaml "$@" | kubectl apply -f-
|
kubectl create secret generic --dry-run=client -oyaml "$@" | kubectl replace -f-
|
||||||
}
|
}; export -f kcreatesec
|
||||||
|
|
||||||
function kcreatecm() {
|
function kcreatecm() {
|
||||||
kubectl create configmap --dry-run=client -oyaml "$@" | kubectl apply -f-
|
kubectl create configmap --dry-run=client -oyaml "$@" | kubectl replace -f-
|
||||||
}
|
}; export -f kcreatecm
|
||||||
|
|
||||||
function kgseckey() {
|
function kgseckey() {
|
||||||
local sec="$1"; shift
|
local sec="$1"; shift
|
||||||
local key="$1"; shift
|
local key="$1"; shift
|
||||||
|
|
||||||
kubectl get secret "$sec" -o jsonpath="{.data.$key}" | base64 -d
|
if ! kubectl get secret "$sec" -ojson | jq -re ".data.\"$key\" // empty" | base64 -d; then
|
||||||
}
|
return 1
|
||||||
|
fi
|
||||||
|
}; export -f kgseckey
|
||||||
|
|
||||||
function kgcmkey() {
|
function kgcmkey() {
|
||||||
local cm="$1"; shift
|
local cm="$1"; shift
|
||||||
local key="$1"; shift
|
local key="$1"; shift
|
||||||
|
|
||||||
kubectl get configmap "$cm" -o jsonpath="{.data.$key}"
|
if ! kubectl get configmap "$cm" -ojson | jq -re ".data.\"$key\" // empty"; then
|
||||||
}
|
return 1
|
||||||
|
fi
|
||||||
|
}; export -f kgcmkey
|
||||||
|
|
||||||
function get_synapse_key() {
|
function get_synapse_key() {
|
||||||
kgcmkey synapse-config 'homeserver\.yaml' | awk -F\" "/^\s*$1/{print \$2}" || openssl rand -hex 32
|
kgcmkey synapse homeserver.yaml | awk -F\" "/^\s*$1/{print \$2}" || openssl rand -hex 32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -47,11 +50,10 @@ export API_SECRET; API_SECRET="$(get_synapse_key macaroon_secr
|
|||||||
export TURN_SHARED_SECRET; TURN_SHARED_SECRET="$(get_synapse_key turn_shared_secret)"
|
export TURN_SHARED_SECRET; TURN_SHARED_SECRET="$(get_synapse_key turn_shared_secret)"
|
||||||
export REGISTRATION_SECRET; REGISTRATION_SECRET="$(get_synapse_key registration_shared_secret)"
|
export REGISTRATION_SECRET; REGISTRATION_SECRET="$(get_synapse_key registration_shared_secret)"
|
||||||
|
|
||||||
kcreatecm synapse-config \
|
kcreatecm synapse \
|
||||||
--from-file=homeserver.yaml=<(envsubst "$(env | xargs printf '$%s ')" < homeserver.yaml) \
|
--from-file=homeserver.yaml=<(envsubst < config/homeserver.yaml) \
|
||||||
--from-file=log.config=<(envsubst "$(env | xargs printf '$%s ')" < log.config)
|
--from-file=log.config=<(envsubst < config/log.config)
|
||||||
|
|
||||||
kapply common/keys.yaml common/app.yaml common/delegation.yaml
|
kapply common/keys.yaml common/app.yaml
|
||||||
|
|
||||||
kubectl rollout restart deployment delegation
|
|
||||||
kubectl rollout restart statefulset app
|
kubectl rollout restart statefulset app
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
export NB_REPLICAS=1
|
export NB_REPLICAS=1
|
||||||
|
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash
|
||||||
|
set -eo pipefail
|
||||||
|
|
||||||
# TODO: 3
|
# TODO: 3
|
||||||
export NB_REPLICAS=1
|
export NB_REPLICAS=1
|
||||||
|
|
||||||
. ./manifests/bin/deploy.sh
|
. ./manifests/bin/deploy.sh
|
||||||
|
|
||||||
|
if [ "$GITHUB_REF_NAME" = prod ]; then
|
||||||
|
kapply common/delegation.yaml
|
||||||
|
|
||||||
|
kubectl rollout restart deployment delegation
|
||||||
|
fi
|
||||||
|
@ -4,6 +4,7 @@ kind: Ingress
|
|||||||
metadata:
|
metadata:
|
||||||
name: app
|
name: app
|
||||||
annotations:
|
annotations:
|
||||||
|
nginx.ingress.kubernetes.io/proxy-body-size: "$MAX_UPLOAD_SIZE"
|
||||||
cert-manager.io/cluster-issuer: letsencrypt-prod
|
cert-manager.io/cluster-issuer: letsencrypt-prod
|
||||||
spec:
|
spec:
|
||||||
ingressClassName: nginx
|
ingressClassName: nginx
|
||||||
@ -53,8 +54,6 @@ spec:
|
|||||||
labels:
|
labels:
|
||||||
app: app
|
app: app
|
||||||
spec:
|
spec:
|
||||||
imagePullSecrets:
|
|
||||||
- name: regcred
|
|
||||||
containers:
|
containers:
|
||||||
- name: app
|
- name: app
|
||||||
image: "$IMAGEAPP"
|
image: "$IMAGEAPP"
|
||||||
@ -69,7 +68,6 @@ spec:
|
|||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: config
|
- name: config
|
||||||
mountPath: /config/
|
mountPath: /config/
|
||||||
readOnly: true
|
|
||||||
- name: data
|
- name: data
|
||||||
mountPath: /data/
|
mountPath: /data/
|
||||||
- name: keys
|
- name: keys
|
||||||
@ -79,7 +77,7 @@ spec:
|
|||||||
volumes:
|
volumes:
|
||||||
- name: config
|
- name: config
|
||||||
configMap:
|
configMap:
|
||||||
name: synapse-config
|
name: synapse
|
||||||
- name: keys
|
- name: keys
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: keys
|
claimName: keys
|
||||||
|
1
manifests/common/turn.yaml
Normal file
1
manifests/common/turn.yaml
Normal file
@ -0,0 +1 @@
|
|||||||
|
# https://element-hq.github.io/synapse/latest/setup/turn/coturn.html
|
@ -85,7 +85,6 @@ spec:
|
|||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: delegation
|
- name: delegation
|
||||||
mountPath: /etc/nginx/conf.d/
|
mountPath: /etc/nginx/conf.d/
|
||||||
readOnly: true
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: delegation
|
- name: delegation
|
||||||
configMap:
|
configMap:
|
Loading…
Reference in New Issue
Block a user