Deployment Automation
To streamline the backend deployment process and mimic the ease of use found in cloud platforms like Vercel, an automated deployment workflow was configured.
This workflow utilizes:
- GitHub Webhook: A webhook is set up on the backend’s GitHub repository. It is configured to trigger upon
push
events to the main branch. - FastAPI Webhook Listener: A dedicated, secure endpoint within the running FastAPI application listens for incoming requests from the GitHub webhook.
- Deployment Script: When the listener receives a valid webhook event, it automatically executes a deployment script on the server.
The deployment script typically performs the following actions:
- Navigates to the application directory.
- Pulls the latest code changes from the GitHub repository (
git pull
). - Installs or updates dependencies if necessary.
- Restarts the application service (managed by systemd) to apply the changes seamlessly.
This automated setup allows for rapid iteration, ensuring that changes pushed to the repository are deployed to the live backend environment within seconds with minimal manual intervention and downtime.