Skip to content

Commit 9e72e7e

Browse files
committed
chore(workflow): optimize installation steps
1 parent 3b624cd commit 9e72e7e

5 files changed

Lines changed: 160 additions & 111 deletions

File tree

_scripts/install-cli.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -eo pipefail
33
shopt -s expand_aliases
44

5-
checkPlatformArch() {
5+
check_platform_arch() {
66
local supported="darwin-amd64 darwin-arm64 linux-amd64 linux-386 linux-arm linux-arm64 windows-386 windows-amd64"
77

88
if ! echo "${supported}" | tr ' ' '\n' | grep -q "${PLATFORM}-${ARCH}"; then
@@ -24,7 +24,7 @@ else
2424
fi
2525

2626
# initArch discovers the architecture for this system.
27-
initArch() {
27+
init_arch() {
2828
ARCH=$(uname -m)
2929
case $ARCH in
3030
armv5*) ARCH="armv5";;
@@ -38,13 +38,13 @@ initArch() {
3838
esac
3939
}
4040

41-
initLatestVersion() {
41+
init_latest_version() {
4242
VERSION=$(curl -Ls $DRYCC_BIN_URL_BASE|grep /drycc/workflow-cli/releases/tag/ | grep -v no-underline | head -n 1 | cut -d '"' -f 2| awk '{n=split($NF,a,"/");print a[n]}' | awk 'a !~ $0{print}; {a=$0}')
4343
}
4444

45-
initArch
46-
initLatestVersion
47-
checkPlatformArch
45+
init_arch
46+
init_latest_version
47+
check_platform_arch
4848

4949
DRYCC_CLI="drycc-${VERSION}-${PLATFORM}-${ARCH}"
5050
DRYCC_CLI_PATH="${DRYCC_CLI}"

_scripts/install.sh

Lines changed: 123 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if [[ -z "${DRYCC_ADMIN_USERNAME}" || -z "${DRYCC_ADMIN_PASSWORD}" ]] ; then
2323
fi
2424

2525
# initArch discovers the architecture for this system.
26-
initArch() {
26+
init_arch() {
2727
ARCH=$(uname -m)
2828
case $ARCH in
2929
armv5*) ARCH="armv5";;
@@ -42,9 +42,9 @@ function clean_before_exit {
4242
sleep 3
4343
}
4444
trap clean_before_exit EXIT
45-
initArch
45+
init_arch
4646

47-
function get_helm {
47+
function install_helm {
4848
tar_name="helm-canary-linux-${ARCH}.tar.gz"
4949
curl -fsSL -o "${tar_name}" "https://get.helm.sh/${tar_name}"
5050
tar -zxvf "${tar_name}"
@@ -89,84 +89,97 @@ else
8989
INSTALL_K3S_EXEC="agent --flannel-backend=none"
9090
fi
9191

92-
alias install-k3s="curl -sfL "${k3s_install_url}" |sh - $@"
93-
export INSTALL_K3S_EXEC
94-
install-k3s
95-
mount bpffs -t bpf /sys/fs/bpf
96-
97-
get_helm
92+
function install_k3s {
93+
export INSTALL_K3S_EXEC
94+
curl -sfL "${k3s_install_url}" |sh -
95+
}
9896

99-
helm repo add drycc https://charts.drycc.cc/${CHANNEL:-stable}
100-
helm repo update
97+
function install_components {
98+
mount bpffs -t bpf /sys/fs/bpf
99+
install_helm
100+
helm repo add drycc https://charts.drycc.cc/${CHANNEL:-stable}
101+
helm repo update
101102

102-
echo -e "\\033[32m---> Waiting for helm to install components...\\033[0m"
103+
echo -e "\\033[32m---> Waiting for helm to install components...\\033[0m"
103104

104-
helm install cilium drycc/cilium --set operator.replicas=1 --namespace kube-system --wait
105-
helm install metallb drycc/metallb --namespace kube-system --wait -f - <<EOF
105+
helm install cilium drycc/cilium --set operator.replicas=1 --namespace kube-system --wait
106+
helm install metallb drycc/metallb --namespace kube-system --wait -f - <<EOF
106107
configInline:
107108
address-pools:
108109
- name: default
109110
protocol: layer2
110111
addresses:
111112
- ${METALLB_ADDRESS_POOLS:-172.16.0.0/12}
112113
EOF
113-
helm install ingress-nginx drycc/ingress-nginx --namespace kube-system --wait
114-
helm install longhorn drycc/longhorn --create-namespace --set persistence.defaultClass=false --set persistence.defaultClassReplicaCount=1 --namespace longhorn-system --wait
115-
helm install cert-manager drycc/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true --wait
116-
helm install catalog drycc/catalog --set asyncBindingOperationsEnabled=true --namespace catalog --create-namespace --wait
117-
118-
echo -e "\\033[32m---> Start installing workflow...\\033[0m"
119-
120-
RABBITMQ_USERNAME=$(cat /proc/sys/kernel/random/uuid)
121-
RABBITMQ_PASSWORD=$(cat /proc/sys/kernel/random/uuid)
122-
123-
helm install drycc drycc/workflow \
124-
--set builder.service.type=LoadBalancer \
125-
--set global.cluster_domain="cluster.local" \
126-
--set global.platform_domain="${PLATFORM_DOMAIN}" \
127-
--set global.ingress_class=nginx \
128-
--set fluentd.daemon_environment.CONTAINER_TAIL_PARSER_TYPE="/^(?<time>.+) (?<stream>stdout|stderr)( (?<tags>.))? (?<log>.*)$/" \
129-
--set controller.app_storage_class=longhorn \
130-
--set minio.persistence.enabled=true \
131-
--set minio.persistence.size=${MINIO_PERSISTENCE_SIZE:-5Gi} \
132-
--set minio.persistence.storageClass="longhorn" \
133-
--set rabbitmq.username="${RABBITMQ_USERNAME}" \
134-
--set rabbitmq.password="${RABBITMQ_PASSWORD}" \
135-
--set rabbitmq.persistence.enabled=true \
136-
--set rabbitmq.persistence.size=${RABBITMQ_PERSISTENCE_SIZE:-5Gi} \
137-
--set rabbitmq.persistence.storageClass="longhorn" \
138-
--set influxdb.persistence.enabled=true \
139-
--set influxdb.persistence.size=${INFLUXDB_PERSISTENCE_SIZE:-5Gi} \
140-
--set influxdb.persistence.storageClass="longhorn" \
141-
--set monitor.grafana.persistence.enabled=true \
142-
--set monitor.grafana.persistence.size=${MONITOR_PERSISTENCE_SIZE:-5Gi} \
143-
--set monitor.grafana.persistence.storageClass="longhorn" \
144-
--set passport.admin_username=${DRYCC_ADMIN_USERNAME} \
145-
--set passport.admin_password=${DRYCC_ADMIN_PASSWORD} \
146-
--namespace drycc \
147-
--create-namespace --wait --timeout 30m0s
148-
149-
HELMBROKER_USERNAME=$(cat /proc/sys/kernel/random/uuid)
150-
HELMBROKER_PASSWORD=$(cat /proc/sys/kernel/random/uuid)
151-
152-
echo -e "\\033[32m---> Start installing helmbroker...\\033[0m"
153-
154-
helm install helmbroker drycc/helmbroker \
155-
--set ingress_class="nginx" \
156-
--set platform_domain="cluster.local" \
157-
--set persistence.storageClass="longhorn" \
158-
--set persistence.size=${HELMBROKER_PERSISTENCE_SIZE:-5Gi} \
159-
--set platform_domain=${PLATFORM_DOMAIN} \
160-
--set username=${HELMBROKER_USERNAME} \
161-
--set password=${HELMBROKER_PASSWORD} \
162-
--set environment.HELMBROKER_CELERY_BROKER="amqp://${RABBITMQ_USERNAME}:${RABBITMQ_PASSWORD}@drycc-rabbitmq-0.drycc-rabbitmq.drycc.svc.cluster.local:5672/drycc" \
163-
--namespace drycc --create-namespace --wait -f - <<EOF
114+
helm install ingress-nginx drycc/ingress-nginx --namespace kube-system --wait
115+
helm install cert-manager drycc/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true --wait
116+
helm install catalog drycc/catalog --set asyncBindingOperationsEnabled=true --namespace catalog --create-namespace --wait
117+
}
118+
119+
function install_longhorn {
120+
helm install longhorn drycc/longhorn --create-namespace \
121+
--set persistence.defaultClass=false \
122+
--set persistence.defaultClassReplicaCount=1 \
123+
--namespace longhorn-system --wait
124+
}
125+
126+
function install_drycc {
127+
echo -e "\\033[32m---> Start installing workflow...\\033[0m"
128+
129+
RABBITMQ_USERNAME=$(cat /proc/sys/kernel/random/uuid)
130+
RABBITMQ_PASSWORD=$(cat /proc/sys/kernel/random/uuid)
131+
132+
helm install drycc drycc/workflow \
133+
--set builder.service.type=LoadBalancer \
134+
--set global.cluster_domain="cluster.local" \
135+
--set global.platform_domain="${PLATFORM_DOMAIN}" \
136+
--set global.ingress_class=nginx \
137+
--set fluentd.daemon_environment.CONTAINER_TAIL_PARSER_TYPE="/^(?<time>.+) (?<stream>stdout|stderr)( (?<tags>.))? (?<log>.*)$/" \
138+
--set controller.app_storage_class=longhorn \
139+
--set minio.persistence.enabled=true \
140+
--set minio.persistence.size=${MINIO_PERSISTENCE_SIZE:-5Gi} \
141+
--set minio.persistence.storageClass="longhorn" \
142+
--set rabbitmq.username="${RABBITMQ_USERNAME}" \
143+
--set rabbitmq.password="${RABBITMQ_PASSWORD}" \
144+
--set rabbitmq.persistence.enabled=true \
145+
--set rabbitmq.persistence.size=${RABBITMQ_PERSISTENCE_SIZE:-5Gi} \
146+
--set rabbitmq.persistence.storageClass="longhorn" \
147+
--set influxdb.persistence.enabled=true \
148+
--set influxdb.persistence.size=${INFLUXDB_PERSISTENCE_SIZE:-5Gi} \
149+
--set influxdb.persistence.storageClass="longhorn" \
150+
--set monitor.grafana.persistence.enabled=true \
151+
--set monitor.grafana.persistence.size=${MONITOR_PERSISTENCE_SIZE:-5Gi} \
152+
--set monitor.grafana.persistence.storageClass="longhorn" \
153+
--set passport.admin_username=${DRYCC_ADMIN_USERNAME} \
154+
--set passport.admin_password=${DRYCC_ADMIN_PASSWORD} \
155+
--namespace drycc \
156+
--create-namespace --wait --timeout 30m0s
157+
echo -e "\\033[32m---> Rabbitmq username: $RABBITMQ_USERNAME\\033[0m"
158+
echo -e "\\033[32m---> Rabbitmq password: $RABBITMQ_PASSWORD\\033[0m"
159+
}
160+
161+
function install_helmbroker {
162+
HELMBROKER_USERNAME=$(cat /proc/sys/kernel/random/uuid)
163+
HELMBROKER_PASSWORD=$(cat /proc/sys/kernel/random/uuid)
164+
165+
echo -e "\\033[32m---> Start installing helmbroker...\\033[0m"
166+
167+
helm install helmbroker drycc/helmbroker \
168+
--set ingress_class="nginx" \
169+
--set platform_domain="cluster.local" \
170+
--set persistence.storageClass="longhorn" \
171+
--set persistence.size=${HELMBROKER_PERSISTENCE_SIZE:-5Gi} \
172+
--set platform_domain=${PLATFORM_DOMAIN} \
173+
--set username=${HELMBROKER_USERNAME} \
174+
--set password=${HELMBROKER_PASSWORD} \
175+
--set environment.HELMBROKER_CELERY_BROKER="amqp://${RABBITMQ_USERNAME}:${RABBITMQ_PASSWORD}@drycc-rabbitmq-0.drycc-rabbitmq.drycc.svc.cluster.local:5672/drycc" \
176+
--namespace drycc --create-namespace --wait -f - <<EOF
164177
repositories:
165178
- name: drycc-helm-broker
166179
url: ${addons_url}
167180
EOF
168181

169-
kubectl apply -f - <<EOF
182+
kubectl apply -f - <<EOF
170183
apiVersion: servicecatalog.k8s.io/v1beta1
171184
kind: ClusterServiceBroker
172185
metadata:
@@ -183,11 +196,16 @@ spec:
183196
url: https://${HELMBROKER_USERNAME}:${HELMBROKER_PASSWORD}@drycc-helmbroker.${PLATFORM_DOMAIN}
184197
EOF
185198

186-
BUILDER_IP=$(kubectl get svc drycc-builder -n drycc -o="jsonpath={.status.loadBalancer.ingress[0].ip}")
187-
INGRESS_IP=$(kubectl get svc ingress-nginx-controller -n kube-system -o="jsonpath={.status.loadBalancer.ingress[0].ip}")
199+
echo -e "\\033[32m---> Helmbroker username: $HELMBROKER_USERNAME\\033[0m"
200+
echo -e "\\033[32m---> Helmbroker password: $HELMBROKER_PASSWORD\\033[0m"
201+
}
202+
203+
function config_haproxy {
204+
BUILDER_IP=$(kubectl get svc drycc-builder -n drycc -o="jsonpath={.status.loadBalancer.ingress[0].ip}")
205+
INGRESS_IP=$(kubectl get svc ingress-nginx-controller -n kube-system -o="jsonpath={.status.loadBalancer.ingress[0].ip}")
188206

189-
if [[ "${USE_HAPROXY:-true}" == "true" ]] ; then
190-
cat << EOF > "/etc/haproxy/haproxy.cfg"
207+
if [[ "${USE_HAPROXY:-true}" == "true" ]] ; then
208+
cat << EOF > "/etc/haproxy/haproxy.cfg"
191209
global
192210
log /dev/log local0
193211
log /dev/log local1 notice
@@ -222,15 +240,40 @@ listen builder
222240
timeout server 30000
223241
server builder ${BUILDER_IP}:2222 check
224242
EOF
225-
fi
243+
fi
226244

227-
mkdir -p /run/haproxy
228-
systemctl enable haproxy
229-
systemctl restart haproxy
245+
mkdir -p /run/haproxy
246+
systemctl enable haproxy
247+
systemctl restart haproxy
248+
}
230249

231-
echo -e "\\033[32m---> Please save the following information for future use.\\033[0m"
232-
echo -e "\\033[32m---> Rabbitmq username: $RABBITMQ_USERNAME\\033[0m"
233-
echo -e "\\033[32m---> Rabbitmq password: $RABBITMQ_PASSWORD\\033[0m"
234-
echo -e "\\033[32m---> Helmbroker username: $HELMBROKER_USERNAME\\033[0m"
235-
echo -e "\\033[32m---> Helmbroker password: $HELMBROKER_PASSWORD\\033[0m"
236-
echo -e "\\033[32m---> Installation complete, enjoy life...\\033[0m"
250+
# --- add quotes to command arguments ---
251+
quote() {
252+
for arg in "$@"; do
253+
printf '%s\n' "$arg" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/'/"
254+
done
255+
}
256+
257+
# --- escape most punctuation characters, except quotes, forward slash, and space ---
258+
escape() {
259+
printf '%s' "$@" | sed -e 's/\([][!#$%&()*;<=>?\_`{|}]\)/\\\1/g;'
260+
}
261+
262+
# --- re-evaluate args to include env command ---
263+
eval set -- $(escape "${INSTALL_DRYCC_EXEC}") $(quote "$@")
264+
265+
if [[ -z "$@" ]] ; then
266+
install_k3s
267+
install_components
268+
install_longhorn
269+
install_drycc
270+
install_helmbroker
271+
config_haproxy
272+
echo -e "\\033[32m---> Installation complete, enjoy life...\\033[0m"
273+
else
274+
for command in "$@"
275+
do
276+
$command
277+
echo -e "\\033[32m---> Installation $command complete, enjoy life...\\033[0m"
278+
done
279+
fi

src/installing-workflow/index.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,29 @@ For more installation parameters, please check the [values.yaml](https://github.
139139
After installing Workflow, [register a user and deploy an application](../quickstart/deploy-an-app.md).
140140

141141
[Kubernetes v1.16.15+]: system-requirements.md#kubernetes-versions
142-
[helm]: https://github.com/kubernetes/helm/blob/master/docs/install.md
142+
143+
## Configure DNS
144+
145+
User must to set up a hostname, and assumes the `drycc.$host` convention.
146+
147+
We need to point the `drycc.$host` record to the public IP address of your builder. You can get the public IP using the following command. A wildcard entry is necessary here as apps will use the same rule after they are deployed.
148+
149+
```
150+
$ kubectl get svc drycc-builder --namespace drycc
151+
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
152+
drycc-builder 10.0.25.3 138.91.243.152 2222:31625/TCP 33m
153+
```
154+
155+
156+
If we were using `drycc.cc` as a hostname, we would need to create the following A DNS records.
157+
158+
| Name | Type | Value |
159+
| ---------------------------- |:-------------:| --------------:|
160+
| drycc-builder.drycc.cc | A | 138.91.243.152 |
161+
162+
Once all of the pods are in the `READY` state, and `drycc.$host` resolves to the external IP found above, Workflow is up and running!
163+
164+
After installing Workflow, [register a user and deploy an application](../quickstart/deploy-an-app.md).
165+
166+
If your k8s does not provide public network loadblance, you need to install TCP proxy services such as haproxy on machines that can
167+
access both internal and external networks, and then expose `80` and `443`.

src/installing-workflow/ingress.md

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ $ helm install stable/traefik --name ingress --namespace kube-system --set ssl.e
7070

7171
## Configure DNS
7272

73-
User must to set up a hostname, and assumes the `drycc.$host` convention.
73+
User must to set up a hostname, and assumes the `*.$host` convention.
7474

7575
We need to point the `*.$host` record to the public IP address of your ingress controller. You can get the public IP using the following command. A wildcard entry is necessary here as apps will use the same rule after they are deployed.
7676

@@ -80,35 +80,16 @@ NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
8080
ingress-traefik 10.0.25.3 138.91.243.152 80:31625/TCP,443:30871/TCP 33m
8181
```
8282

83-
Additionally, we need to point the `drycc-builder.$host` record to the public IP address of the [Builder][].
84-
85-
```
86-
$ kubectl get svc drycc-builder --namespace drycc
87-
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
88-
drycc-builder 10.0.165.140 40.86.182.187 2222:32488/TCP 33m
89-
```
90-
91-
If ingress-nginx is used, ports can be exposed in the following ways.
92-
93-
```
94-
kind: ConfigMap
95-
apiVersion: v1
96-
metadata:
97-
name: tcp-services
98-
namespace: ingress-nginx
99-
data:
100-
2222: "drycc/drycc-builder:2222"
101-
```
10283

10384
If we were using `drycc.cc` as a hostname, we would need to create the following A DNS records.
10485

10586
| Name | Type | Value |
10687
| ---------------------------- |:-------------:| --------------:|
10788
| *.drycc.cc | A | 138.91.243.152 |
108-
| drycc-builder.drycc.cc | A | 40.86.182.187 |
10989

110-
Once all of the pods are in the `READY` state, and `drycc.$host` resolves to the external IP found above, Workflow is up and running!
90+
Once all of the pods are in the `READY` state, and `*.$host` resolves to the external IP found above, the preparation of ingress has been completed!
11191

11292
After installing Workflow, [register a user and deploy an application](../quickstart/deploy-an-app.md).
11393

114-
[builder]: ../understanding-workflow/components.md#builder
94+
If your k8s does not provide public network loadblance, you need to install TCP proxy services such as haproxy on machines that can
95+
access both internal and external networks, and then expose `80` and `443`.

src/installing-workflow/system-requirements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Workflow supports Amazon Simple Storage Service (S3), Google Cloud Storage (GCS)
2929
Storage. See [configuring object storage](configuring-object-storage) for setup instructions.
3030

3131
In addition, workflow needs to use RWX block storage services, such as cloud native [longhorn](https://longhorn.io/),
32-
[openebs](https://openebs.io/), or external (glusterfs)[https://www.gluster.org/] or [ceph](https://ceph.io/).
32+
[openebs](https://openebs.io/), or external [glusterfs](https://www.gluster.org/) or [ceph](https://ceph.io/).
3333

3434
## Resource Requirements
3535

0 commit comments

Comments
 (0)