140 lines
3.9 KiB
Bash
140 lines
3.9 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Element Service
|
|
|
|
PATH=$HOME/.docker/cli-plugins:/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
|
|
config_element() {
|
|
echo -ne "\n* Configuring /federated/apps/element container.."
|
|
spin &
|
|
SPINPID=$!
|
|
|
|
if [ ! -d "/federated/apps/element" ]; then
|
|
mkdir -p /federated/apps/element/data/element &> /dev/null
|
|
fi
|
|
|
|
DOMAIN_ARRAY=(${DOMAIN//./ })
|
|
DOMAIN_FIRST=${DOMAIN_ARRAY[0]}
|
|
DOMAIN_LAST=${DOMAIN_ARRAY[1]}
|
|
|
|
cat > /federated/apps/element/docker-compose.yml <<EOF
|
|
version: '3.7'
|
|
|
|
services:
|
|
element:
|
|
image: vectorim/element-web:\${IMAGE_VERSION}
|
|
container_name: element
|
|
hostname: element.$DOMAIN
|
|
domainname: $DOMAIN
|
|
restart: always
|
|
networks:
|
|
federated:
|
|
ipv4_address: 172.99.0.18
|
|
volumes:
|
|
- ./data/element/element-config.json:/app/config.json
|
|
env_file:
|
|
- ./.env
|
|
|
|
networks:
|
|
federated:
|
|
external: true
|
|
EOF
|
|
|
|
cat > /federated/apps/element/.env <<EOF
|
|
IMAGE_VERSION="v1.11.19"
|
|
VIRTUAL_PROTO=http
|
|
VIRTUAL_PORT=80
|
|
VIRTUAL_HOST=element.$DOMAIN
|
|
EOF
|
|
chmod 600 /federated/apps/element/.env
|
|
|
|
cat > /federated/apps/element/data/element/element-config.json <<EOF
|
|
{
|
|
"default_server_config": {
|
|
"m.homeserver": {
|
|
"base_url": "https://matrix.$DOMAIN",
|
|
"server_name": "matrix.$DOMAIN"
|
|
},
|
|
"m.identity_server": {
|
|
"base_url": "https://vector.im"
|
|
}
|
|
},
|
|
"jitsi": {
|
|
"preferredDomain": "jitsi.$DOMAIN"
|
|
},
|
|
"brand": "Element",
|
|
"integrations_ui_url": "https://scalar.vector.im/",
|
|
"integrations_rest_url": "https://scalar.vector.im/api",
|
|
"integrations_widgets_urls": [
|
|
"https://scalar.vector.im/_matrix/integrations/v1",
|
|
"https://scalar.vector.im/api",
|
|
"https://scalar-staging.vector.im/_matrix/integrations/v1",
|
|
"https://scalar-staging.vector.im/api",
|
|
"https://scalar-staging.riot.im/scalar/api"
|
|
],
|
|
"hosting_signup_link": "https://element.io/matrix-services?utm_source=element-web&utm_medium=web",
|
|
"bug_report_endpoint_url": "https://element.io/bugreports/submit",
|
|
"uisi_autorageshake_app": "element-auto-uisi",
|
|
"showLabsSettings": true,
|
|
"roomDirectory": {
|
|
"servers": [
|
|
"matrix.org",
|
|
"gitter.im",
|
|
"libera.chat"
|
|
]
|
|
},
|
|
"enable_presence_by_hs_url": {
|
|
"https://matrix.org": false,
|
|
"https://matrix-client.matrix.org": false
|
|
},
|
|
"terms_and_conditions_links": [
|
|
{
|
|
"url": "https://element.io/privacy",
|
|
"text": "Privacy Policy"
|
|
},
|
|
{
|
|
"url": "https://element.io/cookie-policy",
|
|
"text": "Cookie Policy"
|
|
}
|
|
],
|
|
"hostSignup": {
|
|
"brand": "Element Home",
|
|
"cookiePolicyUrl": "https://element.io/cookie-policy",
|
|
"domains": [
|
|
"matrix.org"
|
|
],
|
|
"privacyPolicyUrl": "https://element.io/privacy",
|
|
"termsOfServiceUrl": "https://element.io/terms-of-service",
|
|
"url": "https://ems.element.io/element-home/in-app-loader"
|
|
},
|
|
"sentry": {
|
|
"dsn": "https://029a0eb289f942508ae0fb17935bd8c5@sentry.matrix.org/6",
|
|
"environment": "develop"
|
|
},
|
|
"posthog": {
|
|
"projectApiKey": "phc_Jzsm6DTm6V2705zeU5dcNvQDlonOR68XvX2sh1sEOHO",
|
|
"apiHost": "https://posthog.element.io"
|
|
},
|
|
"privacy_policy_url": "https://element.io/cookie-policy",
|
|
"features": {
|
|
"feature_spotlight": true,
|
|
"feature_video_rooms": true
|
|
},
|
|
"element_call": {
|
|
"url": "https://element-call.netlify.app"
|
|
},
|
|
"map_style_url": "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx"
|
|
}
|
|
EOF
|
|
|
|
kill -9 $SPINPID &> /dev/null
|
|
echo -ne "done."
|
|
}
|
|
start_element() {
|
|
# Start service with command to make sure it's up before proceeding
|
|
start_service "element" "nc -z 172.99.0.18 80 &> /dev/null"
|
|
|
|
kill -9 $SPINPID &> /dev/null
|
|
echo -ne "done."
|
|
}
|