Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pablosilvab/demo-golang-docker
Basic API write in Go.
https://github.com/pablosilvab/demo-golang-docker
cicd docker gitlab-ci go golang helm kubernetes
Last synced: about 1 month ago
JSON representation
Basic API write in Go.
- Host: GitHub
- URL: https://github.com/pablosilvab/demo-golang-docker
- Owner: pablosilvab
- License: mit
- Created: 2019-11-13T12:34:06.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-08-17T20:09:33.000Z (over 2 years ago)
- Last Synced: 2024-06-21T09:51:05.698Z (6 months ago)
- Topics: cicd, docker, gitlab-ci, go, golang, helm, kubernetes
- Language: Go
- Homepage:
- Size: 3.85 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Demo Docker & Golang
[![Go Report Card](https://goreportcard.com/badge/github.com/pablosilvab/demo-golang-docker)](https://goreportcard.com/report/github.com/pablosilvab/demo-golang-docker) [![Build Actions Status](https://github.com/pablosilvab/demo-golang-docker/workflows/build/badge.svg)](https://github.com/pablosilvab/demo-golang-docker/actions)
This is a simple API for testing different tools.
![golang]
![docker]
![kubernetes]
![elastic]### Run project locally
1. Clone project
```
go get github.com/pablosilvab/golang-docker
```2. Go to folder
```
cd ~/go/src/github.com/pablosilvab/golang-docker
```3. Download dependencies
```
go mod download
```4. Run project locally
```
make go-run
```5. Compile the code and generate an executable
```
make go-build
```6. Run the executable
```
make go-shell
```### Run with Docker
* Build new image
```
make docker-build
```* Generate tag
```
make docker-tag
```* Run container
```
make docker-run
```## Helm
### Requirements
* Helm
* TillerInstall package in Kubernetes:
```
make helm-install
```Remove release in Kubernetes:
```
make helm-uninstall
```List all releases:
```
helm ls --all
```## Issues
### Deploy
* Cannot connect to the Docker daemon at tcp://localhost:2375. Is the docker daemon running?
Review ```.gitlab-ci.yml``` file.
### Helm install
* User "system:serviceaccount:default:default" cannot get at the cluster
Grant permissions with ```ClusterRoleBinding```.
### How create charts?
```
helm create charts
```## Notes
### Run elasticsearch in K8s.
To run elasticsearch in K8s for this exercise I use helm
1. Add repository elastic
```
helm repo add bitnami https://charts.bitnami.com/bitnami
```* Install helm chart
```
helm install elastic bitnami/elasticsearch
```* Uninstall chart
```
helm delete --purge elastic
```* Expose the service
```
kubectl port-forward --namespace default svc/elastic-elasticsearch 9200:9200
```[golang]: https://img.shields.io/badge/Go-00ADD8?style=for-the-badge&logo=go&logoColor=white
[docker]: https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white
[kubernetes]: https://img.shields.io/badge/kubernetes-%23326ce5.svg?style=for-the-badge&logo=kubernetes&logoColor=white
[elastic]:https://img.shields.io/badge/-ElasticSearch-005571?style=for-the-badge&logo=elasticsearch