This project started to master deployment of Go application to Kubernetes. The code reflects a commitment to emulating production-grade architecture and navigating implementation challenges. With sincere hope, this repository evolves into a useful template. While this page focuses on practical how-tos, the ⚓wiki is about whys
Regardless of how one configures their local development environment, running the project may require:
Swagger is configured with 🔗swaggo/swag. Docker files are set up to automatically update Swagger docs during the build process. The very same command can be used manually:
swag init -g api/main.go -o ./api/docs
🔗The officail guide does not cover a lot. If you require configured credentials or guidance on configuring them yourself, please feel free to contact me via any of my profile links
One is always welcome to open an issue or create a discussion!
Execute the command within the project directory
docker-compose up -d
The local developer environment for this project was constructed using:
🔗KinD
🔗MongoDB Community Kubernetes Operator
Execute the command within the project directory
kind create cluster --config=kind-config.yaml
-
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.7.0/aio/deploy/recommended.yaml
-
kubectl apply -f ./deployment/dashboard.yaml
-
kubectl proxy
-
kubectl -n kubernetes-dashboard create token admin-user --duration=24h
Next, deploy Kafka and MongoDB. When you're ready to deploy gokube services, use the following command
kubectl apply -f ./deployment
The easiest approach would be to follow 🔗Deploy Strimzi using installation files guide. To deploy a cluster use
kubectl apply -f ./deployment/strimzi-kafka.yaml
An alternative, albeit more intricate, method, allowing manual configuration, is well described 🔗here. However it's regrettable that Windows environments is not yet covered
- Follow 🔗the official guilde diligently
- Ensure that the MongoDB user being used within gokube has the
readWriteAnyDatabase
role. Consider configuring it as follows:
apiVersion: mongodbcommunity.mongodb.com/v1
kind: MongoDBCommunity
metadata:
name: example-mongodb
spec:
members: 3
type: ReplicaSet
...
users:
- name: my-user
db: admin
...
roles:
- name: clusterAdmin
db: admin
- name: userAdminAnyDatabase
db: admin
- name: readWriteAnyDatabase # keep and eye here
db: admin