Course Overview
Locked video preview

Paid video

Please purchase the course to watch.

Deploying a binary

Deploying part two

Here is a summary of the video transcript:

  • Using systemd for Application Management
    The application is managed using systemd to ensure a robust and maintainable runtime environment. Systemd acts as the init system on modern Linux distributions, handling service lifecycle operations such as start, stop, restart, and logging.

  • Advantages of systemd
    Systemd provides declarative configuration, automatic restarts, dependency management, logging, and resource control. It requires no external dependencies and is available by default on major Linux distributions like Ubuntu, Debian, and Fedora.

  • Creating a systemd Service
    A service file is created under /etc/systemd/system/ defining unit metadata, service behavior, environment variables, execution path, restart policy, and boot target. The service is configured to start after networking and to restart automatically with a delay to prevent crash loops.

  • Enabling and Starting the Service
    After making the binary executable, systemd is reloaded and the service is started using systemctl. The service is enabled to start automatically on system reboot and verified through status checks.

  • Configuring Reverse Proxy with Caddy
    The domain is configured in Caddy to reverse proxy traffic to localhost:8080. After restarting Caddy, the application becomes accessible via the public domain.

  • Database Migration and Debugging
    Initial login issues reveal that database migrations were not applied. Restarting the service triggers the migrations, creating the required tables and enabling proper authentication.

  • Verifying Application Functionality
    The application is tested by logging in and creating content, confirming that authentication, validation, and publishing features work correctly in production.

  • Deploying Updates Safely
    A new binary is built locally, transferred to the server via SCP, replaced, made executable, and the service is restarted. The application continues running without data loss or duplication, demonstrating a safe deployment workflow.

  • Final Deployment State
    The application is successfully deployed on a VPS with its own database, accessible via a domain, and fully manageable through systemd.