-
Notifications
You must be signed in to change notification settings - Fork 783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: adding .sharingio/init #4234
Changes from all commits
783ae28
38f148f
c5e22d1
30008f5
6787347
addec1d
ab6aa97
4f8d232
ff948c7
617e3ff
9462cc0
ffa82d7
ed7237a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/env bash | ||
set -x | ||
kubectl delete -f .sharingio/ingress.yaml | ||
helm delete coder --namespace coder | ||
helm delete postgres --namespace coder | ||
kubectl delete namespace coder | ||
# TODO : populate ii or pair as an admin user without logging in | ||
# TODO : upload / update the kubernetes template |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
annotations: | ||
kubernetes.io/ingress.class: contour-external | ||
name: coder | ||
namespace: coder | ||
spec: | ||
rules: | ||
- host: coder.${SHARINGIO_PAIR_BASE_DNS_NAME} | ||
http: | ||
paths: | ||
- backend: | ||
service: | ||
name: coder | ||
port: | ||
number: 80 | ||
path: / | ||
pathType: ImplementationSpecific | ||
tls: | ||
- hosts: | ||
- coder.${SHARINGIO_PAIR_BASE_DNS_NAME} | ||
secretName: letsencrypt-prod | ||
status: | ||
loadBalancer: {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/env bash | ||
set -x | ||
|
||
# upgrade go to 1.19.1 | ||
go version | grep 1.19.1 || curl -L https://dl.google.com/go/go1.19.1.linux-amd64.tar.gz | sudo tar --directory /usr/local --extract --ungzip | ||
# shfmt needed for make | ||
which shfmt || sudo apt-get install shfmt | ||
# TODO: Make still failing, possible dependencies still missing. | ||
|
||
# install coder binary until we can build from src | ||
which coder || ( | ||
curl -OL https://github.com/coder/coder/releases/download/v0.9.1/coder_0.9.1_linux_amd64.deb | ||
sudo dpkg -i coder_0.9.1_linux_amd64.deb | ||
# Add completion | ||
echo '. <(coder completion bash)' >>~/.bashrc | ||
) | ||
|
||
# Deploying coder (from helm for now) | ||
kubectl create namespace coder | ||
# ensure ingress works / certs secrets get copied | ||
kubectl label ns coder cert-manager-tls=sync | ||
# needs a postgres db | ||
helm repo add bitnami https://charts.bitnami.com/bitnami | ||
helm install postgres bitnami/postgresql \ | ||
--namespace coder \ | ||
--set auth.username=coder \ | ||
--set auth.password=coder \ | ||
--set auth.database=coder \ | ||
--set persistence.size=10Gi | ||
# deploy via helm for now | ||
envsubst <.sharingio/values.template.yaml >.sharingio/values.yaml | ||
helm install coder ./helm/ \ | ||
--namespace coder \ | ||
--values .sharingio/values.yaml | ||
# setup ingress | ||
envsubst <.sharingio/ingress.template.yaml >.sharingio/ingress.yaml | ||
kubectl apply -f .sharingio/ingress.yaml | ||
# Wait for coder to deploy | ||
kubectl rollout status deployment coder -n coder | ||
kubectl wait -n coder --for=condition=ready pod -l app.kubernetes.io/name=coder | ||
|
||
# create the initial user | ||
# populate ii or pair as an admin user without logging in | ||
[email protected] | ||
CODER_PASSWORD=ii | ||
CODER_USERNAME=ii | ||
CODER_URL=https://coder.${SHARINGIO_PAIR_BASE_DNS_NAME} | ||
# export vars to we can emulate a tty with a short expect script | ||
export CODER_EMAIL CODER_PASSWORD CODER_USERNAME | ||
coder login $CODER_URL -u $CODER_USERNAME -p $CODER_PASSWORD -e $CODER_EMAIL | ||
|
||
# TODO : upload / update the kubernetes template | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently unable to push / create or update templates due to 403 error:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The go issues were resolved by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Go 1.19.1 was directly installed over top of Go 1.18.3 and caused this issue. A quick fix was
sharingio/environment was updated to include Go 1.19.1 The line causing the issue was |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
coder: | ||
# You can specify any environment variables you'd like to pass to Coder | ||
# here. Coder consumes environment variables listed in | ||
# `coder server --help`, and these environment variables are also passed | ||
# to the workspace provisioner (so you can consume them in your Terraform | ||
# templates for auth keys etc.). | ||
# | ||
# Please keep in mind that you should not set `CODER_ADDRESS`, | ||
# `CODER_TLS_ENABLE`, `CODER_TLS_CERT_FILE` or `CODER_TLS_KEY_FILE` as | ||
# they are already set by the Helm chart and will cause conflicts. | ||
image: | ||
tag: "v0.9.0" | ||
env: | ||
- name: CODER_ACCESS_URL | ||
value: "https://coder.${SHARINGIO_PAIR_BASE_DNS_NAME}" | ||
- name: CODER_PG_CONNECTION_URL | ||
value: "postgres://coder:[email protected]:5432/coder?sslmode=disable" | ||
# This env variable controls whether or not to auto-import the "kubernetes" | ||
# template on first startup. This will not work unless | ||
# coder.serviceAccount.workspacePerms is true. | ||
- name: CODER_TEMPLATE_AUTOIMPORT | ||
value: "kubernetes" | ||
- name: CODER_VERBOSE | ||
value: "true" | ||
- name: CODER_AUDIT_LOGGING | ||
value: "false" | ||
- name: CODER_TELEMETRY | ||
value: "false" | ||
- name: CODER_TELEMETRY_TRACE | ||
value: "false" | ||
- name: CODER_WILDCARD_ACCESS_URL | ||
value: "*.coder.${SHARINGIO_PAIR_BASE_DNS_NAME}" | ||
tls: | ||
secretName: null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coder login -u $CODER_USERNAME
is required to avoid the tty check.https://github.com/coder/coder/blob/main/cli/login.go#L91-L94