Deploying Web Applications & Monitoring Web Apps

Anudha Mittal
1 min readDec 3, 2024

--

pip install watchdog

https://pypi.org/project/watchdog/

Instead of running a background process in a tmux session on a remote server for persistence, can also create a system daemon, which might be essentially the same thing, although slightly different way of going about, and there might be some differences due to how tmux is implemented. A daemon is a background process.

run a systemd service

  1. create a file with vim or an editor of choice
  • sudo nano /etc/systemd/system/fastapi.service

These are the specifications that go in to the file, i.e. the configurations.

  • [Unit] Description=FastAPI Application
  • After=network.target [Service]
  • User=your-user
  • WorkingDirectory=/path/to/your/app
  • ExecStart=/usr/bin/env uvicorn app:app — host 0.0.0.0 — port 8000
  • Restart=always[Install]
  • WantedBy=multi-user.target

[Unit] Description=FastAPI Application After=network.target [Service] User=your-user WorkingDirectory=/path/to/your/app ExecStart=/usr/bin/env uvicorn app:app --host 0.0.0.0 --port 8000 Restart=always [Install] WantedBy=multi-user.target

Enable and start the service via command line

  • sudo systemctl enable fastapi sudo systemctl start fastapi

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response