Initial commit

This commit is contained in:
Eir Sunny 2024-12-18 16:24:21 -06:00
parent dc7b420750
commit 13156ae580
10 changed files with 242 additions and 1 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
restart-vpn.sh
eirtube/cache/*
eirtube/logs/*

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
eirtube/
eirtube-binaries/
newleaf/
phantomjs/
vpn/
.htpasswd
restartvpn.log

23
Dockerfile-eirtube Executable file
View File

@ -0,0 +1,23 @@
FROM python:3.12-alpine
# Eirtube stuff
RUN apt-get install -y \
bash \
#ffmpeg \
#yt-dlp \
npm \
git \
tar \
coreutils
COPY eirtube-binaries/* /usr/bin
# Set up node packages
RUN rm -rf /tmp && mkdir /tmp
COPY eirtube/package*.* /tmp
RUN bash -c "cd /tmp && npm install --legacy-peer-deps --loglevel verbose"
COPY eirtube-start.sh .
EXPOSE 10412
CMD ./eirtube-start.sh

37
Dockerfile-eirtube-nvidia Executable file
View File

@ -0,0 +1,37 @@
#FROM python:3.12-alpine
FROM node:22-slim
RUN apt-get update
# Nvidia stuff
RUN apt-get install -y \
software-properties-common \
curl
RUN curl https://developer.download.nvidia.com/compute/cuda/repos/debian12/x86_64/cuda-keyring_1.1-1_all.deb -o /tmp/cuda-keyring.deb
RUN dpkg -i /tmp/cuda-keyring.deb
RUN add-apt-repository contrib
RUN apt-get install -Vy cuda-drivers
#RUN apt-get install nvidia-driver-assistant
#RUN nvidia-driver-assistant --install
# Eirtube stuff
RUN apt-get install -y \
bash \
#ffmpeg \
#yt-dlp \
npm \
git \
tar \
coreutils
COPY eirtube-binaries/* /usr/bin
# Set up node packages
RUN rm -rf /tmp && mkdir /tmp
COPY eirtube/package*.* /tmp
RUN bash -c "cd /tmp && npm install --legacy-peer-deps --loglevel verbose"
COPY eirtube-start.sh .
EXPOSE 10412
CMD ./eirtube-start.sh

28
Dockerfile-newleaf Executable file
View File

@ -0,0 +1,28 @@
FROM python:3.11.9-alpine3.19
RUN apk del .python-rundeps
RUN apk add --no-cache \
bash \
ffmpeg \
yt-dlp \
nodejs \
npm \
git \
curl \
crystal shards \
musl
# Install PhantomJS
#RUN curl -k -Ls https://github.com/Nuxify/phantomized/releases/download/2.1.1/dockerized-phantomjs.tar.gz | tar -xzf -
#RUN cp phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
COPY phantomjs/bin/phantomjs /usr/local/bin/phantomjs
COPY newleaf/requirements.txt .
RUN pip install -r requirements.txt
COPY newleaf-start.sh .
EXPOSE 3000
CMD ./newleaf-start.sh

View File

@ -1,3 +1,19 @@
# eirtube-stack-docker # eirtube-stack-docker
The setup I use to run Eirtube and my Newleaf instance. This is the setup I use to run Eirtube and my Newleaf instance.
## Installation
1. Clone [EirTube](https://git.eir-nya.gay/eir/eirtube) and [my Newleaf instance](https://git.eir-nya.gay/eir/newleaf) to `eirtube` and `newleaf` respectively.
2. Make a folder `eirtube-binaries`. Here you'll need to place the latest `yt-dlp` binary as well as `ffmpeg` and `ffprobe` taken from the latest Jellyfin-ffmpeg build for optimization.
3. Get the latest version of `phantomjs` and extract it to `phantomjs` in this folder.
4. Edit the docker-compose file. Set up the configuration for the `gluetun` container. You'll need your own vpn username and password to enter. Add a custom timezone for where you live. If you don't want to use the nvidia dockerfile, replace `dockerfile: ./Dockerfile-eirtube-nvidia` with `dockerfile: ./Dockerfile-eirtube` and remove `runtime: nvidia`, and `deploy:` and everything inside it.
5. Use docker-compose to build and run the docker-compose file, using `docker compose build` and `docker compose up -d`.
## License
I know CloudTube and thus EirTube use the AGPL license. Some code from its Dockerfile is used here. Therefore, I used the same license. Both CloudTube and NewLeaf belong to [Cadence](https://cadence.moe/).

80
docker-compose.yml Normal file
View File

@ -0,0 +1,80 @@
services:
ct-vpn:
image: qmcgaw/gluetun
container_name: ct-vpn
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
ports:
- 3000:3000
- 10412:10412
- 127.0.0.1:8000:8000/tcp # Control server
volumes:
- ./vpn:/gluetun
environment:
# See https://github.com/qdm12/gluetun-wiki/tree/main/setup#setup
- VPN_SERVICE_PROVIDER=protonvpn
# - VPN_TYPE=wireguard
# OpenVPN:
# - OPENVPN_USER=...
# - OPENVPN_PASSWORD=...
# Wireguard:
# - WIREGUARD_PRIVATE_KEY=...
# - WIREGUARD_ADDRESSES=...
# Timezone for accurate log times
# - TZ=America/Chicago
# Server list updater
# See https://github.com/qdm12/gluetun-wiki/blob/main/setup/servers.md#update-the-vpn-servers-list
- UPDATER_PERIOD=
- SERVER_COUNTRIES=Netherlands
- VPN_PORT_FORWARDING=on
restart: "unless-stopped"
eirtube:
build:
context: .
dockerfile: ./Dockerfile-eirtube-nvidia
container_name: eirtube
environment:
- PUID=1000
- PGID=1000
- TZ=America/Chicago
volumes:
- ./eirtube:/live/eirtube
#ports:
#- 10412:10412
restart: "unless-stopped"
network_mode: service:ct-vpn
depends_on:
- ct-vpn
#healthcheck:
#test: curl -f http://localhost:9092 || exit 1
#interval: 5m00s
#timeout: 10s
#retries: 2
runtime: nvidia
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
newleaf:
build:
context: .
dockerfile: ./Dockerfile-newleaf
container_name: newleaf
environment:
- PUID=1000
- PGID=1000
# - TZ=America/Chicago
volumes:
- ./phantomjs:/live/phantomjs
- ./newleaf:/live/newleaf
#ports:
#- 3000:3000
restart: "unless-stopped"
network_mode: service:ct-vpn
depends_on:
- ct-vpn

16
eirtube-start.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
printf "\033[38;5;154meirtube-start\033[0m\n"
cd /live/eirtube
#npm ci --legacy-peer-deps --loglevel verbose
#npm install sass@1.57.1
if [ ! -d "node_modules" ]; then
cp -r /tmp/node_modules .
fi
if [ ! -d "logs" ]; then
mkdir logs
fi
node --disable-warning DEP0040 server.js | tee logs/$(date +'%Y_%m_%d_%H-%M-%S').txt

10
newleaf-start.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
cd /live/phantomjs
cp -R lib lib64 /
cp -R x86_64-linux-gnu /usr/lib
cp -R share /usr/share
cp -R fonts /etc
cd /live/newleaf
python index.py

20
restart-vpn.sh Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
echo "BEGIN $(date --rfc-3339=seconds)" 2>&1 | tee -a ./restartvpn.log
curl -s -X GET "http://127.0.0.1:8000/v1/publicip/ip" 2>&1 | tee -a ./restartvpn.log # Print the original IP
curl -s -X PUT -H "Content-Type: application/json" -d '{"status":"stopped"}' "http://127.0.0.1:8000/v1/openvpn/status" 2>&1 | tee -a ./restartvpn.log # Stop OpenVPN
sleep 5
curl -s -X PUT -H "Content-Type: application/json" -d '{"status":"running"}' "http://127.0.0.1:8000/v1/openvpn/status" 2>&1 | tee -a ./restartvpn.log # Start OpenVPN (changing the server it's connecting to)
sleep 5
curl -s -X GET "http://127.0.0.1:8000/v1/openvpn/status" 2>&1 | tee -a ./restartvpn.log # Print the Gluetun status
curl -s -X GET "http://127.0.0.1:8000/v1/publicip/ip" 2>&1 | tee -a ./restartvpn.log # Print the new IP
echo "END $(date --rfc-3339=seconds)" 2>&1 | tee -a ./restartvpn.log