|
1 |
| -# GO Lang in Docker and managed by Kubernetes |
| 1 | +# kubernetes-docker-golang |
2 | 2 |
|
3 |
| -This is a work in progress to get a go lang application containerized in docker and being managed in a kubernete cluster. |
| 3 | +Simple golang web site using mux to run on KUBERNETES or RANCHER and other docker management platforms. |
4 | 4 |
|
5 | 5 | [](https://travis-ci.org/dmportella/kubernetes-docker-golang)
|
6 | 6 |
|
7 |
| -## 0 - Dependencies |
8 |
| -**Note:** *Please note this has been developed and tests using a linux debian OS (mint distro)* |
| 7 | +## DOCKERHUB |
9 | 8 |
|
10 |
| -- Docker: http://www.docker.com/ |
11 |
| -- Go Lang: https://golang.org/ |
12 |
| -- kubernete: http://kubernetes.io/ |
| 9 | +[](https://hub.docker.com/r/dmportella/golangweb/) |
13 | 10 |
|
14 |
| -## 1 - Building the solution |
| 11 | +## GOLANGWEB |
15 | 12 |
|
16 |
| -The solution can be run by calling the *build.sh* file in the root of the repository. |
| 13 | +Simple golang site with route to simulate site failure. |
17 | 14 |
|
18 |
| -> $ *bash build.sh* |
| 15 | +Built for testing *kubernetes* and *rancher* instances. |
19 | 16 |
|
20 |
| -**Note:** *Please note this will run all the commands listed below which will build the app, build the container, run it and clean up by deleting the image locally.* |
| 17 | +### Normal route |
21 | 18 |
|
22 |
| -### 1.1 - GO Lang App |
| 19 | +Web site should be available on port `8080`. |
23 | 20 |
|
24 |
| -Simple hello world app running by defaul on port 8000. |
| 21 | +### Health check |
| 22 | +``` |
| 23 | +GET /__health |
| 24 | +{ |
| 25 | +version: "1.0.0", |
| 26 | +status: "OK" |
| 27 | +} |
| 28 | +``` |
| 29 | +#### routes |
| 30 | +* Health check url.: `/__health/` |
| 31 | +* Set to throw 500: `/__health/throw500` |
| 32 | +* Set to time out: `/__health/timeout` |
| 33 | +* Set kill the process: `/__health/killprocess` |
25 | 34 |
|
26 |
| -**To build run** *this will build a single package called hotel-api* |
27 |
| - |
28 |
| -> $ *go build -o hotel-api .* |
| 35 | +## Building |
29 | 36 |
|
30 |
| -### 1.2 - Build container |
| 37 | +The shell file `build.sh` will run npm install, install and run grunt and it will build and run the docker image. |
31 | 38 |
|
32 |
| -This section has each command used to build and run the go container. |
| 39 | +> $ `./build.sh` |
33 | 40 |
|
34 |
| -**Deletes all images with this name if you already have them** |
| 41 | +Builds docker image and tags it. |
35 | 42 |
|
36 |
| -> $ *docker rmi hotel-api* |
| 43 | +> $ `./build-image.sh` |
37 | 44 |
|
38 |
| -**Build docker Image** |
| 45 | +* Installs godep and other setup things |
39 | 46 |
|
40 |
| -> $ *docker build -t hotel-api:latest .* |
41 |
| -
|
42 |
| -**Run docker instance dev mode** |
43 |
| - |
44 |
| -> $ *docker run -it --rm --name hotel-api --publish 8000:8000 hotel-api* |
45 |
| -
|
46 |
| -## 2 - Kubernetes |
47 |
| - |
48 |
| -This is a work in progress but replication controller, the pod and service files are done. |
49 |
| - |
50 |
| -Not tested it yet as I am still working on my kubernete environment which I am planning to automate the creation of it and put it here. |
51 |
| - |
52 |
| -## License |
53 |
| - |
54 |
| -See license file included in the repository. |
55 |
| - |
56 |
| -...Hmmm Muffins |
| 47 | +> $ `./setup.sh` |
0 commit comments