chore: temp selfhosted migration + flv module refactors

This commit is contained in:
2025-11-10 21:40:56 +01:00
parent fb40d87736
commit 3a89f07a6f
5 changed files with 33 additions and 37 deletions

View File

@@ -97,23 +97,4 @@ jobs:
platforms: linux/amd64 platforms: linux/amd64
secrets: | secrets: |
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }} TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
TURBO_TEAM=${{ secrets.TURBO_TEAM }} TURBO_TEAM=${{ secrets.TURBO_TEAM }}
deploy:
name: Deploy to server
runs-on: ubuntu-latest
needs: [frontend, chat]
steps:
# source https://github.com/taciturnaxolotl/cachet/blob/main/.github/workflows/deploy.yaml
- name: Deploy with Docker
uses: appleboy/ssh-action@v1
with:
host: hackclub.app
username: srizan
key: ${{ secrets.SSH_KEY }}
port: 22
script: |
cd ~/compose/hctv
docker compose pull
docker compose up -d --remove-orphans
# for some reason, without the restart, the rtmp container stops working
docker compose restart

View File

@@ -7,7 +7,7 @@ description: Get started with OBS and streaming on hackclub.tv
- open settings - open settings
- open "Stream" - open "Stream"
- set service to custom - set service to custom
- set url to `rtmp://hackclub.app:45913/live` - set url to `rtmp://backend.hackclub.tv/live`
- on the website, click "Regenerate key" - on the website, click "Regenerate key"
- paste the key into your obs "Stream Key" - paste the key into your obs "Stream Key"
- start streaming! - start streaming!

View File

@@ -54,7 +54,7 @@ http {
map $http_authorization $is_authorized { map $http_authorization $is_authorized {
default 0; default 0;
$API_AUTH 1; ${API_AUTH} 1;
} }
server { server {

View File

@@ -1,4 +1,4 @@
FROM alpine:3.19 as builder FROM alpine:3.19 AS builder
RUN apk add --no-cache \ RUN apk add --no-cache \
build-base \ build-base \
@@ -37,20 +37,8 @@ RUN mkdir -p /etc/nginx/templates
EXPOSE 80 1935 8888 EXPOSE 80 1935 8888
# Create an entrypoint script to handle environment variable substitution COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN echo '#!/bin/sh \n\ RUN chmod +x /docker-entrypoint.sh
# Replace environment variables in configuration templates \n\
for template in /etc/nginx/templates/*.conf.template; do \n\
if [ -f "$template" ]; then \n\
output_file="/usr/local/nginx/conf/$(basename $template .template)" \n\
echo "Processing template: $template -> $output_file" \n\
envsubst "$(env | awk -F= "{printf \\\"\\\$%s \\\",\\\$1}")" < $template > $output_file \n\
fi \n\
done \n\
\n\
# Start Nginx \n\
exec "$@"' > /docker-entrypoint.sh && \
chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"] ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/local/nginx/sbin/nginx", "-g", "daemon off;"] CMD ["/usr/local/nginx/sbin/nginx", "-g", "daemon off;"]

View File

@@ -0,0 +1,27 @@
#!/bin/sh
set -e
UID=${UID:-1000}
GID=${GID:-1000}
echo "Setting UID to $UID and GID to $GID"
usermod -u $UID nginx 2>/dev/null || echo "Failed to change UID"
groupmod -g $GID nginx 2>/dev/null || echo "Failed to change GID"
mkdir -p /usr/local/nginx/conf
for template in /etc/nginx/templates/*.conf.template; do
if [ -f "$template" ]; then
output_file="/usr/local/nginx/conf/$(basename $template .template)"
echo "Processing template: $template -> $output_file"
envsubst '${API_AUTH}' < $template > $output_file
fi
done
mkdir -p /usr/local/nginx/proxy_temp /usr/local/nginx/client_body_temp
mkdir -p /var/www/html
chown -R nginx:nginx /usr/local/nginx /var/www/html
echo "Testing nginx configuration..."
/usr/local/nginx/sbin/nginx -t
exec "$@"