This commit is contained in:
2026-03-25 12:39:54 +01:00
parent 87820051a7
commit 7abb819e76
6 changed files with 76 additions and 63 deletions

View File

@@ -1,28 +1,28 @@
ESI_CLIENT_ID= ESI_CLIENT_ID=placeholder-client-id
ESI_SECRET_KEY= ESI_SECRET_KEY=placeholder-secret-key
ESI_CALLBACK_URL= ESI_CALLBACK_URL=http://localhost:8000/esi/callback/
ESI_USER_AGENT= ESI_USER_AGENT=marbas-dev-agent
REDIS_URL= REDIS_URL=redis
REDIS_PORT= REDIS_PORT=6379
REDIS_DB= REDIS_DB=0
REDIS_PASSWORD= REDIS_PASSWORD=
REDIS_USER= REDIS_USER=
SQLITE_DB_PATH= SQLITE_DB_PATH=db.sqlite3
POSTGRES_HOST= POSTGRES_HOST=db
POSTGRES_PORT= POSTGRES_PORT=5432
POSTGRES_PASSWORD= POSTGRES_PASSWORD=marbas
POSTGRES_USER= POSTGRES_USER=marbas
POSTGRES_DB= POSTGRES_DB=marbas
DRF_SECRET_KEY= DRF_SECRET_KEY=django-insecure-dev-key-change-me
DRF_DEBUG= DRF_DEBUG=True
DEBUG= DEBUG=True
ALLOWED_HOSTS= ALLOWED_HOSTS=localhost,127.0.0.1,0.0.0.0
CORS_ALLOWED_ORIGINS= CORS_ALLOWED_ORIGINS=http://localhost:8000,http://127.0.0.1:8000
CSRF_TRUSTED_ORIGINS= CSRF_TRUSTED_ORIGINS=http://localhost:8000,http://127.0.0.1:8000
OIDC_RP_CLIENT_ID= OIDC_RP_CLIENT_ID=placeholder-oidc-client-id
OIDC_WELLKNOWN= OIDC_WELLKNOWN=https://login.eveonline.com/.well-known/openid-configuration
OIDC_CACHE_USERINFO= OIDC_CACHE_USERINFO=True

View File

@@ -6,14 +6,13 @@ ENV PYTHONDONTWRITEBYTECODE=1
RUN adduser -u 5678 --disabled-password --gecos "" appuser RUN adduser -u 5678 --disabled-password --gecos "" appuser
WORKDIR /app WORKDIR /app
COPY --chown=appuser:appuser manage.py /app/manage.py
COPY requirements.txt . COPY requirements.txt .
RUN python -m pip install --no-cache-dir --upgrade -r requirements.txt RUN python -m pip install --no-cache-dir --upgrade -r requirements.txt
COPY --chown=appuser:appuser marbas /app/marbas
COPY --chown=appuser:appuser sde /app/sde RUN mkdir -p /app/static && chown appuser:appuser /app/static
COPY --chown=appuser:appuser api /app/api
COPY --chown=appuser:appuser authentication /app/authentication COPY --chown=appuser:appuser . /app
#COPY --chown=appuser:appuser static /app/static
USER appuser USER appuser
EXPOSE 8000 EXPOSE 8000

9
api/tasks.py Normal file
View File

@@ -0,0 +1,9 @@
from celery import Celery
app = Celery(
'prod',
broker='redis://localhost:6379/0'
)
if __name__ == '__main__':
app.start()

View File

@@ -90,7 +90,9 @@ def reprocess_eval(request):
ep_items = request.data.get("ep_items") ep_items = request.data.get("ep_items")
efficiency = request.data.get("efficiency", 0.55) efficiency = request.data.get("efficiency", 0.55)
matprices = {item["typeID"]: {'sell': item["prices"]["sell"]["min"], 'buy': item["prices"]["buy"]["max"]} for item in ep_mat['items']} matprices = {item["typeID"]: {'sell': item["prices"]["sell"]["min"],
'buy': item["prices"]["buy"]["max"]}
for item in ep_mat['items']}
item_reprocess = [] item_reprocess = []
for rawitem in ep_items["items"]: for rawitem in ep_items["items"]:

View File

@@ -1,42 +1,33 @@
services: services:
migrations: app_base: &app_base
image: marbas:local
build:
context: .
dockerfile: Dockerfile
env_file:
- .env
user: "1000:1000"
volumes:
- ./marbas:/app/marbas
- ./api:/app/api
- ./sde:/app/sde
- ./authentication:/app/authentication
- ./manage.py:/app/manage.py
- ./static:/app/static
command: sh -c "python manage.py makemigrations && python manage.py migrate"
depends_on:
db:
condition: service_healthy
eveal:
image: marbas:local image: marbas:local
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
env_file: env_file:
- .env - .env
user: "${UID:-1000}:${GID:-1000}"
volumes:
- .:/app:z
depends_on:
db:
condition: service_healthy
migrations:
<<: *app_base
command: sh -c "python manage.py makemigrations && python manage.py migrate"
import_sde:
<<: *app_base
command: python manage.py import_sde /app/static_eve/sde/fsd
depends_on:
migrations:
condition: service_completed_successfully
eveal:
<<: *app_base
ports: ports:
- "8000:8000" - "8000:8000"
user: "1000:1000"
volumes:
- ./marbas:/app/marbas
- ./api:/app/api
- ./sde:/app/sde
- ./authentication:/app/authentication
- ./manage.py:/app/manage.py
- ./static_eve:/app/static_eve
- ./static:/app/static
command: ["uvicorn", "marbas.asgi:application", "--host", "0.0.0.0", "--port", "8000", "--reload"] command: ["uvicorn", "marbas.asgi:application", "--host", "0.0.0.0", "--port", "8000", "--reload"]
healthcheck: healthcheck:
test: python manage.py health_check test: python manage.py health_check
@@ -48,8 +39,19 @@ services:
condition: service_healthy condition: service_healthy
migrations: migrations:
condition: service_completed_successfully condition: service_completed_successfully
# elasticsearch: import_sde:
# condition: service_healthy condition: service_completed_successfully
worker:
<<: *app_base
command: celery -A marbas worker -l info
depends_on:
redis:
condition: service_healthy
db:
condition: service_healthy
migrations:
condition: service_completed_successfully
redis: redis:
image: redis:latest image: redis:latest
@@ -64,7 +66,7 @@ services:
ports: ports:
- "5432:5432" - "5432:5432"
volumes: volumes:
- marbas_dbdata:/var/lib/postgresql/data - marbas_dbdata:/var/lib/postgresql/data:Z
env_file: env_file:
- .env - .env
healthcheck: healthcheck:

View File

@@ -14,3 +14,4 @@ django-health-check
mozilla-django-oidc mozilla-django-oidc
django-cors-headers django-cors-headers
whitenoise whitenoise
celery