First you need to have a Python interpreter, MongoDB and optionally git. You can also ignore git and simply download source code, should also work fine. After that you're ready to go.
> In this README I assume that you're using default python in your
> system and your system's PATH contains it. If your default python
> is `python3` or for example `/home/user/.local/bin/python3.9` - use it instead.
1. Install Mongo:
Please follow [official installation manual](https://www.mongodb.com/docs/manual/installation) for that.
2. Download Photos API:
1.`git clone https://git.end-play.xyz/profitroll/PhotosAPI.git` (if you're using git)
4. Set the key `"secret"` to your JWT secret. You can type in anything, but long secrets are recommended. You can also set environment variable `PHOTOSAPI_SECRET` as an alternative
5. Change `"external_address"` to the ip/http address you may get in responses. By default it's `"localhost"`. This is extremely useful when running behind reverse-proxy.
After configuring everything listed above your API will be able to boot, however further configuration can be done. You can read about it in [repository's wiki](https://git.end-play.xyz/profitroll/PhotosAPI/wiki/Configuration). There's no need to focus on that now, it makes more sense to configure it afterwards.
Learn more about available uvicorn arguments using `uvicorn --help`
## Using as a service
It's a good practice to use your API as a systemd service on Linux. Here's a quick overview how that can be done.
1. Create user and move your API
You don't always need to do so, but that's a cleaner way to deploy a service.
1. Create service user `photosapi` using `sudo useradd -r -U photosapi`
2. Assuming you are still in directory `PhotosAPI`, use `cd ..` to go up a level and then move your API to the distinguished folder. For example, `/opt/`: `sudo mv ./PhotosAPI /opt/`
3. Make your user and its group own their directory using `sudo chown -R photosapi:photosapi /opt/PhotosAPI`
2. Configure service
Here's an example service file for PhotosAPI that is using virtual environment: