Skip to content

Commit

Permalink
Merge pull request #50 from openstreetmap-polska/dev
Browse files Browse the repository at this point in the history
Release to main
  • Loading branch information
Zaczero authored Feb 11, 2024
2 parents 5fc5b90 + 9b31917 commit 37d6bcf
Show file tree
Hide file tree
Showing 6 changed files with 334 additions and 73 deletions.
8 changes: 2 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@
"name": "Python: FastAPI",
"type": "debugpy",
"request": "launch",
"module": "hypercorn",
"module": "uvicorn",
"args": [
"main:app",
"--access-logfile",
"-",
"--workers",
"1",
"--worker-class",
"uvloop"
"1"
],
"jinja": true,
"justMyCode": true
Expand Down
4 changes: 2 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ with pkgs; dockerTools.buildLayeredImage {
Volumes = {
"/app/data/photos" = { };
};
Entrypoint = [ "python" "-m" "hypercorn" "main:app" ];
Cmd = [ "--bind" "0.0.0.0" ];
Entrypoint = [ "python" "-m" "uvicorn" "main:app" ];
Cmd = [ "--host" "0.0.0.0" ];
};
}
25 changes: 7 additions & 18 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,17 @@ services:
restart: unless-stopped
command:
[
"--bind",
"--host",
"0.0.0.0",
"--access-logfile",
"-",
"--workers",
"${WORKERS:-1}",
"--worker-class",
"uvloop",
"--keep-alive",
"--timeout-keep-alive",
"300",
"--graceful-timeout",
"--timeout-graceful-shutdown",
"5",
"--proxy-headers",
"--forwarded-allow-ips",
"*",
]

depends_on:
Expand All @@ -55,17 +54,7 @@ services:
image: docker.io/library/varnish:alpine
restart: unless-stopped
user: root
command:
[
"varnishd",
"-F",
"-f",
"/etc/varnish/default.vcl",
"-s",
"file,/var/lib/varnish/varnish_storage.bin,2G",
"-p",
"feature=+http2",
]
command: ["varnishd", "-F", "-f", "/etc/varnish/default.vcl", "-s", "file,/var/lib/varnish/varnish_storage.bin,2G"]

depends_on:
- app
Expand Down
3 changes: 0 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import anyio
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from hypercorn.middleware import ProxyFixMiddleware
from starlette.middleware.base import BaseHTTPMiddleware

import api.v1.api as api
Expand Down Expand Up @@ -54,5 +53,3 @@ async def lifespan(_):
allow_methods=['GET'],
max_age=int(timedelta(days=1).total_seconds()),
)

app = ProxyFixMiddleware(app)
Loading

0 comments on commit 37d6bcf

Please sign in to comment.