Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devopscorner/golang-deployment
Kubernetes Deployment for Simple Golang API (Bookstore) --- Mirror Repository from GitHub, GitLab, BitBucket, Azure DevOps to AWS CodeCommit --- GO Repository Pattern
https://github.com/devopscorner/golang-deployment
azure-devops bitbucket cicd codebuild codepipeline container devopscorner docker github gitlab go golang helm helm-values jenkins jenkins-pipeline kubernetes
Last synced: 1 day ago
JSON representation
Kubernetes Deployment for Simple Golang API (Bookstore) --- Mirror Repository from GitHub, GitLab, BitBucket, Azure DevOps to AWS CodeCommit --- GO Repository Pattern
- Host: GitHub
- URL: https://github.com/devopscorner/golang-deployment
- Owner: devopscorner
- License: apache-2.0
- Created: 2022-04-17T10:21:10.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2025-01-01T01:37:54.000Z (21 days ago)
- Last Synced: 2025-01-01T09:03:28.312Z (21 days ago)
- Topics: azure-devops, bitbucket, cicd, codebuild, codepipeline, container, devopscorner, docker, github, gitlab, go, golang, helm, helm-values, jenkins, jenkins-pipeline, kubernetes
- Language: Go
- Homepage: https://devopscorner.id
- Size: 1.44 MB
- Stars: 34
- Watchers: 4
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Golang Deployment
Kubernetes Deployment for Simple Golang API
![goreport](https://goreportcard.com/badge/github.com/devopscorner/golang-deployment/src)
![all contributors](https://img.shields.io/github/contributors/devopscorner/golang-deployment)
![tags](https://img.shields.io/github/v/tag/devopscorner/golang-deployment?sort=semver)
[![docker pulls](https://img.shields.io/docker/pulls/devopscorner/bookstore.svg)](https://hub.docker.com/r/devopscorner/bookstore/)
![download all](https://img.shields.io/github/downloads/devopscorner/golang-deployment/total.svg)
![download latest](https://img.shields.io/github/downloads/devopscorner/golang-deployment/4.1/total)
![view](https://views.whatilearened.today/views/github/devopscorner/golang-deployment.svg)
![clone](https://img.shields.io/badge/dynamic/json?color=success&label=clone&query=count&url=https://github.com/devopscorner/golang-deployment/blob/master/clone.json?raw=True&logo=github)
![issues](https://img.shields.io/github/issues/devopscorner/golang-deployment)
![pull requests](https://img.shields.io/github/issues-pr/devopscorner/golang-deployment)
![forks](https://img.shields.io/github/forks/devopscorner/golang-deployment)
![stars](https://img.shields.io/github/stars/devopscorner/golang-deployment)
[![license](https://img.shields.io/github/license/devopscorner/golang-deployment)](https://img.shields.io/github/license/devopscorner/golang-deployment)---
## Available Tags
### Alpine
| Image name | Size |
|------------|------|
| `devopscorner/bookstore:latest` | [![docker image size](https://img.shields.io/docker/image-size/devopscorner/bookstore/latest.svg?label=Image%20size&logo=docker)](https://hub.docker.com/repository/docker/devopscorner/bookstore/tags?page=1&ordering=last_updated&name=latest) ![default-latest](https://img.shields.io/static/v1?label=latest&message=default&color=brightgreen) ![latest](https://img.shields.io/static/v1?label=latest&message=alpine&color=orange) |
| `devopscorner/bookstore:alpine` | [![docker image size](https://img.shields.io/docker/image-size/devopscorner/bookstore/alpine.svg?label=Image%20size&logo=docker)](https://hub.docker.com/repository/docker/devopscorner/bookstore/tags?page=1&ordering=last_updated&name=alpine) ![latest](https://img.shields.io/static/v1?label=latest&message=alpine&color=orange) |
| `devopscorner/bookstore:alpine-latest` | [![docker image size](https://img.shields.io/docker/image-size/devopscorner/bookstore/alpine-latest.svg?label=Image%20size&logo=docker)](https://hub.docker.com/repository/docker/devopscorner/bookstore/tags?page=1&ordering=last_updated&name=alpine-latest) |
| `devopscorner/bookstore:alpine-3.16` | [![docker image size](https://img.shields.io/docker/image-size/devopscorner/bookstore/alpine-3.16.svg?label=Image%20size&logo=docker)](https://hub.docker.com/repository/docker/devopscorner/bookstore/tags?page=1&ordering=last_updated&name=alpine-3.16) |
| `devopscorner/bookstore:go1.19-alpine3.16` | [![docker image size](https://img.shields.io/docker/image-size/devopscorner/bookstore/go1.19-alpine3.16.svg?label=Image%20size&logo=docker)](https://hub.docker.com/repository/docker/devopscorner/bookstore/tags?page=1&ordering=last_updated&name=go1.19-alpine3.16) |
| `devopscorner/bookstore:go1.19.5-alpine3.16` | [![docker image size](https://img.shields.io/docker/image-size/devopscorner/bookstore/go1.19.5-alpine3.16.svg?label=Image%20size&logo=docker)](https://hub.docker.com/repository/docker/devopscorner/bookstore/tags?page=1&ordering=last_updated&name=go1.19.5-alpine3.16) |
| `devopscorner/bookstore:alpine-3.17` | [![docker image size](https://img.shields.io/docker/image-size/devopscorner/bookstore/alpine-3.17.svg?label=Image%20size&logo=docker)](https://hub.docker.com/repository/docker/devopscorner/bookstore/tags?page=1&ordering=last_updated&name=alpine-3.17) |
| `devopscorner/bookstore:go1.19-alpine3.17` | [![docker image size](https://img.shields.io/docker/image-size/devopscorner/bookstore/go1.19-alpine3.17.svg?label=Image%20size&logo=docker)](https://hub.docker.com/repository/docker/devopscorner/bookstore/tags?page=1&ordering=last_updated&name=go1.19-alpine3.17) |
| `devopscorner/bookstore:go1.19.5-alpine3.17` | [![docker image size](https://img.shields.io/docker/image-size/devopscorner/bookstore/go1.19.5-alpine3.17.svg?label=Image%20size&logo=docker)](https://hub.docker.com/repository/docker/devopscorner/bookstore/tags?page=1&ordering=last_updated&name=go1.19.5-alpine3.17) |### Previous Version - Alpine (Depreciated)
| Image name | Size |
|------------|------|
| `devopscorner/bookstore:alpine-3.15` | [![docker image size](https://img.shields.io/docker/image-size/devopscorner/bookstore/alpine-3.15.svg?label=Image%20size&logo=docker)](https://hub.docker.com/repository/docker/devopscorner/bookstore/tags?page=1&ordering=last_updated&name=alpine-3.15) |
| `devopscorner/bookstore:go1.19-alpine3.15` | [![docker image size](https://img.shields.io/docker/image-size/devopscorner/bookstore/go1.19-alpine3.15.svg?label=Image%20size&logo=docker)](https://hub.docker.com/repository/docker/devopscorner/bookstore/tags?page=1&ordering=last_updated&name=go1.19-alpine3.15) |
| `devopscorner/bookstore:go1.19.3-alpine3.15` | [![docker image size](https://img.shields.io/docker/image-size/devopscorner/bookstore/go1.19.3-alpine3.15.svg?label=Image%20size&logo=docker)](https://hub.docker.com/repository/docker/devopscorner/bookstore/tags?page=1&ordering=last_updated&name=go1.19.3-alpine3.15) |
| `devopscorner/bookstore:go1.18-alpine3.15` | [![docker image size](https://img.shields.io/docker/image-size/devopscorner/bookstore/go1.18-alpine3.15.svg?label=Image%20size&logo=docker)](https://hub.docker.com/repository/docker/devopscorner/bookstore/tags?page=1&ordering=last_updated&name=go1.18-alpine3.15) |
| `devopscorner/bookstore:go1.18-alpine3.16` | [![docker image size](https://img.shields.io/docker/image-size/devopscorner/bookstore/go1.18-alpine3.16.svg?label=Image%20size&logo=docker)](https://hub.docker.com/repository/docker/devopscorner/bookstore/tags?page=1&ordering=last_updated&name=go1.18-alpine3.16) |---
## Documentation
- Index Documentation, go to [this](docs/README.md) link
- Build, Tag & Push container image to **DockerHub**, go to [this](docs/container-bookstore-dockerhub.md) link
- Build, Tag & Push container image to **Amazon ECR (Elastic Container Registry)**, go to [this](docs/container-bookstore-ecr.md) link
- Workflow CI/CD Pipeline, go to [this](docs/workflow-cicd-bookstore-pipeline.md) link
- GitOps & GitOps DevSecOps Flow (Azure DevOps Pipeline), go to [this](docs/gitops-devsecops-flow-azure.md) link
- Deployments:
- **ArgoCD**, detail [here](docs/deployment-argocd.md) link
- **AWS CloudFormation**, detail [here](docs/deployment-aws-cloudformation.md) link
- **AWS Developer Tools** (AWS CodeCommit, AWS CodeBuild & AWS CodePipeline), detail [here](docs/deployment-aws-developer-tools.md) link
- **Amazon CodeCatalyst Pipeline**, detail [here](docs/deployment-amazon-codecatalyst.md) link
- **Azure DevOps Pipeline**, detail [here](docs/deployment-azure-devops.md) link
- **Bitbucket Pipeline**, detail [here](docs/deployment-bitbucket.md) link
- **CircleCI Pipeline**, detail [here](docs/deployment-circleci.md) link
- **DroneCI Pipeline**, detail [here](docs/deployment-droneci.md) link
- **GitHub Action**, detail [here](docs/deployment-github.md) link
- **GitLab CI/CD**, detail [here](docs/deployment-gitlab.md) link
- **Jenkins CI & Spinnaker CD**, detail [here](docs/deployment-jenkins-spinnaker.md) link
- **Jenkins CI/CD**, detail [here](docs/deployment-jenkins.md) link
- **OpenShift CI/CD**, detail [here](docs/deployment-openshift.md) link
- **SemaphoreCI**, detail [here](docs/deployment-semaphoreci.md) link
- **Spinnaker CD**, detail [here](docs/deployment-spinnaker.md) link
- **Terraform AWS CodeBuild, AWS CodePipeline & Amazon SNS**, detail [here](docs/deployment-terraform.md) link
- **TravisCI**, detail [here](docs/deployment-travisci.md) link## GO Repository Pattern
- Folder Structure
```
.
├── .env
├── .env.example
├── config
│ ├── config.go
│ ├── config_test.go
│ └── const.go
├── controller
│ ├── book_controller.go
│ ├── book_controller_test.go
│ ├── login_controller.go
│ └── login_controller_test.go
├── driver
│ ├── db.go
│ ├── dynamo.go
│ ├── mysql.go
│ ├── psql.go
│ └── sqlite.go
├── go-bookstore.db
├── go.mod
├── go.sum
├── main.go
├── main_test.go
├── middleware
│ ├── auth_middleware.go
│ └── auth_middleware_test.go
├── migrate_book.go.example
├── migrate_book_dynamo.go.example
├── model
│ └── book.go
├── repository
│ └── book_repository.go
├── routes
│ └── book_routes.go
└── view
├── book_view.go
├── error_view.go
└── login_view.go9 directories, 29 files
```- Environment Variables (Default)
```
GIN_MODE=release
APP_URL=http://localhost
APP_PORT=8080
DB_CONNECTION=sqlite
DB_REGION=ap-southeast-1
DB_HOST=localhost
DB_PORT=
DB_DATABASE=go-bookstore.db
DB_USERNAME=root
DB_PASSWORD=
JWT_AUTH_USERNAME=devopscorner
JWT_AUTH_PASSWORD=DevOpsCorner@2023
JWT_SECRET=s3cr3t
```- Multi Driver Connection
```
DB_CONNECTION=sqlite
---
Available for:
- sqlite
- mysql
- postgres
- dynamo
```- DynamoDB Connection
```
DB_CONNECTION=dynamo
---
DB_DATABASE --> Dynamo Table
DB_REGION --> Dynamo Region
```## Reproduce Testing
- RESTful API Testing, go to [this](docs/test-restful-api.md) link
## Tested Environment
### Versioning
- Docker version
```
docker versionClient:
Cloud integration: v1.0.22
Version: 20.10.17-rd
API version: 1.41
Go version: go1.17.11
Git commit: c2e4e01
Built: Fri Jul 22 18:31:17 2022
OS/Arch: darwin/amd64
Context: default
Experimental: true
```- Docker-Compose version
```
docker-compose -v
---
Docker Compose version v2.11.1
```- AWS Cli
```
aws --version
---
aws-cli/2.8.7 Python/3.9.11 Darwin/21.6.0 exe/x86_64 prompt/off
```- Terraform Cli
```
terraform version
---
Terraform v1.3.5
on darwin_amd64
- provider registry.terraform.io/hashicorp/aws v3.74.3
- provider registry.terraform.io/hashicorp/local v2.1.0
- provider registry.terraform.io/hashicorp/null v3.1.0
- provider registry.terraform.io/hashicorp/random v3.1.0
- provider registry.terraform.io/hashicorp/time v0.7.2
```- Terraform Environment Cli
```
tfenv -v
---
tfenv 2.2.2
```- Golang Version Manager (GVM)
```
gvm version
---
Go Version Manager v1.0.22 installed at /Users/devopscorner/.gvm
```- Golang Version
```
go version
---
go version go1.19.6 darwin/arm64
```## Security Check
Make sure that you didn't push sensitive information in this repository
- [ ] AWS Credentials (AWS_ACCESS_KEY, AWS_SECRET_KEY)
- [ ] AWS Account ID
- [ ] AWS Resources ARN
- [ ] Username & Password
- [ ] Private (id_rsa) & Public Key (id_rsa.pub)
- [ ] DNS Zone ID
- [ ] APP & API Key## Copyright
- Author: **Dwi Fahni Denni (@zeroc0d3)**
- Vendor: **DevOps Corner Indonesia (devopscorner.id)**
- License: **Apache v2**