Skip to content

Commit

Permalink
Fix page_token bug, add deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminPelletier committed May 11, 2024
1 parent a5bed46 commit 78b86d7
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 2 deletions.
4 changes: 3 additions & 1 deletion aerodata/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
93 changes: 93 additions & 0 deletions deploy.md
Original file line number Diff line number Diff line change
@@ -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 [email protected] --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
```
2 changes: 1 addition & 1 deletion run.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 78b86d7

Please sign in to comment.