Skip to main content

Running your first service

Overview

In this guide, we'll walk you through the process of deploying a simple Go application to your remote server.

Prerequisites

  • A remote server running Catch
  • A local machine with git and go installed

Creating your application

Our example application is a simple web server that listens on port 8080 and responds with "Hello, World!".

package main

import "net/http"

func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello, World!"))
})
http.ListenAndServe("127.0.0.1:8080", nil)
}

Building your application

To build your application, run the following command.

go build -o mybinary

Running your service

To run your service, run the following command.

yeet run myapp mybinary

This will transfer your binary to your remote server and automatically configure it to run as a service.

Check the status of your service

To check the status of your service, run the following command.

yeet status myapp

Accessing your service

There are multiple ways to access your service. In our example application, we're listening on port 8080 on all interfaces. This means you can access your service by navigating to http://<remote-host>:8080 in your web browser.

Alternatively, you can use Catch's built-in TCP proxy to access your service. Simply visit http://catch.<your-tailnet>.ts.net:8080 in your web browser.

tip

If you want your service to be only accessible only over your tailnet, configure it to listen on localhost or 127.0.0.1. In the example above, change the listening address to http.ListenAndServe("127.0.0.1:8080", nil).

Next steps

That's it! You've successfully deployed and run a service on your remote server.

To learn more about what you can do with Catch, check out our guide on running services.