# Personal Helm Repository

A helm repository is really, really simple. It's a static website that serves, at least,
a file called `index.yaml`. This file is auto-generated (see [Adding a chart](#adding-a-chart)
below) via helm commands.

Charts are added by copying their respective tgz archives into the webserver's content
directory. For example: /usr/share/nginx/html when using nginx.

Since charts are usually small you don't need a volume, you can copy the contents of your
charts directory into the webserver's docker image and serve a completely stateless repository.
You could potentially have a repository for each project or have an org-wide repository
that gets built automatically with something like gitlab/github pages.

## Gettings started

Create a folder called "charts".

Run `helm repo index charts`. An `index.yaml` will be created. It shouldn't have anything
in it.

Now you can run `podman-compose build` to create the image. This will copy the charts
folder into an nginx container. `podman-compose push` will upload the container to the
registry.

## Deploying the Repository

We can use the local chart (for now) to deploy the chart image.

```bash
helm upgrade --install \
    chart-repository \
    ./repository \
    --namespace chart-repository \
    --create-namespace
```

## Using the Repository

You can add the repository to your local helm client like any other:

```bash
helm repo add reeseapps https://charts.reeseapps.com
```

You can view the existing charts with

```bash
helm search repo reeseapps
```

Though nothing will show up right now...

## Adding a chart

We can add a chart by copying its .tgz package into `charts/`. For example:

```bash
helm package ./repository
mv repository-0.1.0.tgz charts/
```

Now recreate the index with

```bash
helm repo index charts
```

You should see a new entry in the index.yaml.

## Updating the image

Now that you have something in your index, we can update the image by following the
same process we used to deploy it:

```bash
podman-compose build
podman-compose push
helm upgrade --install \
    chart-repository \
    ./repository \
    --namespace chart-repository \
    --create-namespace
```

Now run `helm repo update` and `helm search repo reeseapps`. You should see the new
chart added.
