mirror of
https://github.com/SrIzan10/hctv.git
synced 2026-06-05 16:46:50 +00:00
chore: temp selfhosted migration + flv module refactors
This commit is contained in:
21
.github/workflows/docker.yml
vendored
21
.github/workflows/docker.yml
vendored
@@ -97,23 +97,4 @@ jobs:
|
||||
platforms: linux/amd64
|
||||
secrets: |
|
||||
TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}
|
||||
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
|
||||
TURBO_TEAM=${{ secrets.TURBO_TEAM }}
|
||||
@@ -7,7 +7,7 @@ description: Get started with OBS and streaming on hackclub.tv
|
||||
- open settings
|
||||
- open "Stream"
|
||||
- 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"
|
||||
- paste the key into your obs "Stream Key"
|
||||
- start streaming!
|
||||
|
||||
@@ -54,7 +54,7 @@ http {
|
||||
|
||||
map $http_authorization $is_authorized {
|
||||
default 0;
|
||||
$API_AUTH 1;
|
||||
${API_AUTH} 1;
|
||||
}
|
||||
|
||||
server {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM alpine:3.19 as builder
|
||||
FROM alpine:3.19 AS builder
|
||||
|
||||
RUN apk add --no-cache \
|
||||
build-base \
|
||||
@@ -37,20 +37,8 @@ RUN mkdir -p /etc/nginx/templates
|
||||
|
||||
EXPOSE 80 1935 8888
|
||||
|
||||
# Create an entrypoint script to handle environment variable substitution
|
||||
RUN echo '#!/bin/sh \n\
|
||||
# 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
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
CMD ["/usr/local/nginx/sbin/nginx", "-g", "daemon off;"]
|
||||
27
flv-module/docker-entrypoint.sh
Normal file
27
flv-module/docker-entrypoint.sh
Normal 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 "$@"
|
||||
Reference in New Issue
Block a user