Skip to content
Merged
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
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
**/charts/*.tgz
**/.specstory/


# Ignore Helm dependency directories
**/charts/*.lock

# General files to ignore
*.log
*.gz
Expand Down Expand Up @@ -53,8 +49,6 @@ applications/mlflow/tests/.venv/
# wg-easy specific
*.kubeconfig
applications/wg-easy/release/
applications/wg-easy/*/charts/
applications/wg-easy/*/Chart.lock
.aider*
# SpecStory explanation file
.specstory/.what-is-this.md
13 changes: 7 additions & 6 deletions applications/wg-easy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ Use tools to automate repetitive tasks, reducing human error and increasing deve

```
applications/wg-easy/
├── charts/templates/ # Common templates shared across charts
├── cert-manager/ # Wrapped cert-manager chart
├── cert-manager-issuers/ # Chart for cert-manager issuers
├── charts
│   ├── cert-manager # Wrapped cert-manager chart
│   ├── cert-manager-issuers # Chart for cert-manager issuers
│   ├── replicated-sdk # Replicated SDK chart
│   ├── templates # Common templates shared across charts
│   ├── traefik # Wrapped Traefik chart
│   └── wg-easy # Main application chart
├── replicated/ # Root Replicated configuration
├── replicated-sdk/ # Replicated SDK chart
├── taskfiles/ # Task utility functions
├── traefik/ # Wrapped Traefik chart
├── wg-easy/ # Main application chart
├── helmfile.yaml # Defines chart installation order
└── Taskfile.yaml # Main task definitions
```
Expand Down
146 changes: 133 additions & 13 deletions applications/wg-easy/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ includes:

vars:
# Application configuration
APP_SLUG: '{{.REPLICATED_APP | default "wg-easy"}}'
APP_NAME: '{{.REPLICATED_APP | default "wg-easy"}}'
APP_SLUG: '{{.REPLICATED_APP_SLUG | default "wg-easy-cre"}}'

# Release configuration
RELEASE_CHANNELd: '{{.RELEASE_CHANNEL | default "Unstable"}}'
RELEASE_VERSION: '{{.RELEASE_VERSION | default "0.0.1"}}'
RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}'

# Cluster configuration
CLUSTER_NAME: '{{.CLUSTER_NAME | default "test-cluster"}}'
Expand Down Expand Up @@ -131,14 +137,14 @@ tasks:
- echo "Updating Helm dependencies for all charts..."
- |
# Find all charts and update their dependencies
for chart_dir in $(find . -maxdepth 2 -name "Chart.yaml" | xargs dirname); do
for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | xargs dirname); do
echo "Updating dependency $chart_dir"
helm dependency update "$chart_dir"
helm dependency update --skip-refresh "$chart_dir"
done
- echo "All dependencies updated!"

ports-expose:
desc: Expose configured ports and capture exposed URLs
cluster-ports-expose:
desc: Expose configured ports for a cluster and capture exposed URLs
silent: false
run: once
status:
Expand Down Expand Up @@ -166,8 +172,8 @@ tasks:
deps:
- cluster-create

helm-deploy:
desc: Deploy all charts using helmfile
helm-install:
desc: Install all charts using helmfile
silent: false
cmds:
- echo "Installing all charts via helmfile"
Expand All @@ -185,10 +191,10 @@ tasks:
# Deploy with helmfile
echo "Using $ENV_VARS"
eval "KUBECONFIG={{.KUBECONFIG_FILE}} $ENV_VARS helmfile sync --wait"
- echo "All charts deployed!"
- echo "All charts installed!"
deps:
- setup-kubeconfig
- ports-expose
- cluster-ports-expose

cluster-delete:
desc: Delete all test clusters with matching name and clean up kubeconfig
Expand Down Expand Up @@ -270,10 +276,10 @@ tasks:
- echo "Packaging Helm charts..."
- |
# Find top-level directories containing Chart.yaml files
for chart_dir in $(find . -maxdepth 2 -name "Chart.yaml" | xargs dirname); do
for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | xargs dirname); do
echo "Packaging chart: $chart_dir"
# Navigate to chart directory, package it, and move the resulting .tgz to release folder
(cd "$chart_dir" && helm package . && mv *.tgz ../release/)
(cd "$chart_dir" && helm package . && mv *.tgz ../../release/)
done

- echo "Release files prepared in ./release/ directory"
Expand All @@ -283,8 +289,10 @@ tasks:
release-create:
desc: Create and promote a release using the Replicated CLI
silent: false
run: once
vars:
CHANNEL: '{{.CHANNEL | default "Unstable"}}'
VERSION: '{{.VERSION | default "0.0.1"}}'
RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}'
requires:
vars: [APP_SLUG, VERSION]
Expand All @@ -298,6 +306,53 @@ tasks:
deps:
- release-prepare

customer-create:
desc: Create a new customer or get existing customer with matching name and return their ID
silent: false
run: once
vars:
CUSTOMER_NAME: '{{.CUSTOMER_NAME | default "test-customer"}}'
CUSTOMER_EMAIL: '{{.CUSTOMER_EMAIL | default "test@example.com"}}'
CHANNEL: '{{.CHANNEL | default "Unstable"}}'
LICENSE_TYPE: '{{.LICENSE_TYPE | default "dev"}}'
EXPIRES_IN: '{{.EXPIRES_IN | default ""}}'
requires:
vars: [APP_SLUG]
cmds:
- |
# First check if customer already exists
echo "Looking for existing customer {{.CUSTOMER_NAME}} for app {{.APP_SLUG}}..."
EXISTING_CUSTOMER=$(replicated customer ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.name=="{{.CUSTOMER_NAME}}") | .id' | head -1)

if [ -n "$EXISTING_CUSTOMER" ]; then
echo "Found existing customer {{.CUSTOMER_NAME}} with ID: $EXISTING_CUSTOMER"
echo "$EXISTING_CUSTOMER"
exit 0
fi

# No existing customer found, create a new one
echo "Creating new customer {{.CUSTOMER_NAME}} for app {{.APP_SLUG}}..."

# Build the command with optional expiration
CMD="replicated customer create \
--app {{.APP_SLUG}} \
--name {{.CUSTOMER_NAME}} \
--email {{.CUSTOMER_EMAIL}} \
--channel {{.CHANNEL}} \
--type {{.LICENSE_TYPE}} \
--output json"

# Add expiration if specified
if [ -n "{{.EXPIRES_IN}}" ]; then
CMD="$CMD --expires-in {{.EXPIRES_IN}}"
fi

# Create the customer and capture the output
CUSTOMER_JSON=$($CMD)

# Extract and output just the customer ID
echo "$CUSTOMER_JSON" | jq -r '.id'

gcp-vm-create:
desc: Create a simple GCP VM instance
silent: false
Expand Down Expand Up @@ -355,14 +410,79 @@ tasks:
GCP_ZONE: '{{.GCP_ZONE}}'
VM_NAME: '{{.VM_NAME}}'

customer-ls:
desc: List customers for the application
silent: false
vars:
OUTPUT_FORMAT: '{{.OUTPUT_FORMAT | default "table"}}'
requires:
vars: [APP_SLUG]
cmds:
- echo "Listing customers for app {{.APP_SLUG}}..."
- replicated customer ls --app {{.APP_SLUG}} --output {{.OUTPUT_FORMAT}}

customer-delete:
desc: Archive a customer by ID
silent: false
vars:
CUSTOMER_ID: '{{.CUSTOMER_ID}}'
requires:
vars: [APP_SLUG, CUSTOMER_ID]
cmds:
- echo "Archiving customer with ID {{.CUSTOMER_ID}} from app {{.APP_SLUG}}..."
- |
# Verify customer exists before attempting to archive
CUSTOMER_EXISTS=$(replicated customer ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.id=="{{.CUSTOMER_ID}}") | .id')
if [ -z "$CUSTOMER_EXISTS" ]; then
echo "Error: Customer with ID {{.CUSTOMER_ID}} not found for app {{.APP_SLUG}}"
exit 1
fi

# Get customer name for confirmation message
CUSTOMER_NAME=$(replicated customer ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.id=="{{.CUSTOMER_ID}}") | .name')

# Archive the customer
replicated customer archive {{.CUSTOMER_ID}} --app {{.APP_SLUG}}

# Confirm archiving
echo "Customer '$CUSTOMER_NAME' (ID: {{.CUSTOMER_ID}}) successfully archived"

clean:
desc: Remove temporary Helm directories, chart dependencies, and release folder
silent: false
cmds:
- echo "Cleaning temporary directories and dependencies..."
- |
# Remove the release directory
if [ -d "./release" ]; then
echo "Removing release directory..."
rm -rf ./release
fi

# Find and remove tmpcharts-* directories in charts/
echo "Removing temporary chart directories..."
find charts/ -type d -name "tmpcharts-*" -print
find charts/ -type d -name "tmpcharts-*" -exec rm -rf {} \; 2>/dev/null || true

# Clean up chart dependencies (.tgz files) in charts/*/charts/
echo "Removing chart dependencies..."
find charts/ -path "*/charts/*.tgz" -type f -print
find charts/ -path "*/charts/*.tgz" -type f -delete

