switch to bjoern
This commit is contained in:
parent
0edae2b706
commit
fef95b2561
|
@ -1,8 +1,9 @@
|
|||
FROM python:3-alpine
|
||||
FROM tecktron/python-bjoern:latest-slim
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN pip install --upgrade pip
|
||||
COPY ./requirements.txt .
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
CMD ["waitress-serve", "--host", "0.0.0.0", "--port", "1111", "artbound_python:app"]
|
||||
COPY ./artbound_python /app/artbound_python
|
||||
WORKDIR /app
|
||||
ENV APP_MODULE=artbound_python:app
|
||||
|
|
17
README.md
17
README.md
|
@ -2,15 +2,22 @@
|
|||
|
||||
A client-server reimplementation of the administration panel for ArtBound.
|
||||
|
||||
## Instructions
|
||||
## Configuration
|
||||
1. Copy `.env.example` into `.env` and fill it out;
|
||||
2. Generate a `credentials.json` with Drive and Sheets APIs and the following redirect URL: `http://localhost:1111`;
|
||||
3. Install dependencies: `poetry install`.
|
||||
|
||||
## Usage (poetry)
|
||||
* Debug: `poetry run flask --app artbound_python run --port 1111 --debug`.
|
||||
* Production: `poetry run waitress-serve --host 0.0.0.0 --port 1111 artbound_python:app`
|
||||
* Debug:
|
||||
```
|
||||
poetry install
|
||||
poetry run flask --app artbound_python run --port 1111 --debug
|
||||
```
|
||||
* Production:
|
||||
```
|
||||
poetry install --with prod
|
||||
poetry run python artbound_python
|
||||
```
|
||||
|
||||
## Usage (docker)
|
||||
1. Generate a `token.json` file: `poetry run python get_token.py`;
|
||||
1. Generate a `token.json` file: `poetry install; poetry run python get_token.py`;
|
||||
2. Build the image and start the container: `docker-compose up -d`.
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
import bjoern
|
||||
from artbound_python import app
|
||||
|
||||
bjoern.run(app, "0.0.0.0", 1111)
|
|
@ -19,10 +19,9 @@ def download_fanart(fanart_id: str):
|
|||
cached_ids = [ x.split(".")[0] for x in cached_files ]
|
||||
try:
|
||||
position = cached_ids.index(fanart_id)
|
||||
print("Using cached file.")
|
||||
fanart = cached_files[position]
|
||||
except ValueError:
|
||||
print("File is not cached. Downloading.")
|
||||
print("Downloading", fanart_id)
|
||||
fanart = get_file(fanart_id, CACHE_PATH)
|
||||
|
||||
return f"/static/res/{CACHE_DIRECTORY}/{fanart}"
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
services:
|
||||
artbound_python:
|
||||
app:
|
||||
build: .
|
||||
image: artbound_python:latest
|
||||
container_name: artbound-python
|
||||
ports:
|
||||
- 127.0.0.1:1111:1111
|
||||
# environment:
|
||||
# - SPREADSHEET_ID=
|
||||
# - RANGE=
|
||||
- 127.0.0.1:1111:80
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- cache:/app/artbound_python/static/res/cache/
|
||||
- ${PWD}/.env:/app/.env
|
||||
- ${PWD}/credentials.json:/app/credentials.json
|
||||
- ${PWD}/token.json:/app/token.json
|
||||
healthcheck:
|
||||
test: wget -nv --tries=1 --spider http://localhost || exit 1
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 2
|
||||
volumes:
|
||||
cache:
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "bjoern"
|
||||
version = "3.2.2"
|
||||
description = "A screamingly fast Python 2 + 3 WSGI server written in C."
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
files = [
|
||||
{file = "bjoern-3.2.2.tar.gz", hash = "sha256:16e5a02a9a17a7f5f8bea0d7c58650e78ab80ead6fe3e390037573d4355baf31"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "blinker"
|
||||
version = "1.6.2"
|
||||
|
@ -188,13 +198,13 @@ grpcio-gcp = ["grpcio-gcp (>=0.2.2,<1.0.dev0)"]
|
|||
|
||||
[[package]]
|
||||
name = "google-api-python-client"
|
||||
version = "2.95.0"
|
||||
version = "2.96.0"
|
||||
description = "Google API Client Library for Python"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "google-api-python-client-2.95.0.tar.gz", hash = "sha256:d2731ede12f79e53fbe11fdb913dfe986440b44c0a28431c78a8ec275f4c1541"},
|
||||
{file = "google_api_python_client-2.95.0-py2.py3-none-any.whl", hash = "sha256:a8aab2da678f42a01f2f52108f787fef4310f23f9dd917c4e64664c3f0c885ba"},
|
||||
{file = "google-api-python-client-2.96.0.tar.gz", hash = "sha256:f712373d03d338af57b9f5fe98c91f4b5baaa8765469b015bc623c4681c5bd51"},
|
||||
{file = "google_api_python_client-2.96.0-py2.py3-none-any.whl", hash = "sha256:38c2b61b10d15bb41ec8f89303e3837ec2d2c3e4e38de5800c05ee322492f937"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
|
@ -410,24 +420,24 @@ signedtoken = ["cryptography (>=3.0.0)", "pyjwt (>=2.0.0,<3)"]
|
|||
|
||||
[[package]]
|
||||
name = "protobuf"
|
||||
version = "4.23.4"
|
||||
version = "4.24.0"
|
||||
description = ""
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "protobuf-4.23.4-cp310-abi3-win32.whl", hash = "sha256:5fea3c64d41ea5ecf5697b83e41d09b9589e6f20b677ab3c48e5f242d9b7897b"},
|
||||
{file = "protobuf-4.23.4-cp310-abi3-win_amd64.whl", hash = "sha256:7b19b6266d92ca6a2a87effa88ecc4af73ebc5cfde194dc737cf8ef23a9a3b12"},
|
||||
{file = "protobuf-4.23.4-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:8547bf44fe8cec3c69e3042f5c4fb3e36eb2a7a013bb0a44c018fc1e427aafbd"},
|
||||
{file = "protobuf-4.23.4-cp37-abi3-manylinux2014_aarch64.whl", hash = "sha256:fee88269a090ada09ca63551bf2f573eb2424035bcf2cb1b121895b01a46594a"},
|
||||
{file = "protobuf-4.23.4-cp37-abi3-manylinux2014_x86_64.whl", hash = "sha256:effeac51ab79332d44fba74660d40ae79985901ac21bca408f8dc335a81aa597"},
|
||||
{file = "protobuf-4.23.4-cp37-cp37m-win32.whl", hash = "sha256:c3e0939433c40796ca4cfc0fac08af50b00eb66a40bbbc5dee711998fb0bbc1e"},
|
||||
{file = "protobuf-4.23.4-cp37-cp37m-win_amd64.whl", hash = "sha256:9053df6df8e5a76c84339ee4a9f5a2661ceee4a0dab019e8663c50ba324208b0"},
|
||||
{file = "protobuf-4.23.4-cp38-cp38-win32.whl", hash = "sha256:e1c915778d8ced71e26fcf43c0866d7499891bca14c4368448a82edc61fdbc70"},
|
||||
{file = "protobuf-4.23.4-cp38-cp38-win_amd64.whl", hash = "sha256:351cc90f7d10839c480aeb9b870a211e322bf05f6ab3f55fcb2f51331f80a7d2"},
|
||||
{file = "protobuf-4.23.4-cp39-cp39-win32.whl", hash = "sha256:6dd9b9940e3f17077e820b75851126615ee38643c2c5332aa7a359988820c720"},
|
||||
{file = "protobuf-4.23.4-cp39-cp39-win_amd64.whl", hash = "sha256:0a5759f5696895de8cc913f084e27fd4125e8fb0914bb729a17816a33819f474"},
|
||||
{file = "protobuf-4.23.4-py3-none-any.whl", hash = "sha256:e9d0be5bf34b275b9f87ba7407796556abeeba635455d036c7351f7c183ef8ff"},
|
||||
{file = "protobuf-4.23.4.tar.gz", hash = "sha256:ccd9430c0719dce806b93f89c91de7977304729e55377f872a92465d548329a9"},
|
||||
{file = "protobuf-4.24.0-cp310-abi3-win32.whl", hash = "sha256:81cb9c4621d2abfe181154354f63af1c41b00a4882fb230b4425cbaed65e8f52"},
|
||||
{file = "protobuf-4.24.0-cp310-abi3-win_amd64.whl", hash = "sha256:6c817cf4a26334625a1904b38523d1b343ff8b637d75d2c8790189a4064e51c3"},
|
||||
{file = "protobuf-4.24.0-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:ae97b5de10f25b7a443b40427033e545a32b0e9dda17bcd8330d70033379b3e5"},
|
||||
{file = "protobuf-4.24.0-cp37-abi3-manylinux2014_aarch64.whl", hash = "sha256:567fe6b0647494845d0849e3d5b260bfdd75692bf452cdc9cb660d12457c055d"},
|
||||
{file = "protobuf-4.24.0-cp37-abi3-manylinux2014_x86_64.whl", hash = "sha256:a6b1ca92ccabfd9903c0c7dde8876221dc7d8d87ad5c42e095cc11b15d3569c7"},
|
||||
{file = "protobuf-4.24.0-cp37-cp37m-win32.whl", hash = "sha256:a38400a692fd0c6944c3c58837d112f135eb1ed6cdad5ca6c5763336e74f1a04"},
|
||||
{file = "protobuf-4.24.0-cp37-cp37m-win_amd64.whl", hash = "sha256:5ab19ee50037d4b663c02218a811a5e1e7bb30940c79aac385b96e7a4f9daa61"},
|
||||
{file = "protobuf-4.24.0-cp38-cp38-win32.whl", hash = "sha256:e8834ef0b4c88666ebb7c7ec18045aa0f4325481d724daa624a4cf9f28134653"},
|
||||
{file = "protobuf-4.24.0-cp38-cp38-win_amd64.whl", hash = "sha256:8bb52a2be32db82ddc623aefcedfe1e0eb51da60e18fcc908fb8885c81d72109"},
|
||||
{file = "protobuf-4.24.0-cp39-cp39-win32.whl", hash = "sha256:ae7a1835721086013de193311df858bc12cd247abe4ef9710b715d930b95b33e"},
|
||||
{file = "protobuf-4.24.0-cp39-cp39-win_amd64.whl", hash = "sha256:44825e963008f8ea0d26c51911c30d3e82e122997c3c4568fd0385dd7bacaedf"},
|
||||
{file = "protobuf-4.24.0-py3-none-any.whl", hash = "sha256:82e6e9ebdd15b8200e8423676eab38b774624d6a1ad696a60d86a2ac93f18201"},
|
||||
{file = "protobuf-4.24.0.tar.gz", hash = "sha256:5d0ceb9de6e08311832169e601d1fc71bd8e8c779f3ee38a97a78554945ecb85"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -609,4 +619,4 @@ watchdog = ["watchdog (>=2.3)"]
|
|||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.11"
|
||||
content-hash = "a525faa662df61925931db4f337e435cab2d4875dcc954107776f1798c382831"
|
||||
content-hash = "de64c0794273972780eb6f2b764d8b6342a0130e071168036da07b03161e33b3"
|
||||
|
|
|
@ -16,6 +16,11 @@ requests = "^2.31.0"
|
|||
python-dotenv = "^1.0.0"
|
||||
waitress = "^2.1.2"
|
||||
|
||||
[tool.poetry.group.prod]
|
||||
optional = true
|
||||
|
||||
[tool.poetry.group.prod.dependencies]
|
||||
bjoern = "^3.2.2"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
|
|
Loading…
Reference in New Issue