Skip to content

smira/giantswarm-firstapp-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting started with Go, Docker, Redis on Giant Swarm

This is a simple example to write Golang applications and deploy them on Giant Swarm. It pings an external API and caches the data in an Redis cache.

Check out the full tutorial:

http://docs.giantswarm.io/guides/your-first-application/golang/

Prerequisites

Edit source

The application logic is implemented in main.go. It starts a webserver and on root request pings the openweather API caches the result in Redis and extracts and returns the current weather for Cologne.

Run in locally

To run it locally you just have to do a `make fig-up. This:

  • builds the Go project into a linux binary
  • creates a custom Docker image with the linux binary
  • starts both the custom Docker container and a Redis container.

To test it on a Mac run something like: curl $(boot2docker ip):8080

Run in on Giant Swarm

To deploy it on Giant Swarm you just have to do a 'make swarm-up'. This:

  • builds appropriate Docker images
  • uploads them to the Giant Swarm registry
  • uploads the swarm.json and starts the application.

To test it run something like: curl currentweather-YOURUSERNAME.gigantic.io and replace YOURUSERNAME with your Giant Swarm username.

For all build and deploy details see the Makefile.

For further documentation and guides see the docs.

In other languages

About

A simple example with Go, Redis and Docker demonstrating Giant Swarm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published