Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
cb13342
WIP: begin templates for deployment
Mar 28, 2025
356bce9
complete helm chart templates and values
Mar 29, 2025
0f549c7
add postgres dependency for blossom to use
Mar 29, 2025
b02f449
remove postgres subchart in favor of externalizing dependency
Mar 29, 2025
e2b351c
remove lingering manifest test files
Mar 29, 2025
13e3113
Add a basic readme with some details, to begin with
Mar 29, 2025
c78d515
Merge branch 'main' into configure-kubernetes-deployment
Apr 4, 2025
30e1ff1
WIP: configure gitversion
Apr 4, 2025
9b05595
limit image pushes to merge-to-main only
Apr 4, 2025
375dd75
WIP: test gitversion
Apr 4, 2025
a5d4c34
build but don't push always
Apr 4, 2025
9baeb43
WIP: release on merge
Apr 4, 2025
30d8cb5
WIP: release on merge
Apr 4, 2025
88d425b
WIP: release on merge
Apr 4, 2025
b842df2
WIP: release on merge
Apr 4, 2025
01d7231
WIP: release on merge
Apr 4, 2025
31855e2
WIP: release on merge
Apr 4, 2025
cf27861
WIP: release on merge
Apr 4, 2025
44b5d56
WIP: testing
Apr 5, 2025
ef8890a
WIP: testing
Apr 5, 2025
a302438
WIP: testing
Apr 5, 2025
1e38d73
WIP: testing
Apr 5, 2025
1e614a2
WIP: testing
Apr 5, 2025
efb7f78
WIP: testing
Apr 5, 2025
ffeac4c
update deployment with correct env vars
Apr 5, 2025
7677861
WIP: Still getting details from Daniel about it
Apr 5, 2025
006ec0a
First pass at deployment manifests completed
Apr 6, 2025
701b60a
deploy latest image for now
Apr 7, 2025
1806848
some manifest edits
Apr 7, 2025
ccbbcb1
Use a single replica with ReadWriteOnce for now
Apr 8, 2025
0bf5a4d
Add config
Apr 8, 2025
ba9dc89
fix configmap mount path
Apr 8, 2025
55a31b0
temp entrypoint for container
Apr 9, 2025
6179109
WIP: test image
Apr 9, 2025
87baf55
WIP: test images
Apr 9, 2025
adb7043
Merge branch 'main' into configure-kubernetes-deployment
nbenmoody Apr 9, 2025
1eff130
avoid overwriting /app
Apr 9, 2025
f5fde07
WIP: more testing
Apr 9, 2025
8742f9b
fix CI
Apr 9, 2025
4ae4e98
reconcile with main
Apr 10, 2025
dbba478
add healthcheck updates
Apr 13, 2025
dfe008c
see if the configs are overwriting
Apr 13, 2025
74c294b
attempt to roll back image
Apr 14, 2025
d2c4767
roll image further back
Apr 14, 2025
f429fbe
reconcile with main
Apr 14, 2025
0bd8c20
use latest image again
Apr 14, 2025
241c954
Merge branch 'main' into configure-kubernetes-deployment
Apr 14, 2025
8960ce3
update configs to match new spec
Apr 14, 2025
4353f9c
update workflow back to production values
Apr 14, 2025
d0474d1
fmt
Apr 15, 2025
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
53 changes: 0 additions & 53 deletions .github/workflows/docker-publish.yml

This file was deleted.

131 changes: 131 additions & 0 deletions .github/workflows/publish-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Publish Image and Release Deployment

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:
push:
branches: ['main']
pull_request:
branches: ['main']

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
get_version:
name: Determine Version
runs-on: ubuntu-latest
permissions:
checks: write
contents: write
id-token: write
pull-requests: write
security-events: write
statuses: write
outputs:
SemVer: ${{ steps.get-version.outputs.SemVer }}
steps:

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v3.2.0
with:
versionSpec: "6.2.x"

- name: Determine Version
id: get-version
uses: gittools/actions/gitversion/execute@v3.2.0

- name: Output Version
run: |
echo "# Version:" >> $GITHUB_STEP_SUMMARY
echo ${{ steps.get-version.outputs.SemVer }} >> $GITHUB_STEP_SUMMARY

push_to_registry:
needs: get_version
if: github.ref == 'refs/heads/main'
name: Push Docker image to GHCR
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:

- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to the Github Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ needs.get_version.outputs.SemVer }}
type=raw,value=latest

- name: Build and push Docker image
id: build-and-push-image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Output Image Details
if: steps.build-and-push-image.outcome == 'success'
run: |
echo "# Built and pushed the following images:" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.meta.outputs.tags }}" | tr ',' '\n' >> $GITHUB_STEP_SUMMARY

merge_to_release:
name: Merge to Release
needs: push_to_registry
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
steps:

- name: Check Out the Repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Merge main Branch Locally
shell: bash
run: |
git config --global user.name "$verse-ci"
git config --global user.email "$ci@verse.app"
git checkout release
git merge -Xtheirs --no-commit origin/main

- name: Apply Newest Version
shell: bash
run: |
yq -i '.version = "${{ needs.get_version.outputs.SemVer }}"' ./deployment/route96/Chart.yaml
yq -i '.appVersion = "${{ needs.get_version.outputs.SemVer }}"' ./deployment/route96/Chart.yaml
yq -i '.image.tag = "${{ needs.get_version.outputs.SemVer }}"' ./deployment/route96/values.yaml