# Clean up any tmpcharts directories in subdirectories
echo "Cleaning up any remaining tmpcharts directories..."
find . -type d -name "tmpcharts-*" -print
find . -type d -name "tmpcharts-*" -exec rm -rf {} \; 2>/dev/null || true
- echo "Cleaning complete!"

full-test-cycle:
desc: Create cluster, get kubeconfig, expose ports, update dependencies, deploy charts, test, and delete
silent: false
cmds:
- task: cluster-create
- task: setup-kubeconfig
- task: ports-expose
- task: cluster-ports-expose
- task: dependencies-update
- task: helm-deploy
- task: helm-install
- task: test
- task: cluster-delete
9 changes: 9 additions & 0 deletions applications/wg-easy/charts/cert-manager/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dependencies:
- name: cert-manager
repository: https://charts.jetstack.io
version: v1.14.5
- name: templates
repository: file://../templates
version: 1.0.0
digest: sha256:ab86a335f7f473446968c607ed7920bf4ce29f625e5ff6175be17bb2e1101a32
generated: "2025-05-06T15:35:47.871225-04:00"
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ dependencies:
repository: https://charts.jetstack.io
- name: templates
version: '*'
repository: file://../charts/templates
repository: file://../templates
9 changes: 9 additions & 0 deletions applications/wg-easy/charts/replicated-sdk/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dependencies:
- name: templates
repository: file://../templates
version: 1.0.0
- name: replicated
repository: oci://registry.replicated.com/library
version: 1.1.1
digest: sha256:bb2c4743fae54061dfde5812086300bf9ed7c86f9f4d80ccb0858df407d21a2a
generated: "2025-05-06T15:35:43.881588-04:00"
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: v2
dependencies:
- name: templates
version: '*'
repository: file://../charts/templates
repository: file://../templates
- name: replicated
repository: oci://registry.replicated.com/library
version: 1.1.1
9 changes: 9 additions & 0 deletions applications/wg-easy/charts/traefik/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dependencies:
- name: traefik
repository: https://traefik.github.io/charts
version: 28.0.0
- name: templates
repository: file://../templates
version: 1.0.0
digest: sha256:14c6de6f10918ec6bbe2d6e99408da62b362fc7950ce8793ebaaa4693ffdeb75
generated: "2025-05-06T15:35:53.545992-04:00"
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ dependencies:
repository: https://traefik.github.io/charts
- name: templates
version: '*'
repository: file://../charts/templates
repository: file://../templates
6 changes: 6 additions & 0 deletions applications/wg-easy/charts/wg-easy/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: templates
repository: file://../templates
version: 1.0.0
digest: sha256:9939fc386e44c7a8d0a274f270ec92ac70ac9858442b4f85638122044082da74
generated: "2025-05-06T15:20:40.596254-04:00"
7 changes: 7 additions & 0 deletions applications/wg-easy/charts/wg-easy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: wg-easy
version: 1.0.0
apiVersion: v2
dependencies:
- name: templates
version: '*'
repository: file://../templates
25 changes: 25 additions & 0 deletions applications/wg-easy/charts/wg-easy/charts/wg-easy/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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/
manifests/
doc/
6 changes: 6 additions & 0 deletions applications/wg-easy/charts/wg-easy/charts/wg-easy/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: replicated-library
repository: https://replicatedhq.github.io/helm-charts
version: 0.13.10
digest: sha256:cb41956b9ecae9581fa42eeb58487c8251a6e6d4ead534c28b577931e566e37e
generated: "2023-12-27T16:31:00.156396361-06:00"
13 changes: 13 additions & 0 deletions applications/wg-easy/charts/wg-easy/charts/wg-easy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v2
dependencies:
- name: replicated-library
repository: https://replicatedhq.github.io/helm-charts
version: ^0.13.2
description: Simple wireguard with web configuration management
home: https://github.com/chris-sanders/helm-charts/charts/wg-easy
maintainers:
- email: sanders.chris@gmail.com
name: Chris Sanders
url: https://github.com/chris-sanders/helm-charts
name: wg-easy
version: 1.0.0
17 changes: 17 additions & 0 deletions applications/wg-easy/charts/wg-easy/charts/wg-easy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# wg-easy

