Merge pull request #510 from DDS-Derek/main
This commit is contained in:
24
.github/workflows/build.yml
vendored
24
.github/workflows/build.yml
vendored
@ -14,13 +14,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v4
|
|
||||||
with:
|
|
||||||
images: ${{ secrets.DOCKER_USERNAME }}/moviepilot
|
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Release version
|
name: Release version
|
||||||
@ -29,6 +23,16 @@ jobs:
|
|||||||
app_version=$(cat version.py |sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp")
|
app_version=$(cat version.py |sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp")
|
||||||
echo "app_version=$app_version" >> $GITHUB_ENV
|
echo "app_version=$app_version" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: ${{ secrets.DOCKER_USERNAME }}/moviepilot
|
||||||
|
tags: |
|
||||||
|
type=raw,value=${{ env.app_version }}
|
||||||
|
type=raw,value=latest
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Set Up QEMU
|
name: Set Up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v2
|
||||||
@ -52,11 +56,9 @@ jobs:
|
|||||||
file: Dockerfile
|
file: Dockerfile
|
||||||
platforms: |
|
platforms: |
|
||||||
linux/amd64
|
linux/amd64
|
||||||
linux/arm64
|
linux/arm64/v8
|
||||||
push: true
|
push: true
|
||||||
build-args: |
|
build-args: |
|
||||||
MOVIEPILOT_VERSION=${{ env.app_version }}
|
MOVIEPILOT_VERSION=${{ env.app_version }}
|
||||||
tags: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
${{ secrets.DOCKER_USERNAME }}/moviepilot:latest
|
|
||||||
${{ secrets.DOCKER_USERNAME }}/moviepilot:${{ env.app_version }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
-
|
-
|
||||||
name: Release Version
|
name: Release Version
|
||||||
|
@ -48,6 +48,7 @@ RUN apt-get update \
|
|||||||
busybox \
|
busybox \
|
||||||
dumb-init \
|
dumb-init \
|
||||||
jq \
|
jq \
|
||||||
|
haproxy \
|
||||||
&& \
|
&& \
|
||||||
if [ "$(uname -m)" = "x86_64" ]; \
|
if [ "$(uname -m)" = "x86_64" ]; \
|
||||||
then ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1; \
|
then ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1; \
|
||||||
@ -58,7 +59,7 @@ RUN apt-get update \
|
|||||||
&& cp -f /app/update /usr/local/bin/mp_update \
|
&& cp -f /app/update /usr/local/bin/mp_update \
|
||||||
&& cp -f /app/entrypoint /entrypoint \
|
&& cp -f /app/entrypoint /entrypoint \
|
||||||
&& chmod +x /entrypoint /usr/local/bin/mp_update \
|
&& chmod +x /entrypoint /usr/local/bin/mp_update \
|
||||||
&& mkdir -p ${HOME} \
|
&& mkdir -p ${HOME} /var/lib/haproxy/server-state \
|
||||||
&& groupadd -r moviepilot -g 911 \
|
&& groupadd -r moviepilot -g 911 \
|
||||||
&& useradd -r moviepilot -g moviepilot -d ${HOME} -s /bin/bash -u 911 \
|
&& useradd -r moviepilot -g moviepilot -d ${HOME} -s /bin/bash -u 911 \
|
||||||
&& apt-get install -y build-essential \
|
&& apt-get install -y build-essential \
|
||||||
@ -82,5 +83,5 @@ RUN apt-get update \
|
|||||||
/var/lib/apt/lists/* \
|
/var/lib/apt/lists/* \
|
||||||
/var/tmp/*
|
/var/tmp/*
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
VOLUME ["/config", "/var/run/docker.sock"]
|
VOLUME [ "/config" ]
|
||||||
ENTRYPOINT [ "/entrypoint" ]
|
ENTRYPOINT [ "/entrypoint" ]
|
||||||
|
@ -227,7 +227,7 @@ docker pull jxxghp/moviepilot:latest
|
|||||||
- 通过微信/Telegram/Slack远程管理,其中微信/Telegram将会自动添加操作菜单(微信菜单条数有限制,部分菜单不显示),微信需要在官方页面设置回调地址,地址相对路径为:`/api/v1/message/`。
|
- 通过微信/Telegram/Slack远程管理,其中微信/Telegram将会自动添加操作菜单(微信菜单条数有限制,部分菜单不显示),微信需要在官方页面设置回调地址,地址相对路径为:`/api/v1/message/`。
|
||||||
- 设置媒体服务器Webhook,通过MoviePilot发送播放通知等。Webhook回调相对路径为`/api/v1/webhook?token=moviepilot`(`3001`端口),其中`moviepilot`为设置的`API_TOKEN`。
|
- 设置媒体服务器Webhook,通过MoviePilot发送播放通知等。Webhook回调相对路径为`/api/v1/webhook?token=moviepilot`(`3001`端口),其中`moviepilot`为设置的`API_TOKEN`。
|
||||||
- 将MoviePilot做为Radarr或Sonarr服务器添加到Overseerr或Jellyseerr(`3001`端口),可使用Overseerr/Jellyseerr浏览订阅。
|
- 将MoviePilot做为Radarr或Sonarr服务器添加到Overseerr或Jellyseerr(`3001`端口),可使用Overseerr/Jellyseerr浏览订阅。
|
||||||
- 映射宿主机docker.sock文件到容器`/var/run/docker.sock`,以支持内建重启操作(需要root权限)。
|
- 映射宿主机docker.sock文件到容器`/var/run/docker.sock`,以支持内建重启操作。实例:`-v /var/run/docker.sock:/var/run/docker.sock:ro`
|
||||||
|
|
||||||
**注意**
|
**注意**
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ class SystemUtils:
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
# 创建 Docker 客户端
|
# 创建 Docker 客户端
|
||||||
client = docker.from_env()
|
client = docker.DockerClient(base_url='tcp://127.0.0.1:2375')
|
||||||
# 获取当前容器的 ID
|
# 获取当前容器的 ID
|
||||||
container_id = open("/proc/self/cgroup", "r").read().split("/")[-1]
|
container_id = open("/proc/self/cgroup", "r").read().split("/")[-1]
|
||||||
if not container_id:
|
if not container_id:
|
||||||
|
@ -26,6 +26,10 @@ chown moviepilot:moviepilot /etc/hosts /tmp
|
|||||||
gosu moviepilot:moviepilot playwright install chromium
|
gosu moviepilot:moviepilot playwright install chromium
|
||||||
# 启动前端nginx服务
|
# 启动前端nginx服务
|
||||||
nginx
|
nginx
|
||||||
|
# 启动haproxy
|
||||||
|
if [ -S "/var/run/docker.sock" ]; then
|
||||||
|
haproxy -f /app/haproxy.cfg
|
||||||
|
fi
|
||||||
# 设置后端服务权限掩码
|
# 设置后端服务权限掩码
|
||||||
umask ${UMASK}
|
umask ${UMASK}
|
||||||
# 启动后端服务
|
# 启动后端服务
|
||||||
|
60
haproxy.cfg
Normal file
60
haproxy.cfg
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
global
|
||||||
|
log stdout format raw daemon info
|
||||||
|
|
||||||
|
user root
|
||||||
|
group root
|
||||||
|
|
||||||
|
daemon
|
||||||
|
|
||||||
|
pidfile /run/haproxy.pid
|
||||||
|
maxconn 4000
|
||||||
|
|
||||||
|
# Turn on stats unix socket
|
||||||
|
server-state-file /var/lib/haproxy/server-state
|
||||||
|
|
||||||
|
setenv POST 1
|
||||||
|
setenv ALLOW_RESTARTS 1
|
||||||
|
setenv CONTAINERS 1
|
||||||
|
setenv VERSION 1
|
||||||
|
|
||||||
|
defaults
|
||||||
|
mode http
|
||||||
|
log global
|
||||||
|
option httplog
|
||||||
|
option dontlognull
|
||||||
|
option http-server-close
|
||||||
|
option redispatch
|
||||||
|
retries 3
|
||||||
|
timeout http-request 10s
|
||||||
|
timeout queue 1m
|
||||||
|
timeout connect 10s
|
||||||
|
timeout client 10m
|
||||||
|
timeout server 10m
|
||||||
|
timeout http-keep-alive 10s
|
||||||
|
timeout check 10s
|
||||||
|
maxconn 3000
|
||||||
|
|
||||||
|
# Allow seamless reloads
|
||||||
|
load-server-state-from-file global
|
||||||
|
|
||||||
|
# Use provided example error pages
|
||||||
|
errorfile 400 /etc/haproxy/errors/400.http
|
||||||
|
errorfile 403 /etc/haproxy/errors/403.http
|
||||||
|
errorfile 408 /etc/haproxy/errors/408.http
|
||||||
|
errorfile 500 /etc/haproxy/errors/500.http
|
||||||
|
errorfile 502 /etc/haproxy/errors/502.http
|
||||||
|
errorfile 503 /etc/haproxy/errors/503.http
|
||||||
|
errorfile 504 /etc/haproxy/errors/504.http
|
||||||
|
|
||||||
|
backend dockerbackend
|
||||||
|
server dockersocket /var/run/docker.sock
|
||||||
|
|
||||||
|
frontend dockerfrontend
|
||||||
|
bind :2375
|
||||||
|
http-request deny unless METH_GET || { env(POST) -m bool }
|
||||||
|
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers/[a-zA-Z0-9_.-]+/((stop)|(restart)|(kill)) } { env(ALLOW_RESTARTS) -m bool }
|
||||||
|
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/containers } { env(CONTAINERS) -m bool }
|
||||||
|
http-request allow if { path,url_dec -m reg -i ^(/v[\d\.]+)?/version } { env(VERSION) -m bool }
|
||||||
|
http-request deny
|
||||||
|
default_backend dockerbackend
|
||||||
|
|
Reference in New Issue
Block a user