This repository has been archived by the owner on Mar 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
408 additions
and
16 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,133 @@ | ||
name: docker | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
branches: | ||
- '*' | ||
pull_request: | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.16 | ||
|
||
- name: Get dependencies | ||
run: go get -v -t -d ./... | ||
|
||
- name: Install GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
install-only: true | ||
|
||
- name: Build | ||
run: make build | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build and push cron | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: build/cron/Dockerfile | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/cron:${{ github.sha }} | ||
|
||
- name: Build and push gateway | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: build/gateway/Dockerfile | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/gateway:${{ github.sha }} | ||
|
||
- name: Build and push message | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: build/message/Dockerfile | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/message:${{ github.sha }} | ||
|
||
- name: Build and push middle | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: build/middle/Dockerfile | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/middle:${{ github.sha }} | ||
|
||
- name: Build and push spider | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: build/spider/Dockerfile | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/spider:${{ github.sha }} | ||
|
||
- name: Build and push storage | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: build/storage/Dockerfile | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/storage:${{ github.sha }} | ||
|
||
- name: Build and push subscribe | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: build/subscribe/Dockerfile | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/subscribe:${{ github.sha }} | ||
|
||
- name: Build and push task | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: build/task/Dockerfile | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/task:${{ github.sha }} | ||
|
||
- name: Build and push web | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: build/web/Dockerfile | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/web:${{ github.sha }} | ||
|
||
- name: Build and push worker | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: build/worker/Dockerfile | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/worker:${{ github.sha }} | ||
|
||
- name: Build and push workflow | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
file: build/workflow/Dockerfile | ||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/workflow:${{ github.sha }} |
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
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,6 @@ | ||
FROM alpine:latest | ||
|
||
RUN apk update && apk add bash | ||
|
||
ADD ./dist/storage-linux-amd64/storage app | ||
CMD ["./app"] |
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,6 @@ | ||
FROM alpine:latest | ||
|
||
RUN apk update && apk add bash | ||
|
||
ADD ./dist/task-linux-amd64/task app | ||
CMD ["./app"] |
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,6 @@ | ||
FROM alpine:latest | ||
|
||
RUN apk update && apk add bash | ||
|
||
ADD ./dist/worker-linux-amd64/worker app | ||
CMD ["./app"] |
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,6 @@ | ||
FROM alpine:latest | ||
|
||
RUN apk update && apk add bash | ||
|
||
ADD ./dist/workflow-linux-amd64/workflow app | ||
CMD ["./app"] |
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,4 @@ | ||
# Docker image version | ||
GITHUB_VERSION= | ||
# config center url | ||
XCONF_URL= |
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,55 @@ | ||
# Kubernetes deployment | ||
|
||
# Install XConf | ||
|
||
## 1. Deployment | ||
|
||
Deploy assistant to your Kubernetes Cluster from zero. | ||
|
||
### Create a namespace | ||
|
||
Create a namespace in the cluster to manage all the resources of Xconf. Edit `namespace.yaml` if you need. | ||
|
||
```kubectl create namespace.yaml``` | ||
|
||
### Edit config files | ||
|
||
- [ALL Files] Replace `$MICRO_REGISTRY_ADDRESS` to your cluser etcd address or your own etcd service address. | ||
- [ALL Files] Check the version of image, change if you want. | ||
- [config-srv.yaml] Replace `$DATABASE_URL` to your own MySQL database url. | ||
- Change other fields if you know what you are doing. | ||
|
||
### Create Kubernets resources | ||
|
||
``` | ||
kubectl create -f micro.yaml | ||
kubectl create -f config-srv.yaml | ||
kubectl create -f agent-api.yaml | ||
kubectl create -f admin-api.yaml | ||
``` | ||
|
||
### Access Admin UI | ||
|
||
By default the micro-api will be exposed by LoadBalancer, check service `micro` under namespace `xconf` for detail. | ||
|
||
`kubectl describe --namespace xconf service micro` | ||
|
||
You will find the Ingress address and the port. | ||
|
||
Use url `http://addr:port/admin/ui/` to access the admin UI. | ||
|
||
## 2. Update | ||
|
||
Update the Kubernets configuration if resources have already existed. | ||
|
||
Modify the config file corresponding to you needs. | ||
|
||
Apply the update: | ||
|
||
```kubectl apply -f FILENAME``` | ||
|
||
## 3. Remove | ||
|
||
You can remove all the deployments by deleting the whole namespace. | ||
|
||
```kubectl delete namespace xconf``` |
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,33 @@ | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: admin-api | ||
namespace: xconf | ||
spec: | ||
replicas: 2 | ||
strategy: | ||
type: RollingUpdate | ||
rollingUpdate: | ||
maxUnavailable: 1 | ||
maxSurge: 1 | ||
selector: | ||
matchLabels: | ||
app: admin-api | ||
template: | ||
metadata: | ||
labels: | ||
app: admin-api | ||
spec: | ||
containers: | ||
- name: admin-api | ||
image: 'xuxu123/admin-api:v0.1.3' | ||
imagePullPolicy: Always | ||
env: | ||
- name: MICRO_SERVER_ADDRESS | ||
value: 0.0.0.0:8080 | ||
- name: MICRO_REGISTRY | ||
value: "etcd" | ||
- name: MICRO_REGISTRY_ADDRESS | ||
value: $MICRO_REGISTRY_ADDRESS | ||
ports: | ||
- containerPort: 8080 |
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,35 @@ | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: agent-api | ||
namespace: xconf | ||
spec: | ||
replicas: 2 | ||
strategy: | ||
type: RollingUpdate | ||
rollingUpdate: | ||
maxUnavailable: 1 | ||
maxSurge: 1 | ||
selector: | ||
matchLabels: | ||
app: agent-api | ||
template: | ||
metadata: | ||
labels: | ||
app: agent-api | ||
spec: | ||
containers: | ||
- name: agent-api | ||
image: 'xuxu123/agent-api:v0.1.3' | ||
imagePullPolicy: Always | ||
env: | ||
- name: MICRO_SERVER_ADDRESS | ||
value: 0.0.0.0:8080 | ||
- name: XCONF_CACHE_SIZE | ||
value: "1048576" | ||
- name: MICRO_REGISTRY | ||
value: "etcd" | ||
- name: MICRO_REGISTRY_ADDRESS | ||
value: $MICRO_REGISTRY_ADDRESS | ||
ports: | ||
- containerPort: 8080 |
Oops, something went wrong.