Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Fix k3d command syntax #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 8 additions & 17 deletions setup-gitlab-gitpod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euo pipefail
print_usage() {
>&2 echo "Usage: $0 <your.domain.com> [<dns server>]"
>&2 echo ""
>&2 echo "your.domain.com Base domain, e.g. dev.example.com gitpod.dev.example.com and gitlab.dev.example.com"
>&2 echo "your.domain.com Base domain, e.g. dev.example.com → gitpod.dev.example.com and gitlab.dev.example.com"
>&2 echo "dns server DNS server that resolves your base domain. Optional, helpful when you DNS servers is not public reachable."
}

Expand Down Expand Up @@ -35,22 +35,19 @@ if [[ -n "$DNSSERVER" ]]; then
echo "Using DNS server: $DNSSERVER"
fi



echo "Removing existing installation if exists ..."

k3d delete cluster gitlab || true
k3d delete cluster gitpod || true
k3d cluster delete gitlab || true
k3d cluster delete gitpod || true
docker stop nginx-proxy || true


# GitLab
echo "Installing GitLab cluster ..."

k3d create cluster \
k3d cluster create \
-p 1443:443@loadbalancer \
--k3s-server-arg --disable=traefik \
--switch \
--switch-context \
gitlab

if [[ -n "$DNSSERVER" ]]; then
Expand All @@ -60,7 +57,6 @@ if [[ -n "$DNSSERVER" ]]; then
kubectl apply -f -
fi


kubectl create secret tls tls-certs \
--cert="$CERTS/fullchain.pem" \
--key="$CERTS/privkey.pem"
Expand All @@ -72,16 +68,15 @@ helm install gitlab gitlab/gitlab \
--set global.ingress.tls.secretName=tls-certs \
--version 4.0.4


# Gitpod
echo "Installing Gitpod cluster ..."

mkdir -p /tmp/workspaces
k3d create cluster \
k3d cluster create \
-p 2443:443@loadbalancer \
-v /tmp/workspaces:/var/gitpod/workspaces:shared \
--k3s-server-arg --disable=traefik \
--switch \
--switch-context \
gitpod

if [[ -n "$DNSSERVER" ]]; then
Expand All @@ -96,7 +91,6 @@ cd "$GPSH_DIR"
helm repo add charts.gitpod.io https://charts.gitpod.io
helm dep update


# Newest helm leads to this error:
# Error: template: gitpod-selfhosted/charts/gitpod/charts/minio/templates/deployment.yaml:192:20: executing "gitpod-selfhosted/charts/gitpod/charts/minio/templates/deployment.yaml" at <(not .Values.gcsgateway.enabled) (not .Values.azuregateway.enabled) (not .Values.s3gateway.enabled) (not .Values.b2gateway.enabled)>: can't give argument to non-function not .Values.gcsgateway.enabled
# this patch helps:
Expand All @@ -111,7 +105,6 @@ tar -czf gitpod-0.4.0.tgz gitpod/
rm -r gitpod
)


helm upgrade --install -f values.yaml gitpod . \
--timeout 60m \
--set gitpod.hostname=gitpod.$DOMAIN \
Expand All @@ -123,10 +116,9 @@ cd -
# We remove all network policies since there are issues for our setting that need to be fixed in the long term.
kubectl delete networkpolicies.networking.k8s.io --all


# Add GitLab OAuth config
echo "Adding GitLab OAuth config ..."
k3d get kubeconfig gitlab --switch
k3d kubeconfig get gitlab --switch-context

# Wait for GitLab DB
echo "Waiting for GitLab DB ..."
Expand All @@ -136,7 +128,6 @@ DBPASSWD=$(kubectl get secret gitlab-postgresql-password -o jsonpath='{.data.pos
SQL=$(sed "s+example.com+$DOMAIN+" "$GITLAB_DIR/insert_oauth_application.sql")
kubectl exec -it gitlab-postgresql-0 -- bash -c "PGPASSWORD=$DBPASSWD psql -U postgres -d gitlabhq_production -c \"$SQL\""


# Start reverse proxy
echo "Starting reverse proxy ..."
sed "s+example.com+$DOMAIN+g" "$ROOT_DIR/proxy/nginx-virtual-servers.conf" > "$ROOT_DIR/proxy/default.conf"
Expand Down