Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This now uses kind to create a real dev setup with a NATS cluster and a 3-node Liftbridge cluster. You'll need to download kind and skaffold to make this work. Then do: 1. `make kind-up` to bring up the kind cluster 2. `make kind-apply` and then let it finish It'll also expose both the Liftbridge nodes as well as the NATS board on local ports so you can run the examples against that cluster.
- Loading branch information
1 parent
397fc19
commit 26e58ce
Showing
20 changed files
with
520 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dev/data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: v1 | ||
data: | ||
liftbridge.conf: | | ||
listen: 0.0.0.0:9292 | ||
# data.dir: /tmp/liftbridge/server-2 | ||
# log.level: debug | ||
clustering { | ||
min.insync.replicas: 1 | ||
} | ||
kind: ConfigMap | ||
metadata: | ||
labels: | ||
app: liftbridge | ||
component: config | ||
environment: dev | ||
k8s-app: liftbridge | ||
name: config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
namespace: default | ||
|
||
resources: | ||
- svc.yaml | ||
- statefulset.yaml | ||
- config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: liftbridge | ||
spec: | ||
serviceName: "liftbridge-headless" | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
app: liftbridge | ||
template: | ||
metadata: | ||
labels: | ||
app: liftbridge | ||
spec: | ||
containers: | ||
- name: liftbridge | ||
image: liftbridge | ||
ports: | ||
- name: grpc | ||
containerPort: 9292 | ||
volumeMounts: | ||
- name: liftbridge-data | ||
mountPath: /data | ||
- mountPath: /etc/liftbridge.conf | ||
name: config | ||
subPath: liftbridge.conf | ||
volumes: | ||
- configMap: | ||
name: config | ||
name: config | ||
volumeClaimTemplates: | ||
- metadata: | ||
name: liftbridge-data | ||
spec: | ||
accessModes: ["ReadWriteOnce"] | ||
resources: | ||
requests: | ||
storage: 5Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: liftbridge-headless | ||
spec: | ||
selector: | ||
app: liftbridge | ||
clusterIP: "None" | ||
ports: | ||
- name: grpc | ||
protocol: TCP | ||
port: 9292 | ||
targetPort: grpc | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: liftbridge | ||
spec: | ||
selector: | ||
app: liftbridge | ||
ports: | ||
- name: grpc | ||
protocol: TCP | ||
port: 9292 | ||
targetPort: grpc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM golang:1.13-alpine as build-base | ||
RUN apk update && apk upgrade && \ | ||
apk add --no-cache bash git openssh make bzr | ||
WORKDIR /workspace | ||
ENV GO111MODULE on | ||
|
||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
# cache deps before building and copying source so that we don't need to re-download as much | ||
# and so that source changes don't invalidate our downloaded layer | ||
RUN go mod download | ||
|
||
# Copy the go source | ||
COPY main.go main.go | ||
COPY server/ server/ | ||
|
||
# Build | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -mod=readonly -o liftbridge | ||
|
||
FROM alpine:latest | ||
RUN apk update && apk add --no-cache bash | ||
COPY --from=build-base /workspace/liftbridge /usr/local/bin/liftbridge | ||
COPY k8s/dev/entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
if [ "$HOSTNAME" = "liftbridge-0" ] | ||
then | ||
echo "Running in liftbridge-0 as a bootstrap seed...\n" | ||
liftbridge --data-dir=/data --config /etc/liftbridge.conf --level=debug --nats-servers=nats://nats.liftbridge.svc:4222 --raft-bootstrap-seed --id="$HOSTNAME" | ||
else | ||
echo "Running in $HOSTNAME...\n" | ||
liftbridge --data-dir=/data --config /etc/liftbridge.conf --level=debug --nats-servers=nats://nats.liftbridge.svc:4222 --raft-bootstrap-peers=liftbridge-0 --id="$HOSTNAME" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
kind: Cluster | ||
apiVersion: kind.sigs.k8s.io/v1alpha3 | ||
nodes: | ||
- role: control-plane | ||
extraPortMappings: | ||
- containerPort: 32767 | ||
hostPort: 9292 | ||
listenAddress: "0.0.0.0" | ||
- containerPort: 32767 | ||
hostPort: 9293 | ||
listenAddress: "0.0.0.0" | ||
- containerPort: 32767 | ||
hostPort: 9294 | ||
listenAddress: "0.0.0.0" | ||
- containerPort: 32766 | ||
hostPort: 3000 | ||
listenAddress: "0.0.0.0" | ||
- containerPort: 32765 | ||
hostPort: 4222 | ||
listenAddress: "0.0.0.0" | ||
- role: worker | ||
- role: worker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
namespace: liftbridge | ||
|
||
bases: | ||
- ../base | ||
|
||
resources: | ||
- namespace.yaml | ||
- nats.yaml | ||
- natsboard.yaml | ||
- svc.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: liftbridge | ||
labels: | ||
name: liftbridge | ||
environment: dev |
Oops, something went wrong.