Skip to content

Commit

Permalink
Merge pull request #83 from W3Edd/production
Browse files Browse the repository at this point in the history
Run Hermes on production mode
  • Loading branch information
DarthTigerson committed Nov 25, 2023
2 parents 92f9dc9 + d4d1916 commit c6bad4b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ You can install the [project locally](#local-installation), and run it as you se
4. Give executable permissions to the launcher script: `chmod +x run.sh`
5. Run the application: `./run.sh`

## Run on production mode (with HTTPS)

To run this over HTTPS, you will need your cert files.
You can read more about that [here](https://letsencrypt.org/).

1. Clone the repository: `git clone https://github.com/DarthTigerson/Hermes.git`
2. Install the dependencies: `pip install -r requirements.txt`
3. Create a `.env` file and set the environment variables (see `.env.example` for an example)
4. Give executable permissions to the launcher script: `chmod +x run.sh`
5. Execute the `run.sh` script with the following parameters: `run.sh <KEYFILE_PATH> <CERTFILE_PATH>`

This way, Hermes will be running, available to your network, on port 443, with HTTPS.

## Build Docker image

It is possible to build your own docker image from the `Dockerfile` in this repository.
Expand Down
13 changes: 12 additions & 1 deletion run.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
#!/bin/bash

# If database is not set, start it
if [ ! -e db/hermes.db ]
then
mkdir db
python startup.py --overwrite
fi

uvicorn main:app --host 0.0.0.0 --reload
# If no params were given, run on dev mode
if [ $# -eq 0 ]
then
uvicorn main:app --host 0.0.0.0 --reload
fi

# If two params were given, run in production secure mode
if [ $# -eq 2 ]
then
uvicorn main:app --host 0.0.0.0 --port 443 --ssl-keyfile="$1" --ssl-certfile="$2"
fi

0 comments on commit c6bad4b

Please sign in to comment.