Skip to content

Commit

Permalink
feat: add easytier shell (#15)
Browse files Browse the repository at this point in the history
* feat: update makefile

* feat: align version
  • Loading branch information
Tohrusky authored Aug 7, 2024
1 parent 1f7ee40 commit 3826430
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 11 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down
3 changes: 3 additions & 0 deletions common/version/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package version

const FINALRUP_VERSION = "v0.0.1"
5 changes: 5 additions & 0 deletions deploy/easytier/README.md
Original file line number Diff line number Diff line change
@@ -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
```
39 changes: 39 additions & 0 deletions deploy/easytier/easytier.sh
Original file line number Diff line number Diff line change
@@ -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 <<EOF | sudo tee $SERVICE_FILE > /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."
File renamed without changes.
2 changes: 1 addition & 1 deletion deploy/server.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion deploy/worker-cut.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion deploy/worker-encode-pytorch.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion deploy/worker-encode.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
2 changes: 1 addition & 1 deletion deploy/worker-merge.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
5 changes: 2 additions & 3 deletions server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 2 additions & 3 deletions worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3826430

Please sign in to comment.