Skip to content

1. Getting Started

Rafał Lorenz edited this page Jun 29, 2019 · 4 revisions
Table of Contents

Prerequisites

In order to run this project you need to have Docker > 1.17.05 for building the production image and Kubernetes cluster > 1.11 for running pods installed.

Installation

git clone [email protected]:vardius/go-api-boilerplate.git

Vendor

Build the module. This will automatically add missing or unconverted dependencies as needed to satisfy imports for this particular build invocation

go build ./...

For more read: https://github.com/golang/go/wiki/Modules

Helm

Helm charts are used to automate the application deployment in a Kubernetes cluster. Once the application is deployed and working, it also explores how to modify the source code for publishing a new application release and how to perform rolling updates in Kubernetes using the Helm CLI.

To deploy application on Kubernetes using Helm you will typically follow these steps:

  1. Add application to cmd directory
  2. Build the Docker image
  3. Publish the Docker image
  4. Create the Helm Chart (extend microservice chart)
  5. Deploy the application in Kubernetes
  6. Update the source code and the Helm chart

Install And Configure Helm And Tiller

Kubernetes

Dashboard

The Dashboard UI is accessible at https://go-api-boilerplate.local/dashboard thanks to kubernetes-dashboard helm chart.

To see available tokens for login run:

kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}')

Install dependencies

make helm-dependencies

Deploy release to cluster

make helm-install

Remove release

make helm-delete

Configuration

Remember to change all imports from github.com/vardius/go-api-boilerplate/* to your-repository/*

Localhost alias

Edit /etc/hosts to add localhost alias

➜  go-api-boilerplate git:(master) cat /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost go-api-boilerplate.local
Clone this wiki locally