This project is a simple example of how systemd works at running an application.
The API runs on port 8000 and has only one endpoint at root that will return hello world.
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
source venv/bin/activate
python generate_template.py
By default, the generate_template.py
file will use the current user running the command to run the systemd process.
A --user <username>
argument can be parsed to the generate_template
script if you want to use a different user.
chmod +x run.sh
- with the user running the process in the previous stepsudo cp config/hello_world_api.service /etc/systemd/system/
systemctl start hello_world_api.service
If you make changes or copy the file again, you should run systemctl daemon-reload
after making the changes.