Keep Gitea Windows Service running 24/7 with Service Protector

How to Keep your Gitea Windows Service Running 24/7 with Service Protector

Automatically restart Gitea if stops for any reason. Ensure that your DevOps platform is always available.

Gitea is a self-hosted, all-in-one software development package that uses Git.

You can install Gitea as a Windows Service, to start it automatically whenever your computer boots:

To monitor & safeguard Gitea with Service Protector:

  1. Download and install Service Protector, if necessary.

  2. Start Service Protector.

  3. Select Protector > Add to open the Add Protector window:

    Add Protector

  4. On the General tab, in the Service to protect drop-down, select your Gitea service. It's named gitea on our Windows Server 2022 machine:

    Gitea Windows Service: General Tab

  5. If Gitea ever hangs and stops responding to web requests, we'd like Service Protector to restart the service. Let's set up a "sanity check" to do just that.

    1. Switch to the Monitor tab. Check the Whenever it fails a periodic sanity check box and click the Set button:

      Gitea Windows Service: Monitor Tab

    2. In the Add Sanity Check window, select the Check that a web server is responding properly option and click Next to proceed:

      Add a web sanity check

    3. Enter the URL you use to access your Gitea server. That's probably http://localhost:3000, like it was on our machine.

      Enter the URL for Gitea server

      Click Next to continue.

    4. Specify how often Service Protector should verify the URL. The default of every 5 minutes should be fine but you can check more often if you like.

      After you're done, click Next to move on.

      Gitea Sanity Check settings

    5. And finally, confirm your settings:

      Confirm your sanity check settings

      If everything looks good, click Add to record your new sanity check and return to the Monitor tab.

  6. We're done configuring Gitea so click the Save button. In a few seconds, a new entry named "gitea" will appear in the Service Protector window.

    The green shield indicates that Service Protector is already actively monitoring the Gitea Windows Service — to quickly detect and respond to failures:

    Gitea Windows Service: Protected

    You can click the green "Running" circle to see how the Gitea service/executable is doing:

    Gitea Windows Service: Running status

  7. That's it! Next time your computer boots, Gitea will start automatically and Service Protector will babysit the service to promptly restart it if it stops for any reason.

    We encourage you to edit your Gitea entry in Service Protector and check out the many other settings that may be appropriate for your environment. For example, send an email if the service fails, restart Gitea once a week to keep it "fresh", and much more.

Trouble protecting the Gitea Windows Service?