https://github.com/ddlees/microservices
Microservices Example w/ Bazel and Skaffold
https://github.com/ddlees/microservices
Last synced: 5 months ago
JSON representation
Microservices Example w/ Bazel and Skaffold
- Host: GitHub
- URL: https://github.com/ddlees/microservices
- Owner: ddlees
- License: mit
- Created: 2021-11-02T15:01:08.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-19T15:53:14.000Z (over 4 years ago)
- Last Synced: 2025-03-29T10:35:05.559Z (about 1 year ago)
- Language: Starlark
- Size: 154 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Microservices Example w/ [Bazel] and [Skaffold]
### Prerequisites
- Bazel
- Skaffold
- Docker
- Kubectl
- Go (optional)
- NodeJS (optional)
- Yarn (optional)
-
A Kubernetes Cluster
#### Choose a Development Cluster
- [Docker Desktop](https://www.docker.com/products/docker-desktop) _(Mac OS and Windows)_
- Download and install Docker Desktop for your platform
- Go to `Preferences > Kubernetes` and select `Enable Kubernetes`
- [kind](https://kind.sigs.k8s.io/)
- [microk8s](https://microk8s.io/)
- [minikube](https://minikube.sigs.k8s.io/docs/)
- [k3s](https://k3s.io/)
- [k3d](https://k3d.io/)
- [kubeadm](https://kubernetes.io/docs/reference/setup-tools/kubeadm/) _(the hard way)_---
**Note:** All of these options have guides to setup a local cluster; however Skaffold does not prevent you
from connecting to a remote Kubernetes cluster if you wish to do so.
## Local Development
#### Building w/ Bazel
This command will build everything in the project including all the container images and binaries capable of running on
the host system.
``` bash
bazel build //...
```
### Building w/ Skaffold
This command will build and tag only the container images declared in [skaffold.yaml](./skaffold.yaml).
``` bash
skaffold build
```
## Run the API w/ Bazel (no containers)
``` bash
bazel run api
```
The API serves a single endpoint: http://localhost:8080/api/v1/greeting
## Run the UI w/ Bazel (no containers)
``` bash
bazel run ui
```
The UI is served at http://localhost:3000
> Note: The UI has a dependency on the API and will surface a network error
## Run the API and UI on Kubernetes w/ Skaffold
``` bash
skaffold dev
```
The UI is served at http://localhost:3000 and will connect to the API using [Kubernetes Service Discovery](https://github.com/kubernetes/dns/blob/master/docs/specification.md).