|
| 1 | +# ChartMuseum |
| 2 | +<img align="right" src="https://github.com/chartmuseum/chartmuseum/raw/master/logo.png"> |
| 3 | + |
| 4 | +[](https://circleci.com/gh/chartmuseum/chartmuseum) |
| 5 | +[](https://goreportcard.com/report/github.com/chartmuseum/chartmuseum) |
| 6 | +[](https://godoc.org/github.com/chartmuseum/chartmuseum) |
| 7 | +<sub>**_"Preserve your precious artifacts... in the cloud!"_**<sub> |
| 8 | + |
| 9 | +*ChartMuseum* is an open-source **[Helm Chart Repository](https://github.com/kubernetes/helm/blob/master/docs/chart_repository.md)** written in Go (Golang), with support for cloud storage backends, including [Google Cloud Storage](https://cloud.google.com/storage/) and [Amazon S3](https://aws.amazon.com/s3/). |
| 10 | + |
| 11 | +Works as a valid Helm Chart Repository, and also provides an API for uploading new chart packages to storage etc. |
| 12 | + |
| 13 | +<img width="60" align="right" src="https://github.com/golang-samples/gopher-vector/raw/master/gopher-side_color.png"> |
| 14 | +<img width="20" align="right" src="https://github.com/golang-samples/gopher-vector/raw/master/gopher-side_color.png"> |
| 15 | + |
| 16 | +Powered by some great Go technology: |
| 17 | +- [Kubernetes Helm](https://github.com/kubernetes/helm) - for working with charts, generating repository index |
| 18 | +- [Gin Web Framework](https://github.com/gin-gonic/gin) - for HTTP routing |
| 19 | +- [cli](https://github.com/urfave/cli) - for command line option parsing |
| 20 | +- [zap](https://github.com/uber-go/zap) - for logging |
| 21 | + |
| 22 | +## API |
| 23 | +### Helm Chart Repository |
| 24 | +- `GET /index.yaml` - retrieved when you run `helm repo add chartmuseum http://localhost:8080/` |
| 25 | +- `GET /charts/mychart-0.1.0.tgz` - retrieved when you run `helm install chartmuseum/mychart` |
| 26 | +- `GET /charts/mychart-0.1.0.tgz.prov` - retrieved when you run `helm install` with the `--verify` flag |
| 27 | + |
| 28 | +### Chart Manipulation |
| 29 | +- `POST /api/charts` - upload a new chart version |
| 30 | +- `POST /api/prov` - upload a new provenance file |
| 31 | +- `DELETE /api/charts/<name>/<version>` - delete a chart version (and corresponding provenance file) |
| 32 | +- `GET /api/charts` - list all charts |
| 33 | +- `GET /api/charts/<name>` - list all versions of a chart |
| 34 | +- `GET /api/charts/<name>/<version>` - describe a chart version |
| 35 | + |
| 36 | +## Uploading a Chart Package |
| 37 | +<sub>*Follow **"How to Run"** section below to get ChartMuseum up and running at ht<span>tp:/</span>/localhost:8080*<sub> |
| 38 | + |
| 39 | +First create `mychart-0.1.0.tgz` using the [Helm CLI](https://docs.helm.sh/using_helm/#installing-helm): |
| 40 | +``` |
| 41 | +cd mychart/ |
| 42 | +helm package . |
| 43 | +``` |
| 44 | + |
| 45 | +Upload `mychart-0.1.0.tgz`: |
| 46 | +```bash |
| 47 | +curl --data-binary "@mychart-0.1.0.tgz" http://localhost:8080/api/charts |
| 48 | +``` |
| 49 | + |
| 50 | +If you've signed your package and generated a [provenance file](https://github.com/kubernetes/helm/blob/master/docs/provenance.md), upload it with: |
| 51 | +```bash |
| 52 | +curl --data-binary "@mychart-0.1.0.tgz.prov" http://localhost:8080/api/prov |
| 53 | +``` |
| 54 | + |
| 55 | +## Installing Charts into Kubernetes |
| 56 | +Add the URL to your *ChartMuseum* installation to the local repository list: |
| 57 | +```bash |
| 58 | +helm repo add chartmuseum http://localhost:8080 |
| 59 | +``` |
| 60 | + |
| 61 | +Search for charts: |
| 62 | +```bash |
| 63 | +helm search chartmuseum/ |
| 64 | +``` |
| 65 | + |
| 66 | +Install chart: |
| 67 | +```bash |
| 68 | +helm install chartmuseum/mychart |
| 69 | +``` |
| 70 | + |
| 71 | +## How to Run |
| 72 | +### CLI |
| 73 | +#### Installation |
| 74 | +Install the binary: |
| 75 | +```bash |
| 76 | +# on Linux |
| 77 | +curl -LO https://s3.amazonaws.com/chartmuseum/release/latest/bin/linux/amd64/chartmuseum |
| 78 | + |
| 79 | +# on macOS |
| 80 | +curl -LO https://s3.amazonaws.com/chartmuseum/release/latest/bin/darwin/amd64/chartmuseum |
| 81 | + |
| 82 | +chmod +x ./chartmuseum |
| 83 | +mv ./chartmuseum /usr/local/bin |
| 84 | +``` |
| 85 | +Using `latest` in URLs above will get the latest binary (built from master branch). |
| 86 | + |
| 87 | +Replace `latest` with `$(curl -s https://s3.amazonaws.com/chartmuseum/release/stable.txt)` to automatically determine the latest stable release (e.g. `v0.1.0`). |
| 88 | + |
| 89 | +Show all CLI options with `chartmuseum --help` and determine version with `chartmuseum --version` |
| 90 | + |
| 91 | +#### Using with Amazon S3 |
| 92 | +Make sure your environment is properly setup to access `my-s3-bucket` |
| 93 | +```bash |
| 94 | +chartmuseum --debug --port=8080 \ |
| 95 | + --storage="amazon" \ |
| 96 | + --storage-amazon-bucket="my-s3-bucket" \ |
| 97 | + --storage-amazon-prefix="" \ |
| 98 | + --storage-amazon-region="us-east-1" |
| 99 | +``` |
| 100 | + |
| 101 | +#### Using with Google Cloud Storage |
| 102 | +Make sure your environment is properly setup to access `my-gcs-bucket` |
| 103 | +```bash |
| 104 | +chartmuseum --debug --port=8080 \ |
| 105 | + --storage="google" \ |
| 106 | + --storage-google-bucket="my-gcs-bucket" \ |
| 107 | + --storage-google-prefix="" |
| 108 | +``` |
| 109 | + |
| 110 | +#### Using with local filesystem storage |
| 111 | +Make sure you have read-write access to `./chartstorage` (will create if doesn't exist) |
| 112 | +```bash |
| 113 | +chartmuseum --debug --port=8080 \ |
| 114 | + --storage="local" \ |
| 115 | + --storage-local-rootdir="./chartstorage" |
| 116 | +``` |
| 117 | + |
| 118 | +### Docker Image |
| 119 | +Available via [Docker Hub](https://hub.docker.com/r/chartmuseum/chartmuseum/). |
| 120 | + |
| 121 | +Example usage (S3): |
| 122 | +```bash |
| 123 | +docker run --rm -it \ |
| 124 | + -p 8080:8080 \ |
| 125 | + -v ~/.aws:/root/.aws:ro \ |
| 126 | + chartmuseum/chartmuseum:latest \ |
| 127 | + --debug --port=8080 \ |
| 128 | + --storage="amazon" \ |
| 129 | + --storage-amazon-bucket="my-s3-bucket" \ |
| 130 | + --storage-amazon-prefix="" \ |
| 131 | + --storage-amazon-region="us-east-1" |
| 132 | +``` |
| 133 | + |
| 134 | +## Notes on index.yaml |
| 135 | +The repository index (index.yaml) is dynamically generated based on packages found in storage. If you store your own version of index.yaml, it will be completely ignored. |
| 136 | + |
| 137 | +`GET /index.yaml` occurs when you run `helm repo add chartmuseum http://localhost:8080/` or `helm repo update`. |
| 138 | + |
| 139 | +If you manually add/remove a .tgz package from storage, it will be immediately reflected in `GET /index.yaml`. |
| 140 | + |
| 141 | +You are no longer required to maintain your own version of index.yaml using `helm repo index --merge`. |
| 142 | + |
| 143 | +## Mirroring the official Kubernetes repositories |
| 144 | +Please see `scripts/mirror_k8s_repos.sh` for an example of how to download all .tgz packages from the official Kubernetes repositories (both stable and incubator). |
| 145 | + |
| 146 | +You can then use *ChartMuseum* to serve up an internal mirror: |
| 147 | +``` |
| 148 | +scripts/mirror_k8s_repos.sh |
| 149 | +chartmuseum --debug --port=8080 --storage="local" --storage-local-rootdir="./mirror" |
| 150 | + ``` |
0 commit comments