diff --git a/aerodata/query.py b/aerodata/query.py index 5a9fca2..0dbb2ba 100644 --- a/aerodata/query.py +++ b/aerodata/query.py @@ -138,6 +138,8 @@ def select_features(all_features: dict, query: AerodromeQueryParams) -> dict: "features": features, } if page_token: - feature_collection["metadata"]["next_page_token"] = str(page_token) + feature_collection["metadata"] = { + "next_page_token": str(page_token) + } return feature_collection diff --git a/deploy.md b/deploy.md new file mode 100644 index 0000000..d92fc34 --- /dev/null +++ b/deploy.md @@ -0,0 +1,93 @@ +## Reference +https://medium.com/@gary.ascuy/docker-free-ssl-tls-certs-lets-encrypt-184e62ab272e + +## Local server setup + +```shell +curl -fsSL https://get.docker.com | sh +``` +```shell +sudo apt install git +``` + +```shell +git clone https://github.com/BenjaminPelletier/aerodata +``` + +```shell +cd aerodata +``` + +```shell +sudo ./run.sh +``` + +## nginx setup + +```shell +sudo docker run --rm -p 80:80 -p 443:443 \ + -v /root/nginx/letsencrypt:/etc/letsencrypt \ + certbot/certbot certonly -d aerodata.uastech.co \ + --standalone -m pelletierb@wing.com --agree-tos +``` + +```shell +sudo openssl dhparam -out /root/nginx/dhparam.pem 4096 +``` + +### /root/nginx/nginx.conf + +``` +events { + worker_connections 4096; +} + +http { + server { + listen 80; + server_name aerodata.uastech.co; + return 301 https://$host$request_uri; + } + + server { + listen 443 ssl default deferred; + server_name aerodata.uastech.co; + + ssl_certificate /etc/letsencrypt/live/aerodata.uastech.co/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/aerodata.uastech.co/privkey.pem; + ssl_dhparam /etc/ssl/certs/dhparam.pem; + add_header Strict-Transport-Security "max-age=63072000; includeSubdomains"; + ssl_trusted_certificate /etc/letsencrypt/live/aerodata.uastech.co/fullchain.pem; + + location / { + proxy_pass http://host.docker.internal:8090; + } + } +} +``` + +```shell +sudo docker run --restart always -d -p 80:80 -p 443:443 \ + -v /root/nginx/letsencrypt:/etc/letsencrypt \ + -v /root/nginx/dhparam.pem:/etc/ssl/certs/dhparam.pem \ + -v /root/nginx/nginx.conf:/etc/nginx/nginx.conf \ + --add-host=host.docker.internal:host-gateway \ + --name proxy \ + nginx:alpine +``` + +## Cert renewal + +```shell +docker stop proxy +``` + +```shell +docker run --rm -p 80:80 -p 443:443 \ + -v /root/nginx/letsencrypt:/etc/letsencrypt \ + certbot/certbot renew +``` + +```shell +docker start proxy +``` diff --git a/run.sh b/run.sh index 78e18e4..95f58fd 100755 --- a/run.sh +++ b/run.sh @@ -1,4 +1,4 @@ #!/bin/bash docker image build -t aerodata . -docker container run -d -p 8090:8090 -v $(pwd)/aerodata:/app/aerodata aerodata +docker container run -d --name aerodata -p 8090:8090 -v $(pwd)/aerodata:/app/aerodata aerodata