## Helm chart

This is a helm chart for deploying [wg-easy](https://github.com/wg-easy/wg-easy) which describes itself as "You have found the easiest way to install & manage WireGuard on any Linux host!". This chart is not affiliated with the upstream project and bugs for this chart should not be filed against the upstream project.

## Installing the Chart

This chart exposes all of the wg-easy environment variables for configuration under the key `wireguard`. You can see the value available in the values.yaml file with this chart. Detailed instructions have not been written although the upstream project documents each of the environment variables.

## Releasing the chart

To release a new version of this chart simply set the version number in `Chart.yaml` as part of a pull request and once merged the new version will be released. Note that since this chart uses a `chart.lock` file the version in the lock file should match the version of the dependency listed in `Chart.yaml`, which should also be the version you tested your development changes against. Anytime you adjust the dependency version in `Chart.yaml` you should use `helm dependencies update` to fetch the new version and update the lock file to match. If your lock file and dependency version in the `Chart.yaml` file do not match you should update your dependencies and re-test to ensure your changes work with the version in the lock file.

## Contributing

This chart is functional and in use but lacks practices like more user friendly install instructions, explanation of how to configure values like `loadBalancerIP` on the vpn service, and a changelog to document changes in the versions. Contributions to add any of these items, to operate in a similar fashion to what's available in the library-chart that is used as a dependency would be greatly appreciated.
Loading
Loading