From 5afcbe8e9d8d46c0b8941e380cd795ea829f1711 Mon Sep 17 00:00:00 2001 From: Karl Han Date: Wed, 13 Apr 2022 12:40:29 -0700 Subject: [PATCH 1/6] Add Python.gitignore as .gitignore --- .gitignore | 160 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6769e21 --- /dev/null +++ b/.gitignore @@ -0,0 +1,160 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ \ No newline at end of file From 805e10c73c445cdbef8410170aa62bd8a691760c Mon Sep 17 00:00:00 2001 From: Karl Han Date: Wed, 13 Apr 2022 12:58:28 -0700 Subject: [PATCH 2/6] Modify Dockerfile to be more readable and reduce layers. --- Dockerfile | 67 +++++++++++++++++++++--------------------------------- 1 file changed, 26 insertions(+), 41 deletions(-) diff --git a/Dockerfile b/Dockerfile index 41b926b..701706c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,71 +1,56 @@ FROM ubuntu -RUN apt-get update -RUN apt-get install sudo -RUN sudo apt-get update +# Basic Setup + RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime RUN echo 'Asia/Shanghai' >/etc/timezone -RUN apt-get install wget -y -RUN apt-get install git -y -RUN apt-get install curl -y -RUN apt-get install unzip -y -RUN sudo apt install python3 -y -RUN sudo apt install python3-dev -y -RUN sudo apt install python3-pip -y -RUN sudo apt install python3-pillow -y - +RUN apt-get update && apt-get install -y sudo && sudo apt-get update +RUN sudo apt-get install -y wget git curl unzip python3 python3-dev python3-pip python3-pillow gcc libffi-dev libssl-dev +RUN sudo apt-get install -y tzdata aria2 nginx -RUN apt install tzdata -y -RUN apt-get install aria2 -y -RUN apt-get install nginx -y +# Configuration +## install.sh: script to install Rclone and filebrowser +## ffmpeg dependency is removed in install.sh +## RUN sudo apt-get install ffmpeg -y COPY root / -RUN apt install ffmpeg -y RUN sudo chmod 777 /install.sh RUN bash install.sh +## for nginx and AriaNG RUN mv /nginx.conf /etc/nginx/ +RUN mkdir /index +COPY /index.html /index - +## for aria2 RUN mkdir /root/.aria2 COPY config /root/.aria2/ -RUN pip3 install --upgrade pip +RUN sudo chmod 777 /root/.aria2/ -RUN sudo apt-get install gcc libffi-dev libssl-dev -y -RUN pip3 install -U pyrogram tgcrypto +# PyPI Packages +RUN pip3 install -U pip +RUN pip3 install -U pyrogram tgcrypto telegraph aria2p mutagen requests yt-dlp apscheduler pyromod psutil nest_asyncio pyppeteer #RUN pip3 install pillow -RUN pip3 install telegraph -RUN pip3 install aria2p -RUN pip3 install mutagen -RUN pip3 install requests -RUN pip3 install -U yt-dlp -RUN pip3 install apscheduler -RUN pip3 install pyromod -RUN pip3 install psutil -RUN pip3 install nest_asyncio -RUN pip3 install pyppeteer -RUN sudo apt-get install gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils -y #RUN pyppeteer-install -RUN pip3 install nhentai --upgrade -RUN pip3 install beautifulsoup4 --upgrade -RUN apt-get install libxml2-dev libxslt-dev -y -RUN pip3 install lxml --upgrade +RUN sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils -RUN mkdir /index -COPY /index.html /index +RUN sudo apt-get install -y libxml2-dev libxslt-dev +RUN pip3 install -U beautifulsoup4 +RUN pip3 install -U lxml +RUN pip3 install -U nhentai +## Bot RUN mkdir /bot COPY bot /bot RUN chmod 0777 /bot/ -R -RUN sudo chmod 777 /root/.aria2/ - +## upload.sh: Use Rclone to upload files after Aria2 download is complete COPY /config/upload.sh / RUN chmod 0777 /upload.sh +# Start Daemon COPY /start.sh / -CMD chmod 0777 start.sh && bash start.sh -CMD wget https://raw.githubusercontent.com/666wcy/ARPT-Bot/main/start.sh -O start.sh && chmod 0777 start.sh && bash start.sh \ No newline at end of file +CMD chmod 0777 start.sh && bash start.sh \ No newline at end of file From 720a7778f1d6f775a9cc3a64bf7f182f56b814f8 Mon Sep 17 00:00:00 2001 From: Karl Han Date: Wed, 13 Apr 2022 14:29:21 -0700 Subject: [PATCH 3/6] Rearrange configurations for aria2, nginx and rclone to make it more clear and change Dockerfile accordingly. Plus reduce the frequency of apt-get and pip by postponing the time of adding configurations. --- Dockerfile | 56 +++++++++++++------------- config/{ => aria2}/LICENSE | 0 config/{ => aria2}/README.md | 0 config/{ => aria2}/aria2.conf | 0 config/{ => aria2}/clean.sh | 0 config/{ => aria2}/delete.sh | 0 config/{ => aria2}/dht.dat | Bin config/{ => aria2}/dht6.dat | Bin config/{ => aria2}/move.sh | 0 config/{ => aria2}/tracker.md | 0 config/{ => aria2}/tracker.sh | 0 nginx.conf => config/nginx/nginx.conf | 0 config/rclone/rclone.conf | 0 13 files changed, 29 insertions(+), 27 deletions(-) rename config/{ => aria2}/LICENSE (100%) rename config/{ => aria2}/README.md (100%) rename config/{ => aria2}/aria2.conf (100%) rename config/{ => aria2}/clean.sh (100%) rename config/{ => aria2}/delete.sh (100%) rename config/{ => aria2}/dht.dat (100%) rename config/{ => aria2}/dht6.dat (100%) rename config/{ => aria2}/move.sh (100%) rename config/{ => aria2}/tracker.md (100%) rename config/{ => aria2}/tracker.sh (100%) rename nginx.conf => config/nginx/nginx.conf (100%) create mode 100644 config/rclone/rclone.conf diff --git a/Dockerfile b/Dockerfile index 701706c..bb63765 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,50 +7,52 @@ RUN echo 'Asia/Shanghai' >/etc/timezone RUN apt-get update && apt-get install -y sudo && sudo apt-get update RUN sudo apt-get install -y wget git curl unzip python3 python3-dev python3-pip python3-pillow gcc libffi-dev libssl-dev -RUN sudo apt-get install -y tzdata aria2 nginx +RUN sudo apt-get install -y tzdata aria2 nginx ffmpeg -# Configuration +# PyPI Packages + +RUN sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils +RUN pip3 install -U pip +RUN pip3 install -U pyrogram tgcrypto telegraph aria2p mutagen requests yt-dlp apscheduler pyromod psutil nest_asyncio pyppeteer +#RUN pip3 install pillow +#RUN pyppeteer-install + +RUN sudo apt-get install -y libxml2-dev libxslt-dev +RUN pip3 install -U beautifulsoup4 +RUN pip3 install -U lxml +RUN pip3 install -U nhentai +RUN sudo apt-get clean ## install.sh: script to install Rclone and filebrowser -## ffmpeg dependency is removed in install.sh -## RUN sudo apt-get install ffmpeg -y COPY root / RUN sudo chmod 777 /install.sh RUN bash install.sh -## for nginx and AriaNG -RUN mv /nginx.conf /etc/nginx/ -RUN mkdir /index -COPY /index.html /index -## for aria2 -RUN mkdir /root/.aria2 -COPY config /root/.aria2/ -RUN sudo chmod 777 /root/.aria2/ +# Configuration +## upload.sh: Use Rclone to upload files after Aria2 download is complete +COPY config/upload.sh / +COPY config/rclone /root/.config/rclone +RUN chmod 0777 /upload.sh -# PyPI Packages -RUN pip3 install -U pip -RUN pip3 install -U pyrogram tgcrypto telegraph aria2p mutagen requests yt-dlp apscheduler pyromod psutil nest_asyncio pyppeteer -#RUN pip3 install pillow -#RUN pyppeteer-install +## for nginx +COPY config/nginx /etc/nginx -RUN sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils +## for AriaNG +RUN mkdir /index +COPY index.html /index -RUN sudo apt-get install -y libxml2-dev libxslt-dev -RUN pip3 install -U beautifulsoup4 -RUN pip3 install -U lxml -RUN pip3 install -U nhentai +## for aria2 +RUN mkdir /root/.aria2 +COPY config/aria2 /root/.aria2/ +RUN sudo chmod 777 /root/.aria2/ ## Bot RUN mkdir /bot COPY bot /bot RUN chmod 0777 /bot/ -R -## upload.sh: Use Rclone to upload files after Aria2 download is complete -COPY /config/upload.sh / -RUN chmod 0777 /upload.sh - # Start Daemon -COPY /start.sh / +COPY start.sh / CMD chmod 0777 start.sh && bash start.sh \ No newline at end of file diff --git a/config/LICENSE b/config/aria2/LICENSE similarity index 100% rename from config/LICENSE rename to config/aria2/LICENSE diff --git a/config/README.md b/config/aria2/README.md similarity index 100% rename from config/README.md rename to config/aria2/README.md diff --git a/config/aria2.conf b/config/aria2/aria2.conf similarity index 100% rename from config/aria2.conf rename to config/aria2/aria2.conf diff --git a/config/clean.sh b/config/aria2/clean.sh similarity index 100% rename from config/clean.sh rename to config/aria2/clean.sh diff --git a/config/delete.sh b/config/aria2/delete.sh similarity index 100% rename from config/delete.sh rename to config/aria2/delete.sh diff --git a/config/dht.dat b/config/aria2/dht.dat similarity index 100% rename from config/dht.dat rename to config/aria2/dht.dat diff --git a/config/dht6.dat b/config/aria2/dht6.dat similarity index 100% rename from config/dht6.dat rename to config/aria2/dht6.dat diff --git a/config/move.sh b/config/aria2/move.sh similarity index 100% rename from config/move.sh rename to config/aria2/move.sh diff --git a/config/tracker.md b/config/aria2/tracker.md similarity index 100% rename from config/tracker.md rename to config/aria2/tracker.md diff --git a/config/tracker.sh b/config/aria2/tracker.sh similarity index 100% rename from config/tracker.sh rename to config/aria2/tracker.sh diff --git a/nginx.conf b/config/nginx/nginx.conf similarity index 100% rename from nginx.conf rename to config/nginx/nginx.conf diff --git a/config/rclone/rclone.conf b/config/rclone/rclone.conf new file mode 100644 index 0000000..e69de29 From 890f87d5b773c297a143742da9456590e3ee390c Mon Sep 17 00:00:00 2001 From: Karl Han Date: Thu, 14 Apr 2022 15:26:26 -0700 Subject: [PATCH 4/6] Fix the problem of using wrong nginx.conf --- config/nginx/nginx.conf | 34 +++++------- root/nginx.conf | 113 ---------------------------------------- 2 files changed, 14 insertions(+), 133 deletions(-) delete mode 100644 root/nginx.conf diff --git a/config/nginx/nginx.conf b/config/nginx/nginx.conf index 082365e..2c1d35e 100644 --- a/config/nginx/nginx.conf +++ b/config/nginx/nginx.conf @@ -22,7 +22,7 @@ http { server { - listen heroku_port; + listen 8868; server_name 0.0.0.0; @@ -67,22 +67,12 @@ http { } - location /status/ - { - proxy_pass http://127.0.0.1:5000/; - proxy_set_header Host 127.0.0.1; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header REMOTE-HOST $remote_addr; - - - } location / { - expires 12h; + proxy_buffering off; proxy_pass http://127.0.0.1:9184; proxy_set_header Host $host; @@ -96,21 +86,25 @@ http { } - location /webdav + + + location ~ ^/(rc|config|operations|core)/.*$ { - dav_methods PUT DELETE MKCOL COPY MOVE; - proxy_pass http://127.0.0.1:9184; + proxy_pass http://127.0.0.1:5572; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; - - add_header X-Cache $upstream_cache_status; - add_header Cache-Control no-cache; + add_header X-Cache $upstream_cache_status; - - } + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + + + + } } diff --git a/root/nginx.conf b/root/nginx.conf deleted file mode 100644 index 2c1d35e..0000000 --- a/root/nginx.conf +++ /dev/null @@ -1,113 +0,0 @@ - -error_log /tmp/error.log; -pid /tmp/nginx.pid; - -events { - # No special events for this simple setup -} -http { - - map $http_upgrade $connection_upgrade { - default upgrade; - '' close; - } - - upstream websocket { - #ip_hash; - server localhost:8010; - server localhost:8011; - } - - - - - server { - listen 8868; - server_name 0.0.0.0; - - - error_log /tmp/error.log; - access_log /tmp/nginx_host.access.log; - client_body_temp_path /tmp/client_body; - fastcgi_temp_path /tmp/fastcgi_tmp; - proxy_temp_path /tmp/proxy_tmp; - scgi_temp_path /tmp/scgi_tmp; - uwsgi_temp_path /tmp/uwsgi_tmp; - - include mime.types; - default_type application/octet-stream; - - - sendfile on; - - keepalive_timeout 65; - - - location /jsonrpc - { - proxy_pass http://127.0.0.1:8080; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header REMOTE-HOST $remote_addr; - - add_header X-Cache $upstream_cache_status; - - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - - } - - location /ng - { - index index.html; - alias /index/; - autoindex on; - - } - - - - - location / - { - - proxy_buffering off; - proxy_pass http://127.0.0.1:9184; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header REMOTE-HOST $remote_addr; - - add_header X-Cache $upstream_cache_status; - add_header Cache-Control no-cache; - - - - } - - - location ~ ^/(rc|config|operations|core)/.*$ - { - proxy_pass http://127.0.0.1:5572; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header REMOTE-HOST $remote_addr; - - add_header X-Cache $upstream_cache_status; - - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - - - - } - - } - - - - } From 5020d2a624bde6c1fc34ef4fc825db5b5225333a Mon Sep 17 00:00:00 2001 From: Karl Han Date: Thu, 14 Apr 2022 15:30:28 -0700 Subject: [PATCH 5/6] Fix the problem of using wrong nginx.conf --- config/nginx/nginx.conf | 34 +++++------- root/nginx.conf | 113 ---------------------------------------- 2 files changed, 14 insertions(+), 133 deletions(-) delete mode 100644 root/nginx.conf diff --git a/config/nginx/nginx.conf b/config/nginx/nginx.conf index 082365e..2c1d35e 100644 --- a/config/nginx/nginx.conf +++ b/config/nginx/nginx.conf @@ -22,7 +22,7 @@ http { server { - listen heroku_port; + listen 8868; server_name 0.0.0.0; @@ -67,22 +67,12 @@ http { } - location /status/ - { - proxy_pass http://127.0.0.1:5000/; - proxy_set_header Host 127.0.0.1; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header REMOTE-HOST $remote_addr; - - - } location / { - expires 12h; + proxy_buffering off; proxy_pass http://127.0.0.1:9184; proxy_set_header Host $host; @@ -96,21 +86,25 @@ http { } - location /webdav + + + location ~ ^/(rc|config|operations|core)/.*$ { - dav_methods PUT DELETE MKCOL COPY MOVE; - proxy_pass http://127.0.0.1:9184; + proxy_pass http://127.0.0.1:5572; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; - - add_header X-Cache $upstream_cache_status; - add_header Cache-Control no-cache; + add_header X-Cache $upstream_cache_status; - - } + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + + + + } } diff --git a/root/nginx.conf b/root/nginx.conf deleted file mode 100644 index 2c1d35e..0000000 --- a/root/nginx.conf +++ /dev/null @@ -1,113 +0,0 @@ - -error_log /tmp/error.log; -pid /tmp/nginx.pid; - -events { - # No special events for this simple setup -} -http { - - map $http_upgrade $connection_upgrade { - default upgrade; - '' close; - } - - upstream websocket { - #ip_hash; - server localhost:8010; - server localhost:8011; - } - - - - - server { - listen 8868; - server_name 0.0.0.0; - - - error_log /tmp/error.log; - access_log /tmp/nginx_host.access.log; - client_body_temp_path /tmp/client_body; - fastcgi_temp_path /tmp/fastcgi_tmp; - proxy_temp_path /tmp/proxy_tmp; - scgi_temp_path /tmp/scgi_tmp; - uwsgi_temp_path /tmp/uwsgi_tmp; - - include mime.types; - default_type application/octet-stream; - - - sendfile on; - - keepalive_timeout 65; - - - location /jsonrpc - { - proxy_pass http://127.0.0.1:8080; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header REMOTE-HOST $remote_addr; - - add_header X-Cache $upstream_cache_status; - - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - - } - - location /ng - { - index index.html; - alias /index/; - autoindex on; - - } - - - - - location / - { - - proxy_buffering off; - proxy_pass http://127.0.0.1:9184; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header REMOTE-HOST $remote_addr; - - add_header X-Cache $upstream_cache_status; - add_header Cache-Control no-cache; - - - - } - - - location ~ ^/(rc|config|operations|core)/.*$ - { - proxy_pass http://127.0.0.1:5572; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header REMOTE-HOST $remote_addr; - - add_header X-Cache $upstream_cache_status; - - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - - - - } - - } - - - - } From c8ac3e6271b598ae82bdf6439671d8230fb48f9b Mon Sep 17 00:00:00 2001 From: Karl Han Date: Thu, 14 Apr 2022 19:23:50 -0700 Subject: [PATCH 6/6] Remove redundant operations in start.sh and add ffmpeg-python to pip dependency for future use. --- Dockerfile | 4 +--- config/aria2/aria2.session | 0 start.sh | 32 +++----------------------------- 3 files changed, 4 insertions(+), 32 deletions(-) create mode 100644 config/aria2/aria2.session diff --git a/Dockerfile b/Dockerfile index bb63765..93fbb49 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,9 +13,7 @@ RUN sudo apt-get install -y tzdata aria2 nginx ffmpeg RUN sudo apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils RUN pip3 install -U pip -RUN pip3 install -U pyrogram tgcrypto telegraph aria2p mutagen requests yt-dlp apscheduler pyromod psutil nest_asyncio pyppeteer -#RUN pip3 install pillow -#RUN pyppeteer-install +RUN pip3 install -U pyrogram tgcrypto telegraph aria2p mutagen requests yt-dlp apscheduler pyromod psutil nest_asyncio pyppeteer ffmpeg-python RUN sudo apt-get install -y libxml2-dev libxslt-dev RUN pip3 install -U beautifulsoup4 diff --git a/config/aria2/aria2.session b/config/aria2/aria2.session new file mode 100644 index 0000000..e69de29 diff --git a/start.sh b/start.sh index 8dbf0ab..bdcf5ae 100644 --- a/start.sh +++ b/start.sh @@ -1,38 +1,12 @@ #!/bin/bash - - - -touch /root/.aria2/aria2.session -chmod 0777 /root/.aria2/ -R - -nohup filebrowser -r / -p 9184 >> /dev/null 2>&1 & -#nohup ./FolderMagic -aria "http://127.0.0.1:6800/jsonrpc" -auth root:$Aria2_secret -bind :9184 -root / -wd /webdav >> /dev/null 2>&1 & - -mkdir /.config/ -mkdir /.config/rclone -touch /.config/rclone/rclone.conf - -wget git.io/tracker.sh -chmod 0777 /tracker.sh -/bin/bash tracker.sh "/root/.aria2/aria2.conf" - -rm -rf /bot -git clone https://github.com/666wcy/ARPT-Bot.git -mkdir /bot/ -mv /ARPT-Bot/bot/* /bot/ - -rm /etc/nginx/nginx.conf -cp /ARPT-Bot/root/nginx.conf /etc/nginx/ - -rm -rf /ARPT-Bot - -#python3 /bot/nginx.py nginx -c /etc/nginx/nginx.conf nginx -s reload +/bin/bash /root/.aria2/tracker.sh "/root/.aria2/aria2.conf" + nohup aria2c --conf-path=/root/.aria2/aria2.conf --rpc-listen-port=8080 --rpc-secret=$Aria2_secret & nohup rclone rcd --rc-addr=127.0.0.1:5572 --rc-user=root --rc-pass=$Aria2_secret --rc-allow-origin="https://elonh.github.io" & -#nohup python3 /bot/web.py & +nohup filebrowser -r / -p 9184 >> /dev/null 2>&1 & python3 /bot/main.py \ No newline at end of file