Skip to content

Commit 0bbd412

Browse files
committed
Fixes to local dev docker-compose
1 parent fd79d4e commit 0bbd412

6 files changed

Lines changed: 20 additions & 17 deletions

File tree

.python-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

docker-compose.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
build:
1111
context: .
1212
dockerfile: ./docker/local/Dockerfile
13-
command: uv run manage.py runserver_plus 0.0.0.0:8000
13+
command: python manage.py runserver_plus 0.0.0.0:8000 --nopin
1414
ports:
1515
- "8000:8000"
1616
volumes:
@@ -27,7 +27,7 @@ services:
2727
build:
2828
context: .
2929
dockerfile: ./docker/local/Dockerfile
30-
command: uv run celery -A lolsite worker -l info
30+
command: celery -A lolsite worker -l info
3131
volumes:
3232
- .:/code
3333
links:
@@ -41,7 +41,7 @@ services:
4141
build:
4242
context: .
4343
dockerfile: ./docker/local/Dockerfile
44-
command: uv run celery -A lolsite beat -l INFO
44+
command: celery -A lolsite beat -l INFO
4545
volumes:
4646
- .:/code
4747
links:
@@ -57,7 +57,7 @@ services:
5757
build:
5858
context: .
5959
dockerfile: ./docker/local/Dockerfile
60-
command: uv run tailwindcss -i ./lolsite/static/src/main.css -o ./lolsite/static/src/output.css --minify --watch
60+
command: tailwindcss -i ./lolsite/static/src/main.css -o ./lolsite/static/src/output.css --minify --watch
6161
volumes:
6262
- .:/code
6363
env_file: .docker_env

docker/local/Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM ghcr.io/astral-sh/uv:alpine
1+
FROM python:3.14-alpine
2+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
23
ENV UV_NO_DEV=1
34
ENV PYTHONUNBUFFERED=1
45
ENV PYTHONFAULTHANDLER=1
@@ -7,4 +8,9 @@ WORKDIR /code
78
COPY pyproject.toml uv.lock ./
89

910
RUN apk add --no-cache alpine-sdk gcc g++ python3-dev jpeg-dev zlib-dev
10-
RUN uv sync --locked
11+
12+
# Running uv run manage.py runserver results in semaphore leaks that I do not understand
13+
# when I run the server directly with the system python, I do not run into the same issues,
14+
# so I am installing to the system python rather than `uv sync` and `uv run`
15+
RUN uv export > requirements.txt
16+
RUN uv pip install -r requirements.txt --system

match/serializers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import logging
1818

1919
logger = logging.getLogger(__name__)
20-
CACHE_TIME = 60 * 60 * 48
2120

2221

2322
class MatchSerializer(serializers.ModelSerializer):

match/tasks.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import time
33
import json
44
from datetime import timedelta, datetime
5-
from multiprocessing.pool import ThreadPool
5+
from concurrent.futures import ThreadPoolExecutor
66
from functools import partial
77
from typing import Optional, assert_never
88
from urllib3.exceptions import MaxRetryError
@@ -282,8 +282,8 @@ def import_recent_matches(
282282
if len(jobs) == 1:
283283
pool_match_import(*jobs[0], close_connections=False)
284284
else:
285-
with ThreadPool(processes=min(10, len(jobs))) as pool:
286-
pool.starmap(pool_match_import, jobs)
285+
with ThreadPoolExecutor(max_workers=min(10, len(jobs))) as executor:
286+
executor.map(lambda args: pool_match_import(*args), jobs)
287287
logger.info(
288288
f"ThreadPool match import: {time.perf_counter() - start_time}"
289289
)
@@ -746,14 +746,13 @@ def get_player_ranks(summoner_list, threshold_days=1, sync=True):
746746
for x in jobs:
747747
pt.import_positions(*x)
748748
else:
749-
with ThreadPool(processes=10) as pool:
750-
749+
with ThreadPoolExecutor(max_workers=10) as executor:
751750
def pool_position_import(a, b):
752751
pt.import_positions(a, b)
753752
connections.close_all()
754753

755754
start_time = time.perf_counter()
756-
pool.starmap(pool_position_import, jobs)
755+
executor.map(lambda args: pool_position_import(*args), jobs)
757756
logger.info(
758757
f"ThreadPool positions import: {time.perf_counter() - start_time}"
759758
)

uv.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)