How Serversinc uses Serversinc to deploy to prod
June 9, 2025
Over the past few weeks, I’ve been putting Serversinc to the test by using it to deploy itself to both staging and production environments. In this article, I’ll walk you through how I’m using Serversinc to deploy itself and highlight some of the tools and practices I rely on.
The Big Picture
Serversinc is designed to help manage and deploy applications across servers. To ensure it’s production-ready, I’ve set up a workflow where Serversinc deploys its own updates. This self-deployment loop not only validates the tool’s reliability but also keeps my environments in sync and up-to-date.
Local Environment
On my local machine, I run Serversinc using composer dev
. This command starts up Laravel, queues, and logs everything to the terminal. It also launches a Cloudflare Tunnel, making my local environment accessible to external servers without the need to open up any ports.
To streamline this process, I’ve configured VS Code to automatically run this command using a tasks.json
file. So, whenever I open the project in VS Code, the environment is ready to go immediately.
Staging Server Setup
On the local version, I've provisoned a staging server on Hetzner and deployed the following Docker Images:
- Tugboat: Serversinc's own Docker Agent for a managing container lifecycles on an end server
- Postgres & Redis: For database, caching and queues
- Traefik: A reverse proxy with automatic service discovery for Docker Containers
- Serversinc-staging: A copy of Serversinc to test everything before releasing to Production
The key here is that the Tugboat service on the staging server interacts with my local environment through the Cloudflare Tunnel; sending regular heartbeats and responding to lifecycle requests.
The Staging Server on my Local Environment
Deployment Workflow
When it's time to deploy another update to the staging environment, I run a bash script called build:staging
.
This script does the following:
- Builds the docker image from a Dockerfile
- Pushes the new image to Github Container Registry
- Sends a redeploy request to the Local Environment
On the local environment:
- Serversinc triggers a DeployApplication job
- The job fetches all the info needed such as Environment Variables, Labels, Volumes
- A request is sent to Tugboat to pull the latest image
- Once the image is pulled, Tugboat creates a new Container with the above data
- Deploy is marked as completed in the Local Environment dashboard
Why do it this way?
This self-deployment approach solves a few issues and forces me to constantly use Serversinc as the primary deployment tool. This dogfooding of the platform has been and continues to be the best way to discover bugs and improvements.
Issues this fixes:
- Building the Image locally is faster than using something like Github Actions
- No need to setup GitHub Secrets with variables needed for building
- No need to commit 100 times to test and rerun an Action yaml
Fixing these issues has allowed me to iterate faster than if I was to automate a CI, saving time and in turn making the process a whole lot more enjoyable.
In the past week, I've improved several things due to this approach:
- List, pull and delete Images on a Server
- Stop, Start and Delete Containers on a Server
- Increased request timeouts when pulling Images
- Added support for deploying private Docker Images
That's just a few of the main ones, as well as various bug fixes as I've been going along.
Takeaways & Future Plans
I'm happy with how smooth this process as become, but there's still some areas I could improve on:
- Automating versioning: Right now, I manually tag each build so automating this would save a bit more time and reduce human error (oops!)
- Better observability: I plan to add more detailed logs and metrics for redeploys (mainly deployment logs!) to catch issues during deployment.
Using Serversinc to deploy itself has been a great way to validate the tool and polish it's features. As I originally built tool for myself, it's been a lot of fun to get it to a stage where I can use a tool I've dreamt about building for a while. I'm looking forward to getting this into the hands of other devs ASAP!
Thanks for reading and happy coding! 🧙♂️⛅