Skip to content

Commit

Permalink
Merge pull request #262 from cloud-barista/release-v0.0.9
Browse files Browse the repository at this point in the history
Merge `release-v0.0.9` branch to `main`
  • Loading branch information
yunkon-kim authored Mar 25, 2022
2 parents 6d5f728 + 62390af commit a67d883
Show file tree
Hide file tree
Showing 38 changed files with 405 additions and 172 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
.idea/
.vscode/

# Temporal directory for container volumes
container-volume/

# Ignore configuration directory
# to avoid leaking sensitive information and frequent update
poc-cb-net/config/**
Expand Down
41 changes: 41 additions & 0 deletions Dockerfile-admin-web
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## This is a Dockerfile for cb-network admin-web

##############################################################
## Stage 1 - Go Build
##############################################################

FROM golang:1.17 AS builder

ENV GO111MODULE=on

COPY . /cb-larva

WORKDIR /cb-larva/poc-cb-net/cmd/admin-web/

# Build the admin-web
# Note - Using cgo write normal Go code that imports a pseudo-package "C". I may not need on cross-compiling.
# Note - You can find possible platforms by 'go tool dist list' for GOOS and GOARCH
# Note - Using the -ldflags parameter can help set variable values at compile time.
# Note - Using the -s and -w linker flags can strip the debugging information.
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-s -w' -o admin-web

#############################################################
## Stage 2 - Application Setup
##############################################################

FROM alpine:latest

WORKDIR /app

RUN mkdir -p config
RUN mkdir -p web

# Copy the execution file
COPY --from=builder /cb-larva/poc-cb-net/cmd/admin-web/admin-web .
# Copy the web files of the admin-web
COPY --from=builder /cb-larva/poc-cb-net/web/ ./web/

# Ports for the cb-network admin-web
EXPOSE 8054

ENTRYPOINT ["./admin-web"]
38 changes: 38 additions & 0 deletions Dockerfile-cladnet-service
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## This is a Dockerfile for cb-network cladnet-service

##############################################################
## Stage 1 - Go Build
##############################################################

FROM golang:1.17 AS builder

ENV GO111MODULE=on

COPY . /cb-larva

WORKDIR /cb-larva/poc-cb-net/cmd/service/

# Build the cladnet-service
# Note - Using cgo write normal Go code that imports a pseudo-package "C". I may not need on cross-compiling.
# Note - You can find possible platforms by 'go tool dist list' for GOOS and GOARCH
# Note - Using the -ldflags parameter can help set variable values at compile time.
# Note - Using the -s and -w linker flags can strip the debugging information.
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-s -w' -o cladnet-service

#############################################################
## Stage 2 - Application Setup
##############################################################

FROM alpine:latest

WORKDIR /app

RUN mkdir -p config

# Copy the execution file
COPY --from=builder /cb-larva/poc-cb-net/cmd/service/cladnet-service .

# Ports for the cb-network cladnet-service
EXPOSE 8053

ENTRYPOINT ["./cladnet-service"]
11 changes: 4 additions & 7 deletions Dockerfile → Dockerfile-controller
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
## Stage 1 - Go Build
##############################################################

FROM golang:1.15.3 AS builder
FROM golang:1.17 AS builder

ENV GO111MODULE=on

COPY . /cb-larva

WORKDIR /cb-larva/poc-cb-net/cmd/controller/
WORKDIR /cb-larva/poc-cb-net/cmd/controller

# Build the controller
# Note - Using cgo write normal Go code that imports a pseudo-package "C". I may not need on cross-compiling.
Expand All @@ -28,14 +28,11 @@ FROM alpine:latest
WORKDIR /app

RUN mkdir -p config
RUN mkdir -p web

# Copy the execution file
COPY --from=builder /cb-larva/poc-cb-net/cmd/controller/controller .
# Copy the web files of AdminWeb
COPY --from=builder /cb-larva/poc-cb-net/web/ ./web/

# A port of Admin Web for the cb-network controller
EXPOSE 9999
# ports for the cb-network controller
# EXPOSE 8051

ENTRYPOINT ["./controller"]
90 changes: 90 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
version: "3.3"
services:
cb-network-etcd:
image: gcr.io/etcd-development/etcd:v3.5.2
container_name: etcd-gcr-v3.5.2
ports:
- "2379:2379"
- "2380:2380"
volumes:
- ./container-volume/etcd/data:/etcd-data
entrypoint:
- /usr/local/bin/etcd
- --name
- s1
- --data-dir
- /etcd-data
- --listen-client-urls
- http://0.0.0.0:2379
- --advertise-client-urls
- http://0.0.0.0:2379
- --listen-peer-urls
- http://0.0.0.0:2380
- --initial-advertise-peer-urls
- http://0.0.0.0:2380
- --initial-cluster
- s1=http://0.0.0.0:2380
- --initial-cluster-token
- tkn
- --initial-cluster-state
- new
- --log-level
- info
- --logger
- zap
- --log-outputs
- stderr
healthcheck:
test: /usr/local/bin/etcd --version
interval: 2s
timeout: 5s
retries: 3

cb-network-controller:
image: cloudbaristaorg/cb-network-controller:latest
build:
context: .
dockerfile: Dockerfile-controller
container_name: cb-network-controller
network_mode: "host"
volumes:
- ./container-volume/cb-network/config:/app/config
depends_on:
cb-network-etcd:
condition: service_healthy

cb-network-cladnet-service:
image: cloudbaristaorg/cb-network-cladnet-service:latest
build:
context: .
dockerfile: Dockerfile-cladnet-service
container_name: cb-network-cladnet-service
ports:
- "8053:8053"
volumes:
- ./container-volume/cb-network/config:/app/config
depends_on:
cb-network-etcd:
condition: service_healthy
healthcheck:
test: nc -vz localhost 8053
interval: 2s
timeout: 5s
retries: 3


cb-network-admin-web:
image: cloudbaristaorg/cb-network-admin-web:latest
build:
context: .
dockerfile: Dockerfile-admin-web
container_name: cb-network-admin-web
ports:
- "8054:8054"
volumes:
- ./container-volume/cb-network/config:/app/config
depends_on:
cb-network-etcd:
condition: service_healthy
cb-network-cladnet-service:
condition: service_healthy
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ require (
github.com/rs/xid v1.3.0
github.com/sirupsen/logrus v1.8.1
github.com/tidwall/gjson v1.11.0
go.etcd.io/etcd v3.3.27+incompatible
go.etcd.io/etcd/api/v3 v3.5.0
go.etcd.io/etcd/client/v3 v3.5.0
golang.org/x/net v0.0.0-20220114011407-0dd24b26b47d
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.etcd.io/etcd v3.3.27+incompatible h1:5hMrpf6REqTHV2LW2OclNpRtxI0k9ZplMemJsMSWju0=
go.etcd.io/etcd v3.3.27+incompatible/go.mod h1:yaeTdrJi5lOmYerz05bd8+V7KubZs8YSFZfzsF9A6aI=
go.etcd.io/etcd/api/v3 v3.5.0 h1:GsV3S+OfZEOCNXdtNkBSR7kgLobAa/SO6tCxRa0GAYw=
go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
go.etcd.io/etcd/client/pkg/v3 v3.5.0 h1:2aQv6F436YnN7I4VbI8PPYrBhu+SmrTaADcf8Mi/6PU=
Expand Down
50 changes: 25 additions & 25 deletions poc-cb-net/README.KR.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ git checkout tags/v3.5.0 -b v3.5.0
etcd_cluster:
endpoints: [ "xxx.xxx.xxx.xxx:xxx", "xxx.xxx.xxx.xxx:xxx", "xxx.xxx.xxx.xxx:xxx" ]
# A config for the cb-network AdminWeb as follows:
# A config for the cb-network admin-web as follows:
admin_web:
host: "xxx.xxx.xxx.xxx" # e.g., "localhost"
port: "9999"
port: "8054"
# A config for the cb-network agent as follows:
cb_network:
Expand All @@ -157,9 +157,9 @@ git checkout tags/v3.5.0 -b v3.5.0
# A config for the grpc as follows:
grpc:
service_endpoint: "xxx.xxx.xxx.xxx:8089" # e.g., "localhost:8089"
server_port: "8089"
gateway_port: "8088"
service_endpoint: "xxx.xxx.xxx.xxx:8053" # e.g., "localhost:8053"
server_port: "8053"
gateway_port: "8052"
```

Expand Down Expand Up @@ -224,10 +224,10 @@ sudo ./controller
etcd_cluster:
endpoints: [ "xxx.xxx.xxx.xxx:xxx", "xxx.xxx.xxx.xxx:xxx", "xxx.xxx.xxx.xxx:xxx" ]
# A config for the cb-network AdminWeb as follows:
# A config for the cb-network admin-web as follows:
admin_web:
host: "xxx.xxx.xxx.xxx" # e.g., "localhost"
port: "9999"
port: "8054"
# A config for the cb-network agent as follows:
cb_network:
Expand All @@ -237,9 +237,9 @@ sudo ./controller
# A config for the grpc as follows:
grpc:
service_endpoint: "xxx.xxx.xxx.xxx:8089" # e.g., "localhost:8089"
server_port: "8089"
gateway_port: "8088"
service_endpoint: "xxx.xxx.xxx.xxx:8053" # e.g., "localhost:8053"
server_port: "8053"
gateway_port: "8052"
```

Expand Down Expand Up @@ -304,10 +304,10 @@ sudo ./cladnet-service
etcd_cluster:
endpoints: [ "xxx.xxx.xxx.xxx:xxx", "xxx.xxx.xxx.xxx:xxx", "xxx.xxx.xxx.xxx:xxx" ]
# A config for the cb-network AdminWeb as follows:
# A config for the cb-network admin-web as follows:
admin_web:
host: "xxx.xxx.xxx.xxx" # e.g., "localhost"
port: "9999"
port: "8054"
# A config for the cb-network agent as follows:
cb_network:
Expand All @@ -317,9 +317,9 @@ sudo ./cladnet-service
# A config for the grpc as follows:
grpc:
service_endpoint: "xxx.xxx.xxx.xxx:8089" # e.g., "localhost:8089"
server_port: "8089"
gateway_port: "8088"
service_endpoint: "xxx.xxx.xxx.xxx:8053" # e.g., "localhost:8053"
server_port: "8053"
gateway_port: "8052"
```

Expand Down Expand Up @@ -385,10 +385,10 @@ sudo ./admin-web
etcd_cluster:
endpoints: [ "xxx.xxx.xxx.xxx:xxx", "xxx.xxx.xxx.xxx:xxx", "xxx.xxx.xxx.xxx:xxx" ]
# A config for the cb-network AdminWeb as follows:
# A config for the cb-network admin-web as follows:
admin_web:
host: "xxx.xxx.xxx.xxx" # e.g., "localhost"
port: "9999"
port: "8054"
# A config for the cb-network agent as follows:
cb_network:
Expand All @@ -398,9 +398,9 @@ sudo ./admin-web
# A config for the grpc as follows:
grpc:
service_endpoint: "xxx.xxx.xxx.xxx:8089" # e.g., "localhost:8089"
server_port: "8089"
gateway_port: "8088"
service_endpoint: "xxx.xxx.xxx.xxx:8053" # e.g., "localhost:8053"
server_port: "8053"
gateway_port: "8052"
```

Expand Down Expand Up @@ -475,10 +475,10 @@ sudo ./agent
etcd_cluster:
endpoints: [ "xxx.xxx.xxx.xxx:xxx", "xxx.xxx.xxx.xxx:xxx", "xxx.xxx.xxx.xxx:xxx" ]
# A config for the cb-network AdminWeb as follows:
# A config for the cb-network admin-web as follows:
admin_web:
host: "xxx.xxx.xxx.xxx" # e.g., "localhost"
port: "9999"
port: "8054"
# A config for the cb-network agent as follows:
cb_network:
Expand All @@ -488,9 +488,9 @@ sudo ./agent
# A config for the grpc as follows:
grpc:
service_endpoint: "xxx.xxx.xxx.xxx:8089" # e.g., "localhost:8089"
server_port: "8089"
gateway_port: "8088"
service_endpoint: "xxx.xxx.xxx.xxx:8053" # e.g., "localhost:8053"
server_port: "8053"
gateway_port: "8052"
```

Expand Down
Loading

0 comments on commit a67d883

Please sign in to comment.