diff --git a/Makefile b/Makefile index 0bad721..ff8267a 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,13 @@ lint: pre-commit install # pip install pre-commit pre-commit run --all-files +.PHONY: all +all: + docker buildx build -f ./deploy/worker-cut.dockerfile -t lychee0/finalrip-worker-cut . + docker buildx build -f ./deploy/worker-encode.dockerfile -t lychee0/finalrip-worker-encode . + docker buildx build -f ./deploy/worker-merge.dockerfile -t lychee0/finalrip-worker-merge . + docker buildx build -f ./deploy/server.dockerfile -t lychee0/finalrip-server . + .PHONY: pt pt: docker buildx build -f ./deploy/worker-encode-pytorch.dockerfile -t lychee0/finalrip-worker-encode-pytorch . diff --git a/common/version/version.go b/common/version/version.go new file mode 100644 index 0000000..c66f4f7 --- /dev/null +++ b/common/version/version.go @@ -0,0 +1,3 @@ +package version + +const FINALRUP_VERSION = "v0.0.1" diff --git a/deploy/easytier/README.md b/deploy/easytier/README.md new file mode 100644 index 0000000..45d6209 --- /dev/null +++ b/deploy/easytier/README.md @@ -0,0 +1,5 @@ +## Setup EasyTier on Linux + +```shell +export EASYTIER_COMMAND="-d --network-name finalrip --network-secret finalrip -e tcp://easytier.public.kkrainbow.top:11010" && curl -fsSL "https://raw.githubusercontent.com/TensoRaws/FinalRip/main/deploy/easytier/easytier.sh" | bash +``` diff --git a/deploy/easytier/easytier.sh b/deploy/easytier/easytier.sh new file mode 100644 index 0000000..fd9c65e --- /dev/null +++ b/deploy/easytier/easytier.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +ARCH=$(uname -m) +echo "device architecture: $ARCH" + +# download easytier-core +rm -rf easytier-linux-"$ARCH"-v1.2.0.zip easytier-linux-"$ARCH" +wget -c https://github.com/EasyTier/EasyTier/releases/download/v1.2.0/easytier-linux-"$ARCH"-v1.2.0.zip +unzip easytier-linux-"$ARCH"-v1.2.0.zip +mv ./easytier-linux-"$ARCH"/easytier-core /usr/local/bin/ + +# get command line arguments from env variables +# env: EASYTIER_COMMAND + +SERVICE_NAME="easytier" +EXECUTABLE_PATH="/usr/local/bin/easytier-core" +SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service" + +# create service file +cat < /dev/null +[Unit] +Description=EasyTier Core Service +After=network.target + +[Service] +Type=simple +ExecStart=${EXECUTABLE_PATH} ${EASYTIER_COMMAND} + +[Install] +WantedBy=multi-user.target +EOF + +sudo chmod +x ${EXECUTABLE_PATH} + +sudo systemctl daemon-reload +sudo systemctl enable ${SERVICE_NAME}.service +sudo systemctl start ${SERVICE_NAME}.service + +echo "service ${SERVICE_NAME} has been set to start on boot." diff --git a/deploy/FinalRip-worker-encode-pytorch.ipynb b/deploy/jupyter/FinalRip-worker-encode-pytorch.ipynb similarity index 100% rename from deploy/FinalRip-worker-encode-pytorch.ipynb rename to deploy/jupyter/FinalRip-worker-encode-pytorch.ipynb diff --git a/deploy/server.dockerfile b/deploy/server.dockerfile index ed1cf85..8ed421d 100644 --- a/deploy/server.dockerfile +++ b/deploy/server.dockerfile @@ -15,7 +15,7 @@ FROM alpine:3.20 AS app WORKDIR /app -ENV FINALRIP_EASYTIER_HOST 10.126.126.1 +ENV FINALRIP_EASYTIER_HOST 10.126.126.251 COPY --from=builder /build/server/server /app/ COPY --from=builder /build/conf/finalrip.yml /app/conf/ diff --git a/deploy/worker-cut.dockerfile b/deploy/worker-cut.dockerfile index 5824061..4115764 100644 --- a/deploy/worker-cut.dockerfile +++ b/deploy/worker-cut.dockerfile @@ -15,7 +15,7 @@ FROM debian:bookworm AS app WORKDIR /app -ENV FINALRIP_EASYTIER_HOST 10.126.126.1 +ENV FINALRIP_EASYTIER_HOST 10.126.126.251 COPY --from=mwader/static-ffmpeg:7.0.1 /ffmpeg /usr/local/bin/ COPY --from=mwader/static-ffmpeg:7.0.1 /ffprobe /usr/local/bin/ diff --git a/deploy/worker-encode-pytorch.dockerfile b/deploy/worker-encode-pytorch.dockerfile index 03bccf3..54731c1 100644 --- a/deploy/worker-encode-pytorch.dockerfile +++ b/deploy/worker-encode-pytorch.dockerfile @@ -16,7 +16,7 @@ FROM lychee0/vs-pytorch:dev AS app # worker app WORKDIR /app -ENV FINALRIP_EASYTIER_HOST 10.126.126.1 +ENV FINALRIP_EASYTIER_HOST 10.126.126.251 COPY --from=builder /build/worker/worker /app/ COPY --from=builder /build/conf/finalrip.yml /app/conf/ diff --git a/deploy/worker-encode.dockerfile b/deploy/worker-encode.dockerfile index 5491ad9..2a3119b 100644 --- a/deploy/worker-encode.dockerfile +++ b/deploy/worker-encode.dockerfile @@ -37,7 +37,7 @@ RUN pip install git+https://github.com/HomeOfVapourSynthEvolution/havsfunc.git # worker app WORKDIR /app -ENV FINALRIP_EASYTIER_HOST 10.126.126.1 +ENV FINALRIP_EASYTIER_HOST 10.126.126.251 COPY --from=builder /build/worker/worker /app/ COPY --from=builder /build/conf/finalrip.yml /app/conf/ diff --git a/deploy/worker-merge.dockerfile b/deploy/worker-merge.dockerfile index 817bbe9..7cb0392 100644 --- a/deploy/worker-merge.dockerfile +++ b/deploy/worker-merge.dockerfile @@ -15,7 +15,7 @@ FROM debian:bookworm AS app WORKDIR /app -ENV FINALRIP_EASYTIER_HOST 10.126.126.1 +ENV FINALRIP_EASYTIER_HOST 10.126.126.251 COPY --from=mwader/static-ffmpeg:7.0.1 /ffmpeg /usr/local/bin/ COPY --from=mwader/static-ffmpeg:7.0.1 /ffprobe /usr/local/bin/ diff --git a/server/main.go b/server/main.go index 4b2a939..2ec3262 100644 --- a/server/main.go +++ b/server/main.go @@ -4,17 +4,16 @@ import ( "log" "os" + "github.com/TensoRaws/FinalRip/common/version" "github.com/TensoRaws/FinalRip/server/cmd" ) -const version = "v0.0.1" - func main() { app := cmd.NewApp() app.Name = "FinalRip" app.Usage = "FinalRip Aip Sever" app.Description = "a distributed video processing tool" - app.Version = version + app.Version = version.FINALRUP_VERSION err := app.Run(os.Args) if err != nil { diff --git a/worker/main.go b/worker/main.go index ad22981..be78d16 100644 --- a/worker/main.go +++ b/worker/main.go @@ -4,17 +4,16 @@ import ( "log" "os" + "github.com/TensoRaws/FinalRip/common/version" "github.com/TensoRaws/FinalRip/worker/cmd" ) -const version = "v0.0.1" - func main() { app := cmd.NewApp() app.Name = "FinalRip Enocde Worker" app.Usage = "FinalRip Enocde Worker is a worker that encode video files" app.Description = "FinalRjson Enocde Worker is a worker that encode video files" - app.Version = version + app.Version = version.FINALRUP_VERSION err := app.Run(os.Args) if err != nil {