chore: add deployment section to readme

This commit is contained in:
Ayo Ayco 2024-04-08 15:52:45 +02:00
parent a1f72f896d
commit f327bb749c

View file

@ -3,8 +3,8 @@
## Background ## Background
Yet another rewrite of my [personal site](https://ayo.ayco.io) Yet another rewrite of my [personal site](https://ayo.ayco.io)
## Development -- needs Debian ## Development -- needs Linux / MacOS
1. Set up your machine. See [digitalOcean tutorial](https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-20-04) (uses cookies) 1. Set up your machine
```bash ```bash
# update repositories # update repositories
@ -30,15 +30,23 @@ Yet another rewrite of my [personal site](https://ayo.ayco.io)
$ . .venv/bin/activate $ . .venv/bin/activate
# install wheel: # install wheel:
$ pip install wheel (.venv)$ pip install wheel
# install gunicorn & flask: # install gunicorn & flask:
$ pip install gunicorn flask (.venv)$ pip install flask
# rejoice! # rejoice!
``` ```
3. To start development: 3. To start development, run the following:
1. allow port usage: `sudo ufw allow 5000` ```bash
2. run the development server: `python api.py`` (.venv)$ python api.py
```
> Note: On a Mac, the default port 5000 is used by AirDrop & Handoff; you may have to turn those off
4. After development session, deactivate the python env with: `deactivate` 4. After development session, deactivate the python env with: `deactivate`
## Deployment
For deployment, the recommended setup is with production server `gunicorn` and reverse proxy `nginx`. See the [DigitalOcean tutorial](https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-20-04) (their website uses cookies).