Skip to content

Commit 376114e

Browse files
committed
WIP - playing around with using an nginx proxy to handle /v1 and /v2 for local dev
1 parent f09d481 commit 376114e

File tree

7 files changed

+113
-7
lines changed

7 files changed

+113
-7
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,6 @@ attachments/
7474

7575
# Visual Studio Code
7676
.vscode/
77+
78+
# Git reader data
79+
git-reader/data

docker-compose.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ services:
2626
user: root
2727
ports:
2828
- 8000:8000
29+
2930
web:
3031
build:
3132
dockerfile: RemoteSettings.Dockerfile
@@ -36,21 +37,33 @@ services:
3637
- db
3738
- memcached
3839
- autograph
40+
# ports:
41+
# - 8888:8888
3942
environment:
4043
- KINTO_CACHE_BACKEND=kinto.core.cache.memcached
4144
- KINTO_CACHE_HOSTS=memcached:11211 memcached:11212
4245
- KINTO_STORAGE_BACKEND=kinto.core.storage.postgresql
4346
- KINTO_STORAGE_URL=postgresql://postgres@db/postgres
4447
- KINTO_PERMISSION_BACKEND=kinto.core.permission.postgresql
4548
- KINTO_PERMISSION_URL=postgresql://postgres@db/postgres
46-
ports:
47-
- 8888:8888
4849
volumes:
4950
- ./config:/app/config
5051
- ./kinto-remote-settings:/app/kinto-remote-settings
5152
- debug-mail:/app/mail
5253
- attachments:/tmp/attachments
5354

55+
git-reader:
56+
build:
57+
context: git-reader/
58+
args:
59+
UID: 1000
60+
GID: 1000
61+
environment:
62+
- GIT_REPO_PATH=/mnt/data/latest
63+
- SELF_CONTAINED=true
64+
volumes:
65+
- ./git-reader/data:/mnt/data
66+
5467
browser-tests:
5568
build:
5669
context: browser-tests/
@@ -68,3 +81,13 @@ services:
6881
context: cronjobs/
6982
image: remotesettings/cronjobs
7083
profiles: [cronjobs]
84+
85+
web-proxy:
86+
image: openresty/openresty
87+
ports:
88+
- 8888:8888
89+
volumes:
90+
- ./nginx.conf:/etc/nginx/conf.d/default.conf
91+
depends_on:
92+
- web
93+
- git-reader

git-reader/Dockerfile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
ARG UID=10001
2+
ARG GID=10001
3+
14
FROM python:3.14.0-slim-trixie
25

6+
ARG UID
7+
ARG GID
8+
39
ENV PIP_NO_CACHE_DIR=off \
410
PIP_DISABLE_PIP_VERSION_CHECK=on \
511
POETRY_NO_INTERACTION=1 \
@@ -16,9 +22,9 @@ RUN python -m venv $VIRTUAL_ENV && \
1622

1723
WORKDIR /app
1824

19-
RUN chown 10001:10001 /app && \
20-
groupadd --gid 10001 app && \
21-
useradd --no-create-home --uid 10001 --gid 10001 --home-dir /app app
25+
RUN chown ${UID}:${GID} /app
26+
RUN groupadd --gid ${GID} app
27+
RUN useradd --no-create-home --uid ${UID} --gid ${GID} --home-dir /app app
2228

2329
RUN mkdir /app/.ssh && \
2430
ssh-keyscan github.com >> /app/.ssh/known_hosts && \

git-reader/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ def _get_file_content(
361361
refobj = self.repo.lookup_reference(f"refs/heads/{branch}")
362362
commit = self.repo[refobj.target]
363363
node = commit.tree
364+
print(node)
364365

365366
parts = [p for p in path.strip("/").split("/") if p]
366367
for i, name in enumerate(parts):

git-reader/poetry.lock

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

git-reader/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pygit2 = "^1.18.2"
1313
uvicorn = "^0.35.0"
1414
uvloop = "^0.21.0"
1515
pyjwt = "^2.10.1"
16+
lz4 = "^4.4.4"
1617

1718
[tool.pytest.ini_options]
1819
pythonpath = ["."]

nginx.conf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
server {
2+
listen 8888;
3+
server_name localhost;
4+
5+
location / {
6+
proxy_pass http://web:8888/;
7+
}
8+
9+
location /v1 {
10+
proxy_pass http://web:8888/v1;
11+
}
12+
13+
location /v2 {
14+
proxy_pass http://git-reader:8000/v2;
15+
}
16+
}

0 commit comments

Comments
 (0)