Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Hermes run on a container #67

Merged
merged 19 commits into from
Nov 19, 2023
Merged

Conversation

W3Edd
Copy link
Contributor

@W3Edd W3Edd commented Nov 18, 2023

Issue
Hermes dev instance.

Several changes were made in order to allow Hermes to run in a container, and make the database persistent across multiple instances of the container.

Moved database file path.

To allow a persistent database across multiple instances of the container, the file should be saved to the host system.
This was accomplished by linking a directory from the host system to the container system.
The host linked directory should be empty before the first run of the container in order to work.
The new path of the database from the project root is: db/hermes.db.

Added overwrite mode to the startup.py script

The python script startup.py now accepts the argument --overwrite.
If this argument is present, the script re-initializes the database, and overwrites all previously stored information.

Created a script to run the project

The script run.sh checks if the database is already initialized. If not, runs the script startup.py on overwrite mode.
This allows for an easy way to run the system with no information, by moving (or deleting) the hermes.db file on the host system.
At last, the script run.sh launches uvicorn to host on 0.0.0.0.

Created a Dockerfile to make an image of the project

This Dockerfile copies all the files from the project to the image, installs the requirements, and has an optional step to run run.sh.
This final step may be overridden by running the container with an entrypoint.
The arguments -ti --entrypoint=/bin/bash may be used to enter the container for debugging purposes.

Updated README.md

Provisional instructions were added to show how to build a docker image from the project.

@W3Edd W3Edd changed the title Make hermes run on a container Make Hermes run on a container Nov 18, 2023
@DarthTigerson DarthTigerson self-assigned this Nov 19, 2023
@DarthTigerson DarthTigerson added the enhancement New feature or request label Nov 19, 2023
@DarthTigerson DarthTigerson merged commit 27ef53b into DarthTigerson:main Nov 19, 2023
@DarthTigerson DarthTigerson removed their assignment Nov 19, 2023
@DarthTigerson
Copy link
Owner

This worked lovely. Thank you so much for your help

@W3Edd W3Edd deleted the container branch November 19, 2023 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants