Skip to main content

Go Basic Webserver

Go Basic Webserver logo
Go Basic Webserverv1.0.0

Go web server using net/http with health endpoint and Docker support

Tools: dev-golang
Install:dev-template golang-basic-webserver
golanggowebserverapirest

Summary

A minimal web server using Gos standard net/http package with a health check endpoint, Docker multi-stage build, Kubernetes deployment manifests, and GitHub Actions CI/CD workflow.


A minimal web server using Go's standard net/http package. Displays "Hello World" with current time and date, and provides health check endpoints.

Quick Start

  1. Update your terminal (tools were installed):

    source ~/.bashrc
  2. Run the app:

    go run app/main.go
  3. Open in browser: http://localhost:3000

Prerequisites

Development tools are installed automatically by the devcontainer. If you need to reinstall, run: dev-setup

Project Structure

After installation, your project contains:

├── app/
│ └── main.go # Web server using net/http
├── manifests/
│ ├── deployment.yaml # K8s Deployment + Service
│ └── kustomization.yaml # ArgoCD configuration
├── .github/
│ └── workflows/
│ └── urbalurba-build-and-push.yaml # CI/CD pipeline
├── Dockerfile # Container build (multi-stage)
├── go.mod # Go module definition
├── TEMPLATE_INFO # Template metadata
└── README-golang-basic-webserver.md # This file

Development

  • Edit app/main.go — the main application file
  • The / endpoint returns "Hello World" with the template name and current time/date
  • Restart the server after changes (go run app/main.go again)

Docker Build

docker build -t golang-basic-webserver .
docker run -p 3000:3000 golang-basic-webserver

Kubernetes Deployment

kubectl apply -k manifests/

The app will be accessible at http://<app-name>.localhost after ArgoCD registration.

CI/CD

The GitHub Actions workflow automatically builds and pushes the Docker image to GitHub Container Registry when changes are pushed to the main branch.