Deploying Go MPA to VPS

Deploying

Deploying a Go executeable to a VPS using Webmin as admin interface, makes the deployment simpler. But still there are a lot of moving parts that needs to be prepared and managed. Hence a separate site for this.

1. Prepare the VPS

This guide assumes you already have a VPS (Virtual Private Server) ready for deployment. If you don't have one yet, or if you need help configuring it, the full VPS setup—including Cloudflare, Nginx, Systemd, and security basics—is described here:

Hosting Go executables

2. Compile your Go MPA

Before deploying your Go MPA site, you need to compile it into a binary executable. Open your terminal and navigate to the root directory of your Go MPA project. Run the following command to build your application:

MacOS > Debian: GOOS=linux GOARCH=amd64 go build
Windows > Debian: set GOOS=linux && set GOARCH=amd64 && go build

These commands sets the target operating system and architecture for the build process, ensuring compatibility with your VPS environment. After running the command, you should see a new executable file in your project directory like main (without suffix). This binary contains your entire MPA, including all embedded assets.

3. Upload to VPS and start

Once your binary is compiled, upload it to your VPS. You can use any method you prefer — Webmin, SFTP, SCP, or rsync. Starting the application and configuring Systemd is covered in detail in the hosting guide:

Hosting Go executables