Go Basic Webserver
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
-
Update your terminal (tools were installed):
source ~/.bashrc -
Run the app:
go run app/main.go -
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.goagain)
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.