Merge branch 'main' of https://github.com/Websoft9/websoft9 into main

This commit is contained in:
qiaofeng1227 2023-10-27 14:23:03 +08:00
commit 98a88fb6f1
12 changed files with 31 additions and 31 deletions

4
.gitignore vendored
View File

@ -4,6 +4,6 @@ logs
.venv .venv
.vscode .vscode
.pytest_cache .pytest_cache
.apphub/swagger-ui apphub/swagger-ui
.apphub/apphub.egg-info apphub/apphub.egg-info
cli/__pycache__ cli/__pycache__

View File

@ -6,4 +6,3 @@ requests
GitPython GitPython
PyJWT PyJWT
click click
schedule

View File

@ -1,12 +0,0 @@
import schedule
import time
import os
def job():
os.system("echo 'start to test schedule'")
schedule.every(5).seconds.do(job)
while True:
schedule.run_pending()
time.sleep(1)

View File

@ -1,4 +1,4 @@
# modify time: 202310270905, you can modify here to trigger Docker Build action # modify time: 2023102712, you can modify here to trigger Docker Build action
FROM python:3.10-bullseye AS buildstage FROM python:3.10-bullseye AS buildstage
LABEL maintainer="Websoft9<help@websoft9.com>" LABEL maintainer="Websoft9<help@websoft9.com>"
@ -36,8 +36,9 @@ COPY --from=buildstage /w9library ./library
COPY --from=buildstage /websoft9/apphub ./apphub COPY --from=buildstage /websoft9/apphub ./apphub
COPY --from=buildstage /swagger-ui/dist ./apphub/swagger-ui COPY --from=buildstage /swagger-ui/dist ./apphub/swagger-ui
COPY --from=buildstage /websoft9/apphub/src/config ./config COPY --from=buildstage /websoft9/apphub/src/config ./config
COPY --from=buildstage /websoft9/docker/apphub/script ./script
RUN apt update && apt install curl git jq iproute2 supervisor -y RUN apt update && apt install curl git jq cron iproute2 supervisor -y --no-install-recommends
RUN pip install --no-cache-dir --upgrade -r apphub/requirements.txt RUN pip install --no-cache-dir --upgrade -r apphub/requirements.txt
RUN pip install -e ./apphub RUN pip install -e ./apphub
@ -45,9 +46,14 @@ RUN pip install -e ./apphub
# supervisor # supervisor
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN chmod +r /etc/supervisor/conf.d/supervisord.conf RUN chmod +r /etc/supervisor/conf.d/supervisord.conf
COPY config/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh # cron
COPY config/migration.sh /migration.sh COPY config/cron /etc/cron.d/cron
RUN echo "" >> /etc/cron.d/cron
RUN crontab /etc/cron.d/cron
# chmod for all .sh script
RUN find /websoft9/script -name "*.sh" -exec chmod +x {} \;
VOLUME /websoft9/apphub/logs VOLUME /websoft9/apphub/logs
VOLUME /websoft9/apphub/src/config VOLUME /websoft9/apphub/src/config
@ -58,4 +64,4 @@ RUN rm -rf apphub/docs apphub/tests library.zip plugin-appstore && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc /usr/share/doc-base rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc /usr/share/doc-base
EXPOSE 8080 EXPOSE 8080
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/websoft9/script/entrypoint.sh"]

View File

@ -1,6 +1,4 @@
ARG APPHUB_VERSION ARG APPHUB_VERSION
FROM websoft9dev/apphub:${APPHUB_VERSION} as buildstage FROM websoft9dev/apphub:${APPHUB_VERSION} as buildstage
RUN mkdir -p /websoft9/apphub-dev RUN mkdir -p /websoft9/apphub-dev
COPY apphub/config/developer.sh /developer.sh RUN sed -i '/supervisorctl start apphub/c\supervisorctl start apphubdev' /websoft9/script/entrypoint.sh
RUN chmod +x /developer.sh
RUN sed -i '/supervisorctl start apphub/c\supervisorctl start apphubdev' /entrypoint.sh

View File

@ -0,0 +1 @@
0 2 * * * /websoft9/script/update.sh

View File

@ -17,7 +17,7 @@ stderr_logfile=/var/log/supervisord.log
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0
[program:apphubdev] [program:apphubdev]
command=/developer.sh command=/websoft9/script/developer.sh
autostart=false autostart=false
user=root user=root
stdout_logfile=/var/log/supervisord.log stdout_logfile=/var/log/supervisord.log
@ -25,11 +25,10 @@ stdout_logfile_maxbytes=0
stderr_logfile=/var/log/supervisord.log stderr_logfile=/var/log/supervisord.log
stderr_logfile_maxbytes=0 stderr_logfile_maxbytes=0
[program:updatemedia] [program:cron]
command=/usr/local/bin/python update_media.py command=cron -f
autostart=true autostart=true
user=root user=root
directory=/websoft9/apphub/src
stdout_logfile=/var/log/supervisord.log stdout_logfile=/var/log/supervisord.log
stdout_logfile_maxbytes=0 stdout_logfile_maxbytes=0
stderr_logfile=/var/log/supervisord.log stderr_logfile=/var/log/supervisord.log

View File

@ -6,7 +6,7 @@ export PATH
set -e set -e
bash /migration.sh bash /websoft9/script/migration.sh
try_times=5 try_times=5
supervisord supervisord
@ -53,4 +53,4 @@ create_apikey() {
create_apikey create_apikey
tail -f /var/log/supervisord.log tail -n 1000 -f /var/log/supervisord.log

View File

@ -0,0 +1,7 @@
#!/bin/bash
# update media and library
echo "$(date) - Compare remote version and local version" | tee -a /var/log/supervisord.log
echo "$(date) - Download remote packages and replace local data" | tee -a /var/log/supervisord.log

View File

@ -1,3 +1,5 @@
# S6 # S6
S6 is a mulitply process management tools at Nginx Proxy Manager. S6 is a mulitply process management tools at Nginx Proxy Manager.
- nginx_proxy() at migration.sh: Migration initproxy.conf to Nginx, condition is compare Container created time and Named Volumes created time