-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create Dockerfile and necessary files for jitsi flist #296
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
42cee31
feat: create jitsi application files to host on the grid
eyad-hussein 78c122d
feat: create jitsi flist and tested manually
eyad-hussein c48107b
docs: create readme file highlighting the image contents
eyad-hussein 8ac4fc7
docs: create readme file highlighting the image contents
eyad-hussein 0c0fde3
fix: specify ubuntu 22.04 image in Dockerfile
eyad-hussein File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
archive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM ubuntu:22.04 | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt update && \ | ||
apt -y install wget openssh-server | ||
|
||
RUN wget -O /sbin/zinit https://github.com/threefoldtech/zinit/releases/download/v0.2.5/zinit && \ | ||
chmod +x /sbin/zinit | ||
|
||
RUN apt upgrade -y | ||
|
||
COPY zinit /etc/zinit | ||
COPY start.sh /start.sh | ||
|
||
RUN chmod +x /sbin/zinit && chmod +x /start.sh | ||
|
||
COPY scripts /root/scripts | ||
COPY config /root/config | ||
|
||
RUN chmod +x /root/scripts/*.sh | ||
|
||
RUN apt install -y curl gnupg2 nginx-full apt-transport-https \ | ||
software-properties-common openjdk-11-jdk ufw && \ | ||
apt-add-repository universe -y | ||
|
||
RUN curl -sL https://prosody.im/files/prosody-debian-packages.key -o /etc/apt/keyrings/prosody-debian-packages.key && \ | ||
echo "deb [signed-by=/etc/apt/keyrings/prosody-debian-packages.key] http://packages.prosody.im/debian $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/prosody-debian-packages.list && \ | ||
curl -sL https://download.jitsi.org/jitsi-key.gpg.key | gpg --dearmor -o /usr/share/keyrings/jitsi-keyring.gpg && \ | ||
echo "deb [signed-by=/usr/share/keyrings/jitsi-keyring.gpg] https://download.jitsi.org stable/" | tee /etc/apt/sources.list.d/jitsi-stable.list && \ | ||
apt update && \ | ||
apt install -y lua5.2 | ||
|
||
ENTRYPOINT ["zinit", "init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Jitsi TF Image | ||
|
||
The image contains: | ||
|
||
- prosody xmpp server -- a communication server | ||
- jicofo(used by Jitsi) -- conference orchestrator | ||
- jitsi-videobridge(jvb) -- WebRTC compatible video router | ||
|
||
Exposed ports: | ||
|
||
- 80 | ||
- 443 | ||
- 10000 | ||
- 22 | ||
- 3478 | ||
- 5349 | ||
|
||
# Usage | ||
|
||
If you want to build the image from scratch, follow the steps below: | ||
|
||
1- Clone the repository and navigate to the jitsi directory | ||
|
||
```bash | ||
git clone git git@github.com:threefoldtech/tf-images.git | ||
cd tfgrid3/jitsi | ||
``` | ||
|
||
2- Edit it however you please | ||
|
||
3- Build the image | ||
|
||
```bash | ||
docker build -t jitsi . | ||
``` | ||
|
||
The following is just one way to convert the image to an flist, you can use any other method you prefer. | ||
|
||
4- Push the image to docker hub | ||
|
||
```bash | ||
docker tag jitsi {dockerhub-username}/jitsi | ||
``` | ||
|
||
5- Convert it to an flist using the convertor in [Zero-OS Hub](https://hub.grid.tf/docker-convert) | ||
|
||
6- Deploy the container on the grid using the flist URL you got from the previous step | ||
|
||
# Environment Variables | ||
|
||
- `SSH_KEY` -- the ssh key to be used to access the container | ||
- `JITSI_HOSTNAME` -- this is the domain name that will be used to access the jitsi server(fqdn) | ||
|
||
--- | ||
|
||
- Current Docker Hub image: [eyadhussein/jitsi](https://hub.docker.com/repository/docker/eyadhussein/jitsi) | ||
- Current flist: [jitsi flist](https://hub.grid.tf/eyadhussein.3bot/eyadhussein-jitsi-latest.flist.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
server_names_hash_bucket_size 64; | ||
|
||
types { | ||
# nginx's default mime.types doesn't include a mapping for wasm or wav. | ||
application/wasm wasm; | ||
audio/wav wav; | ||
} | ||
upstream prosody { | ||
zone upstreams 64K; | ||
server 127.0.0.1:5280; | ||
keepalive 2; | ||
} | ||
upstream jvb1 { | ||
zone upstreams 64K; | ||
server 127.0.0.1:9090; | ||
keepalive 2; | ||
} | ||
map $arg_vnode $prosody_node { | ||
default prosody; | ||
v1 v1; | ||
v2 v2; | ||
v3 v3; | ||
v4 v4; | ||
v5 v5; | ||
v6 v6; | ||
v7 v7; | ||
v8 v8; | ||
} | ||
server { | ||
listen 443 ssl http2; | ||
listen [::]:443 ssl http2; | ||
listen 80; | ||
listen [::]:80; | ||
server_name {JITSI_HOSTNAME}; | ||
|
||
# Mozilla Guideline v5.4, nginx 1.17.7, OpenSSL 1.1.1d, intermediate configuration | ||
ssl_protocols TLSv1.2 TLSv1.3; | ||
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; | ||
ssl_prefer_server_ciphers off; | ||
|
||
ssl_session_timeout 1d; | ||
ssl_session_cache shared:SSL:10m; # about 40000 sessions | ||
ssl_session_tickets off; | ||
|
||
add_header Strict-Transport-Security "max-age=63072000" always; | ||
set $prefix ""; | ||
set $custom_index ""; | ||
set $config_js_location /etc/jitsi/meet/{JITSI_HOSTNAME}-config.js; | ||
|
||
ssl_certificate /etc/jitsi/meet/{JITSI_HOSTNAME}.crt; | ||
ssl_certificate_key /etc/jitsi/meet/{JITSI_HOSTNAME}.key; | ||
|
||
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 image/x-icon application/octet-stream application/wasm; | ||
gzip_vary on; | ||
gzip_proxied no-cache no-store private expired auth; | ||
gzip_min_length 512; | ||
|
||
include /etc/jitsi/meet/jaas/*.conf; | ||
|
||
location = /config.js { | ||
alias $config_js_location; | ||
} | ||
|
||
location = /external_api.js { | ||
alias /usr/share/jitsi-meet/libs/external_api.min.js; | ||
} | ||
|
||
location = /_api/room-info { | ||
proxy_pass http://prosody/room-info?prefix=$prefix&$args; | ||
proxy_http_version 1.1; | ||
proxy_set_header X-Forwarded-For $remote_addr; | ||
proxy_set_header Host $http_host; | ||
} | ||
|
||
location ~ ^/_api/public/(.*)$ { | ||
autoindex off; | ||
alias /etc/jitsi/meet/public/$1; | ||
} | ||
|
||
# ensure all static content can always be found first | ||
location ~ ^/(libs|css|static|images|fonts|lang|sounds|.well-known)/(.*)$ | ||
{ | ||
add_header 'Access-Control-Allow-Origin' '*'; | ||
alias /usr/share/jitsi-meet/$1/$2; | ||
|
||
# cache all versioned files | ||
if ($arg_v) { | ||
expires 1y; | ||
} | ||
} | ||
|
||
# BOSH | ||
location = /http-bind { | ||
proxy_pass http://$prosody_node/http-bind?prefix=$prefix&$args; | ||
proxy_http_version 1.1; | ||
proxy_set_header X-Forwarded-For $remote_addr; | ||
proxy_set_header Host $http_host; | ||
proxy_set_header Connection ""; | ||
} | ||
|
||
# xmpp websockets | ||
location = /xmpp-websocket { | ||
proxy_pass http://$prosody_node/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; | ||
} | ||
|
||
# colibri (JVB) websockets for jvb1 | ||
location ~ ^/colibri-ws/default-id/(.*) { | ||
proxy_pass http://jvb1/colibri-ws/default-id/$1$is_args$args; | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
tcp_nodelay on; | ||
} | ||
|
||
# load test minimal client, uncomment when used | ||
#location ~ ^/_load-test/([^/?&:'"]+)$ { | ||
# rewrite ^/_load-test/(.*)$ /load-test/index.html break; | ||
#} | ||
#location ~ ^/_load-test/libs/(.*)$ { | ||
# add_header 'Access-Control-Allow-Origin' '*'; | ||
# alias /usr/share/jitsi-meet/load-test/libs/$1; | ||
#} | ||
|
||
location ~ ^/conference-request/v1(\/.*)?$ { | ||
proxy_pass http://127.0.0.1:8888/conference-request/v1$1; | ||
add_header "Cache-Control" "no-cache, no-store"; | ||
add_header 'Access-Control-Allow-Origin' '*'; | ||
} | ||
location ~ ^/([^/?&:'"]+)/conference-request/v1(\/.*)?$ { | ||
rewrite ^/([^/?&:'"]+)/conference-request/v1(\/.*)?$ /conference-request/v1$2; | ||
} | ||
|
||
location ~ ^/([^/?&:'"]+)$ { | ||
set $roomname "$1"; | ||
try_files $uri @root_path; | ||
} | ||
|
||
location @root_path { | ||
rewrite ^/(.*)$ /$custom_index break; | ||
} | ||
|
||
location ~ ^/([^/?&:'"]+)/config.js$ | ||
{ | ||
set $subdomain "$1."; | ||
set $subdir "$1/"; | ||
|
||
alias $config_js_location; | ||
} | ||
|
||
# Matches /(TENANT)/pwa-worker.js or /(TENANT)/manifest.json to rewrite to / and look for file | ||
location ~ ^/([^/?&:'"]+)/(pwa-worker.js|manifest.json)$ { | ||
set $subdomain "$1."; | ||
set $subdir "$1/"; | ||
rewrite ^/([^/?&:'"]+)/(pwa-worker.js|manifest.json)$ /$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; | ||
} | ||
|
||
location ~ ^/([^/?&:'"]+)/_api/room-info { | ||
set $subdomain "$1."; | ||
set $subdir "$1/"; | ||
set $prefix "$1"; | ||
|
||
rewrite ^/(.*)$ /_api/room-info; | ||
} | ||
|
||
# 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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
echo "jitsi-videobridge2 jitsi-videobridge/jvb-hostname string $(hostname)" | debconf-set-selections | ||
echo "jitsi-meet jitsi-meet/cert-choice select Generate a new self-signed certificate" | debconf-set-selections | ||
|
||
apt install jitsi-meet -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
. /lib/lsb/init-functions | ||
. /etc/jitsi/jicofo/config | ||
|
||
set -e | ||
|
||
echo -n "Starting jicofo: " | ||
export JICOFO_AUTH_PASSWORD JICOFO_MAX_MEMORY | ||
|
||
SCRIPT_DIR="$(dirname "$(readlink -f /usr/share/jicofo/jicofo.sh)")" | ||
mainClass="org.jitsi.jicofo.Main" | ||
cp=$(JARS=($SCRIPT_DIR/jicofo*.jar $SCRIPT_DIR/lib/*.jar); IFS=:; echo "${JARS[*]}") | ||
|
||
if [ -z "$JICOFO_MAX_MEMORY" ]; then JICOFO_MAX_MEMORY=3072m; fi | ||
|
||
cd /usr/share/jicofo/ | ||
exec java -Xmx$JICOFO_MAX_MEMORY -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -Djdk.tls.ephemeralDHKeySize=2048 $JAVA_SYS_PROPS -cp $cp $mainClass "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
. /etc/jitsi/videobridge/config | ||
|
||
echo -n "Starting jvb: " | ||
|
||
SCRIPT_DIR="$(dirname "$(readlink -f /usr/share/jitsi-videobridge/jvb.sh)")" | ||
mainClass="org.jitsi.videobridge.MainKt" | ||
cp=$SCRIPT_DIR/jitsi-videobridge.jar:$SCRIPT_DIR/lib/* | ||
|
||
if [ -z "$VIDEOBRIDGE_MAX_MEMORY" ]; then VIDEOBRIDGE_MAX_MEMORY=3072m; fi | ||
if [ -z "$VIDEOBRIDGE_GC_TYPE" ]; then VIDEOBRIDGE_GC_TYPE=G1GC; fi | ||
|
||
exec java -Xmx$VIDEOBRIDGE_MAX_MEMORY $VIDEOBRIDGE_DEBUG_OPTIONS -XX:+Use$VIDEOBRIDGE_GC_TYPE -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -Djdk.tls.ephemeralDHKeySize=2048 -Djdk.net.usePlainDatagramSocketImpl=true $JAVA_SYS_PROPS -cp $cp $mainClass "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
sed -i "s/{JITSI_HOSTNAME}/$JITSI_HOSTNAME/g" /root/config/nginx.conf | ||
cp /root/config/nginx.conf "/etc/nginx/sites-enabled/${JITSI_HOSTNAME}.conf" | ||
/usr/sbin/nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
USER=prosody | ||
PIDFILE=/run/prosody/prosody.pid | ||
|
||
mkdir -p "$(dirname "$PIDFILE")" | ||
chown "$USER:adm" "$(dirname "$PIDFILE")" | ||
|
||
echo "Starting Prosody XMPP Server as user $USER..." | ||
if su -s /bin/bash -c /usr/bin/prosody "$USER"; then | ||
echo "Prosody started successfully." | ||
else | ||
echo "Failed to start Prosody." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
echo "$JITSI_HOSTNAME" > /etc/hostname | ||
PUBLIC_IP=$(curl -s ifconfig.me) | ||
echo "$PUBLIC_IP $JITSI_HOSTNAME" >> /etc/hosts | ||
hostname "$JITSI_HOSTNAME" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
ufw allow 80/tcp | ||
ufw allow 443/tcp | ||
ufw allow 10000/udp | ||
ufw allow 22/tcp | ||
ufw allow 3478/udp | ||
ufw allow 5349/tcp | ||
echo y | ufw enable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
mkdir -p /var/run/sshd | ||
mkdir -p /root/.ssh | ||
touch /root/.ssh/authorized_keys | ||
|
||
chmod 700 /root/.ssh | ||
chmod 600 /root/.ssh/authorized_keys |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check failure
Code scanning / Trivy
Image user should not be 'root' High