Skip to content
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

feat: Add local development setup #3

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
44 changes: 44 additions & 0 deletions .github/workflows/tilt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "Tilt CI"
on:
pull_request:
branches: [ main ]
jobs:
tilt-ci:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: AbsaOSS/k3d-action@v2
name: "Create Single Cluster"
with:
cluster-name: "k3s-default"
k3d-version: v5.7.4
args: >-
--image rancher/k3s:v1.30.4-k3s1
-v "$(pwd):/charts"
--k3s-arg --disable=traefik@server:0
--k3s-arg --disable=servicelb@server:0
- name: Tilt CI
run: |
pushd dev
for i in {1..5}; do
echo "Tilt CI attempt $i"
nix develop -c tilt ci && exit 0 || sleep 60
done
exit 1
- name: Bitcoin Smoketest
run: |
pushd dev
kubectl -n galoy-dev-smoketest exec smoketest -- bash -c "cd /charts/ci/tasks && \
CHART=bitcoind ./dev-smoketest-settings.sh && \
./bitcoind-smoketest.sh regtest && \
rm -rf smoketest-settings"
- name: Clean Up
if: always()
run: |
rm -rf ci/tasks/smoketest-settings
k3d cluster delete --all
23 changes: 23 additions & 0 deletions charts/galoy-deps/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
18 changes: 18 additions & 0 deletions charts/galoy-deps/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
dependencies:
- name: cert-manager
repository: https://charts.jetstack.io
version: v1.14.3
- name: ingress-nginx
repository: https://kubernetes.github.io/ingress-nginx
version: 4.7.1
- name: strimzi-kafka-operator
repository: https://strimzi.io/charts/
version: 0.39.0
- name: kube-monkey
repository: https://asobti.github.io/kube-monkey/charts/repo
version: 1.5.2
- name: opentelemetry-collector
repository: https://open-telemetry.github.io/opentelemetry-helm-charts
version: 0.108.0
digest: sha256:e2b4306eac185d9ee0827e570187a6b88e07ab4454d75153b84d2298d5379393
generated: "2024-10-04T19:59:12.231527006Z"
43 changes: 43 additions & 0 deletions charts/galoy-deps/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: v2
name: galoy-deps
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.10.20-dev
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.0"
dependencies:
- name: "cert-manager"
repository: "https://charts.jetstack.io"
version: v1.14.3
condition: cert-manager.enabled
- name: "ingress-nginx"
repository: "https://kubernetes.github.io/ingress-nginx"
version: 4.7.1
condition: ingress-nginx.enabled
- name: strimzi-kafka-operator
repository: https://strimzi.io/charts/
version: 0.39.0
condition: strimzi-kafka-operator.enabled
- name: kube-monkey
alias: kubemonkey
repository: https://asobti.github.io/kube-monkey/charts/repo
version: 1.5.2
condition: kubemonkey.enabled
- name: opentelemetry-collector
repository: https://open-telemetry.github.io/opentelemetry-helm-charts
version: 0.108.0
condition: opentelemetry-collector.enabled
Empty file.
62 changes: 62 additions & 0 deletions charts/galoy-deps/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "galoy-deps.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "galoy-deps.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "galoy-deps.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "galoy-deps.labels" -}}
helm.sh/chart: {{ include "galoy-deps.chart" . }}
{{ include "galoy-deps.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "galoy-deps.selectorLabels" -}}
app.kubernetes.io/name: {{ include "galoy-deps.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "galoy-deps.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "galoy-deps.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
39 changes: 39 additions & 0 deletions charts/galoy-deps/templates/kafka-cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{{- if (index .Values "strimzi-kafka-operator").enabled -}}
apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
name: kafka
spec:
kafka:
version: 3.6.0
replicas: 3
listeners:
- name: plain
port: 9092
type: {{ index .Values "strimzi-kafka-operator" "kafka" "listener" "type" }}
tls: false
config:
# https://github.com/strimzi/strimzi-kafka-operator/blob/main/documentation/api/io.strimzi.api.kafka.model.KafkaClusterSpec.adoc
# https://github.com/strimzi/strimzi-kafka-operator/blob/main/documentation/modules/managing/con-broker-config-properties.adoc
auto.create.topics.enable: false
offsets.topic.replication.factor: 3
transaction.state.log.replication.factor: 3
transaction.state.log.min.isr: 1
default.replication.factor: 3
min.insync.replicas: 2
log.retention.hours: 72 # 3 days
log.segment.bytes: 100000000 # 100 MB
log.retention.check.interval.ms: 300000 # 5 minutes
storage:
type: ephemeral
resources:
{{ toYaml (index .Values "strimzi-kafka-operator" "kafka" "resources") | nindent 6 }}
zookeeper:
replicas: 3
storage:
type: ephemeral
resources:
{{ toYaml (index .Values "strimzi-kafka-operator" "zookeeper" "resources") | nindent 6 }}
entityOperator:
userOperator: {}
{{- end -}}
Loading
Loading