- name: Commit and Push to Trigger Release
shell: bash
run: |
git tag ${{ needs.get_version.outputs.SemVer }}
git commit -a -m "Version ${{ needs.get_version.outputs.SemVer }} Release"
git push
git push --tags
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
target/
data/
.idea/
.idea/

local/
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ RUN ./bin/route96 --version

# Entrypoint runs as root initially to fix permissions, then switches to appuser
USER root
ENTRYPOINT ["sh", "-c", "chown -R appuser:appgroup /app/data && exec gosu appuser /app/bin/route96 \"$@\""]
ENTRYPOINT ["sh", "-c", "chown -R appuser:appgroup /app/data && exec gosu appuser /app/bin/route96 \"$@\""]
10 changes: 10 additions & 0 deletions deployment/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Deployment
Verse utilizes a combination of Helm and ArgoCD to deploy this application to its Kubernetes cluster. Configuration for this deployment pattern requires the following:
1. The repository has a helm chart, and all required/desired templates, written and stored in its `/deployment/<chart>` directory.
2. An ArgoCD Application has been created that targets this repository's `/deployment/<chart>` directory.

## To Deploy a change
1. Update the `/deployment/Chart.yaml`'s `AppVersion` file, to contain the tag for the new Docker image.
2. Merge this update to main.
3. In ArgoCD, if auto-sync is not enabled for the Application that was created (the one targeting this repo), execute the sync operation for this Application.
4. You should then see the new version of the application replace the old one, in ArgoCD. This reflects what is happening in the cluster.
23 changes: 23 additions & 0 deletions deployment/route96/.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/
Empty file added deployment/route96/Chart.lock
Empty file.
16 changes: 16 additions & 0 deletions deployment/route96/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v2
name: route96
description: The Helm chart for deploying the Blossom media server from Verse's route96 repository.

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: 1.0.0

# 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: "1.0.0"
17 changes: 17 additions & 0 deletions deployment/route96/templates/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: blossom-config
namespace: blossom
data:
config: |
listen: "REPLACED_BY_ENV"
database: "REPLACED_BY_ENV"
filesystem:
storage_dir: "REPLACED_BY_ENV"
max_upload_bytes: 0
public_url: "REPLACED_BY_ENV"
nip29_relay:
url: "REPLACED_BY_ENV"
private_key: "REPLACED_BY_ENV"
cache_expiration: 0
91 changes: 91 additions & 0 deletions deployment/route96/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: blossom-deployment
namespace: blossom
labels:
app.kubernetes.io/name: blossom
app.kubernetes.io/part-of: blossom
app.kubernetes.io/managed-by: Helm
spec:
replicas: { { .Values.replicaCount } }
selector:
matchLabels:
app.kubernetes.io/name: blossom
template:
metadata:
labels:
app.kubernetes.io/name: blossom
app.kubernetes.io/part-of: blossom
app.kubernetes.io/managed-by: Helm
spec:
containers:
- name: my-container
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: { { .Values.image.pullPolicy | default "Always" } }
env:
- name: APP__LISTEN
value: 0.0.0.0:8000
- name: APP__FILESYSTEM__STORAGE_DIR
value: /app/data
- name: APP__MAX_UPLOAD_BYTES
value: "5000000000"
- name: APP__PUBLIC_URL
value: http://localhost:8000
- name: APP__NIP29_RELAY__URL
value: wss://communities.nos.social
- name: APP__NIP29_RELAY__CACHE_EXPIRATION
value: "300"
- name: APP__NIP29_RELAY__PRIVATE_KEY
valueFrom:
secretKeyRef:
name: "blossom-secret"
key: app_nip29_relay_private_key
- name: APP__DATABASE
valueFrom:
secretKeyRef:
name: "blossom-secret"
key: database_connection_string
resources:
requests:
memory: "512Mi"
cpu: "1"
limits:
memory: "1028Mi"
cpu: "2"
livenessProbe:
httpGet:
path: /health
port: 8000
initialDelaySeconds: 30
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /health
port: 8000
initialDelaySeconds: 5
timeoutSeconds: 3
ports:
- containerPort: 8000
protocol: TCP
volumeMounts:
- name: blossom-config
mountPath: /app/config.yaml
subPath: config
- name: blossom-storage
mountPath: /app/data
- name: database-cacert
mountPath: /app/ca.pem
volumes:
- name: blossom-config
configMap:
name: blossom-config
- name: blossom-storage
persistentVolumeClaim:
claimName: blossom-pvc
- name: database-cacert
secret:
secretName: blossom-secret
items:
- key: database_cacert
path: ca.pem
27 changes: 27 additions & 0 deletions deployment/route96/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: blossom-hpa
namespace: blossom
labels:
app.kubernetes.io/part-of: blossom
app.kubernetes.io/managed-by: Helm
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: blossom-deployment
minReplicas: { { .Values.autoscaling.minReplicas | default 1 } }
maxReplicas: { { .Values.autoscaling.maxReplicas | default 10 } }
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization:
{
{
.Values.autoscaling.targetCPUUtilizationPercentage | default 80,
},
}
Loading