This commit is contained in:
bel
2021-09-14 06:30:17 -06:00
commit 7ab1723a5e
327 changed files with 127104 additions and 0 deletions

2
matrix/.gitignore vendored Executable file
View File

@@ -0,0 +1,2 @@
**/*.sw*
*.db

48
matrix/Dockerfile Executable file
View File

@@ -0,0 +1,48 @@
FROM debian:bullseye-20200327
RUN apt update \
&& apt install -y \
lsb-release \
wget \
apt-transport-https \
&& wget \
-O /usr/share/keyrings/matrix-org-archive-keyring.gpg \
https://packages.matrix.org/debian/matrix-org-archive-keyring.gpg \
&& echo \
"deb [signed-by=/usr/share/keyrings/matrix-org-archive-keyring.gpg] https://packages.matrix.org/debian/ $(lsb_release -cs) main" \
| tee /etc/apt/sources.list.d/matrix-org.list \
&& apt update \
&& apt install -y \
matrix-synapse-py3
RUN apt install -y vim bash curl procps
RUN mkdir -p /var/www/riot.dangerousdemos.net \
&& cd /var/www/riot.dangerousdemos.net \
&& v=1.6.1 \
&& wget https://github.com/vector-im/riot-web/releases/download/v$v/riot-v$v.tar.gz \
&& tar -xzvf riot-v$v.tar.gz \
&& ln -s riot-v$v riot \
&& cd riot \
&& cp config.sample.json config.json
RUN apt update && apt install -y gnupg2 \
&& echo 'deb https://download.jitsi.org stable/' >> /etc/apt/sources.list.d/jitsi-stable.list \
&& wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | apt-key add - \
&& apt update \
&& printf "jitsim.home.blapointe.com\n2\n\n" > /tmp/input \
&& apt -y install jitsi-meet < /tmp/input
RUN mkdir -p /mnt
COPY homeserver.yaml /etc/matrix-synapse/
COPY config.json /etc/riot/
COPY config.json /var/www/riot.dangerousdemos.net/riot/
COPY jitsim.home.blapointe.com.conf /etc/nginx/sites-enabled/
WORKDIR /main
COPY . .
CMD []
ENTRYPOINT ["bash", "./entrypoint.sh", "start"]

58
matrix/config.json Executable file
View File

@@ -0,0 +1,58 @@
{
"default_server_config": {
"m.homeserver": {
"base_url": "https://synapse.home.blapointe.com",
"server_name": "home.blapointe.com"
},
"m.identity_server": {
"base_url": "https://vector.im"
}
},
"disable_custom_urls": false,
"disable_guests": false,
"disable_login_language_selector": false,
"disable_3pid_login": false,
"brand": "Riot",
"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"
],
"bug_report_endpoint_url": "https://riot.im/bugreports/submit",
"defaultCountryCode": "GB",
"showLabsSettings": false,
"features": {
"feature_pinning": "labs",
"feature_custom_status": "labs",
"feature_custom_tags": "labs",
"feature_state_counters": "labs"
},
"default_federate": true,
"default_theme": "light",
"roomDirectory": {
"servers": [
"matrix.org"
]
},
"welcomeUserId": "@riot-bot:matrix.org",
"piwik": {
"url": "https://piwik.riot.im/",
"whitelistedHSUrls": ["https://matrix.org"],
"whitelistedISUrls": ["https://vector.im", "https://matrix.org"],
"siteId": 1
},
"enable_presence_by_hs_url": {
"https://matrix.org": false,
"https://matrix-client.matrix.org": false
},
"settingDefaults": {
"breadcrumbs": true
},
"jitsi": {
"preferredDomain": "jitsim.home.blapointe.com"
}
}

45
matrix/entrypoint.sh Executable file
View File

@@ -0,0 +1,45 @@
#! /bin/bash
function main() {
case "$1" in
start )
start-synapse &
start-riot &
service jicofo start
service jitsi-videobridge2 start
service prosody start
service coturn start
service coturn start
service uuidd start
service nginx start
wait -n 1
kill $(jobs -p)
wait
;;
* )
eval "$@"
;;
esac
}
function start-synapse() {
set -e
rm -f /etc/matrix-synapse/conf.d/server_name.yaml
source /etc/default/matrix-synapse
cd /var/lib/matrix-synapse
/opt/venvs/matrix-synapse/bin/python -m synapse.app.homeserver \
--config-path=/etc/matrix-synapse/homeserver.yaml \
--config-path=/etc/matrix-synapse/conf.d/ \
--generate-keys
exec /opt/venvs/matrix-synapse/bin/python -m synapse.app.homeserver \
--config-path=/etc/matrix-synapse/homeserver.yaml \
--config-path=/etc/matrix-synapse/conf.d/
}
function start-riot() {
exec /main/exec-simpleserve -p 39988 -d /var/www/riot.dangerousdemos.net/riot
}
if [ "$0" == "$BASH_SOURCE" ]; then
main "$@"
fi

1821
matrix/homeserver.yaml Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,111 @@
server_names_hash_bucket_size 64;
server {
listen 80;
listen [::]:80;
server_name jitsim.home.blapointe.com;
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /usr/share/jitsi-meet;
}
location = /.well-known/acme-challenge/ {
return 404;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 39989;
listen [::]:39989;
server_name jitsim.home.blapointe.com;
add_header Strict-Transport-Security "max-age=31536000";
root /usr/share/jitsi-meet;
# ssi on with javascript for multidomain variables in config.js
ssi on;
ssi_types application/x-javascript application/javascript;
index index.html index.htm;
error_page 404 /static/404.html;
gzip on;
gzip_types text/plain text/css application/javascript application/json;
gzip_vary on;
location = /config.js {
alias /etc/jitsi/meet/jitsim.home.blapointe.com-config.js;
}
location = /external_api.js {
alias /usr/share/jitsi-meet/libs/external_api.min.js;
}
#ensure all static content can always be found first
location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimization|.well-known)/(.*)$
{
add_header 'Access-Control-Allow-Origin' '*';
alias /usr/share/jitsi-meet/$1/$2;
}
# BOSH
location = /http-bind {
proxy_pass http://localhost:5280/http-bind;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
}
# xmpp websockets
location = /xmpp-websocket {
proxy_pass http://127.0.0.1:5280/xmpp-websocket?prefix=$prefix&$args;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
tcp_nodelay on;
}
location ~ ^/([^/?&:'"]+)$ {
try_files $uri @root_path;
}
location @root_path {
rewrite ^/(.*)$ / break;
}
location ~ ^/([^/?&:'"]+)/config.js$
{
set $subdomain "$1.";
set $subdir "$1/";
alias /etc/jitsi/meet/jitsim.home.blapointe.com-config.js;
}
#Anything that didn't match above, and isn't a real file, assume it's a room name and redirect to /
location ~ ^/([^/?&:'"]+)/(.*)$ {
set $subdomain "$1.";
set $subdir "$1/";
rewrite ^/([^/?&:'"]+)/(.*)$ /$2;
}
# BOSH for subdomains
location ~ ^/([^/?&:'"]+)/http-bind {
set $subdomain "$1.";
set $subdir "$1/";
set $prefix "$1";
rewrite ^/(.*)$ /http-bind;
}
# websockets for subdomains
location ~ ^/([^/?&:'"]+)/xmpp-websocket {
set $subdomain "$1.";
set $subdir "$1/";
set $prefix "$1";
rewrite ^/(.*)$ /xmpp-websocket;
}
}

12
matrix/run.sh Executable file
View File

@@ -0,0 +1,12 @@
#! /bin/bash
set -e
docker build -t dev:dev .
docker run \
--rm \
-it \
--name dev \
-v $PWD:/mnt \
-p 39987-39989:39987-39989 \
-p 10000:10000 \
dev:dev