Add OBS application

Add LICENSE
Add .gitignore
Remove deprecated experimental_http3 Caddy option
This commit is contained in:
Manuel 2022-10-02 20:26:58 +02:00
parent f3a7c6de4a
commit 6beb123909
Signed by: SunRed
GPG Key ID: 4085037435E1F07A
11 changed files with 104 additions and 15 deletions

2
.env
View File

@ -1,3 +1,5 @@
COMPOSE_FILE="compose.yml:apps/obs/compose.yml"
HOSTNAME=desktop
#CADDY_HTTP=127.0.0.1:80
#CADDY_HTTPS=127.0.0.1:443
#IPV4_NETWORK=

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/.env

21
LICENSE.txt Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 SunRed
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

1
apps/obs/Dockerfile Symbolic link
View File

@ -0,0 +1 @@
Dockerfile.sway

10
apps/obs/Dockerfile.cage Normal file
View File

@ -0,0 +1,10 @@
FROM cagevnc:latest
RUN pacman -Syu --noconfirm obs-studio \
&& yes y | pacman -Scc \
&& rm -rf /usr/share/man/* /usr/share/doc/* \
/var/cache/pacman/pkg/* /var/lib/pacman/sync/* \
/tmp/*
ENV PAGE_TITLE="OBS Studio" \
APP=obs

10
apps/obs/Dockerfile.sway Normal file
View File

@ -0,0 +1,10 @@
FROM swayvnc:latest
RUN pacman -Syu --noconfirm obs-studio \
&& yes y | pacman -Scc \
&& rm -rf /usr/share/man/* /usr/share/doc/* \
/var/cache/pacman/pkg/* /var/lib/pacman/sync/* \
/tmp/*
ENV PAGE_TITLE="OBS Studio" \
APP=obs

30
apps/obs/compose.yml Normal file
View File

@ -0,0 +1,30 @@
---
x-restart-policy: &restart_policy
restart: unless-stopped
x-compose-defaults: &compose_defaults
<<: *restart_policy
networks:
desktop:
services:
obs:
<<: *compose_defaults
build:
context: ./apps/obs
dockerfile: Dockerfile
image: obs-studio:latest
container_name: obs-studio
pull_policy: never
hostname: $HOSTNAME
links:
- guacd
volumes:
- ./user:/home/nobody
devices:
- /dev/dri:/dev/dri # for gpu acceleration
expose:
- 5900/tcp
networks:
desktop:
external: true

11
apps/obs/entrypoint.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
runuser -u user -- sh -c "exec env WAYLAND_DISPLAY=wayland-0 XDG_RUNTIME_DIR=/run/user/10000 \
WLR_BACKENDS=headless \
WLR_NO_HARDWARE_CURSORS=1 \
WLR_DRM_DEVICES=/dev/dri/card0 \
/usr/bin/cage obs &"
sleep 3s
runuser -u user -- sh -c "exec env DISPLAY=:1 WAYLAND_DISPLAY=wayland-0 XDG_RUNTIME_DIR=/run/user/10000 /usr/bin/wayvnc -C /etc/wayvnc/config -g"

View File

@ -1,11 +1,3 @@
{
servers {
protocol {
experimental_http3
}
}
}
localhost {
redir / /guacamole/ 308
reverse_proxy guacamole:8080

View File

@ -20,15 +20,15 @@ services:
- ${CADDY_HTTPS:-443}:443/udp # HTTP/3
volumes:
- ./caddy/data:/data
- ./caddy/Caddyfile:/etc/caddy/Caddyfile
- ./caddy/Caddyfile:/etc/caddy/Caddyfile:ro
guacd:
<<: *compose_defaults
image: guacamole/guacd:latest
container_name: guacd
volumes:
- ./guacamole/drive:/drive:rw
- ./guacamole/record:/record:rw
- ./guacamole/drive:/drive
- ./guacamole/record:/record
guacamole:
<<: *compose_defaults
@ -63,7 +63,7 @@ services:
POSTGRES_PASSWORD: 'SuperSecretPassword1234'
POSTGRES_USER: guacamole_user
volumes:
- ./guacamole/init:/docker-entrypoint-initdb.d:z
- ./guacamole/init:/docker-entrypoint-initdb.d:ro
- postgres:/var/lib/postgresql/data
expose:
- 5432/tcp

View File

@ -1,18 +1,29 @@
#!/bin/sh
# check if docker is running
# Check if Docker is running
if ! (docker ps >/dev/null 2>&1)
then
echo "docker daemon not running, will exit here!"
echo "Docker daemon not running, exiting"
exit
fi
read -e -p "Domain Guacamole should be served on [localhost]: " DOMAIN
DOMAIN=${DOMAIN:-localhost}
sed -i "s/localhost/$DOMAIN/g" caddy/Caddyfile
sed -i "s/localhost/$DOMAIN/g" ./caddy/Caddyfile
echo -n "Preparing folder guacamole/init and creating guacamole/init/initdb.sql ..."
mkdir -p ./guacamole/init
chmod -R +x ./guacamole/init
docker run --rm guacamole/guacamole /opt/guacamole/bin/initdb.sh --postgres > ./guacamole/init/initdb.sql
echo "done"
echo "Setting permissions for user directory (chown needs root)"
if $(sudo -v); then
mkdir -p ./user
sudo chown -R 10000:10000 ./user
else
echo "Sudo privileges not granted, skipped"
fi
echo "everything done"
exit 0