Skip to main content

cloud-native app registry server

Project description

# cnr-server

[![build status](https://gitlab.com/cn-app-registry/cnr-server/badges/master/build.svg)](https://gitlab.com/cn-app-registry/cnr-server/commits/master)
[![Coverage Status](https://coveralls.io/repos/github/cn-app-registry/cnr-server/badge.svg)](https://coveralls.io/github/cn-app-registry/cnr-server)
[![Swagger API Reference](https://img.shields.io/badge/swagger-docs-blue.svg)](Documentation/cnr-api-swagger.yaml)

CNR implements a registry for storing Kubernetes application manifests that attempts to reuse as much knowledge from the rest of the Linux container ecosystem as possible.

Differentiating features include:

- A protocol and data model that can more easily be implemented by pre-existing container registries
- This includes a common API for uploading, downloading, and searching for applications
- The reuse and integration with many elements from [OCI](https://www.opencontainers.org)
- Content addressable manifest scheme for security, signing, and non-trusted mirroring
- Reuse of common data structures such as Descriptors
- Unification of Manifest Lists as the means of content negoitation for both Images and Applications

## Getting started

1. git clone https://github.com/cn-app-registry/cnr-server.git && cd cnr-server
2. pip install -e . && pip install gunicorn
3. Run the cnr-server on port 5000 `gunicorn cnr.api.wsgi:app -b :5000`
or "./run-server"
4. See the [curl-based examples](Documentation/test.sh)

## Architecture at a glance

There are two top-level objects:

- Package: metadata describing an application
- Blob: a gzipped tarball of the package encoded in base64

Packages are primarily indexed by 3 notable fields:

- package-name: it follows container-image format: `namespace/name`.
- release: it's the version of the package, immutable it can be viewed as an alias to a digest
- mediaType: the format of the package formats (eg: docker-compose, dab, helm, kpm)

Data storage is specified by the `STORAGE` environment variable. The following are supported:

- `filesystem` (default)
- [`etcd`](https://github.com/coreos/etcd)
- [`redis`](https://github.com/antirez/redis)

## Demo using using [Helm](https://github.com/kubernetes/helm) charts

### Publish a chart

Create and encode the chart tarball

```
~/charts/elasticsearch $
tar czvf ../elastichart.tar.gz Chart.yaml manifests README.md
cat ../elastichart.tar.gz | base64 -w 0
H4sIAGBoF1gAA+2XTY/aMBCGc86vGKlngk02iRpVq1aUQw+VKlr1bowhVp0P2QZp/33tZFkCy0dVAburnUdCBs/EMyR5XyfjgmkbPbBSBVeDONL0zo80S0h/bInTLKAxIUmaxkmSBoTSu3QUALleS1tWxjINELDKxvRE3rn4G6VipchBKGas5EYwzYuwqP1cYW1j8uFwKW2xmkW8LoePacPd9LXQRtZVDiQaRSScC8O1bGw7NelnwlQYu1gp+Nn9nFRLWYmwZLKy7uOWyUOAAXxjFYzrxUI8wCfJ2y+f50Ia38O9W98lqzb1VyENjP0dDI2u19KVBgYzZiTfq/w06LXkIgpf+rS/GkpWyYW7LGZ4vRpe41mWHNW/Y1//yYgEkFyvpS3vXP/b678j6oFZ84vtCmf9P4n3rn9KKEH/vwWskb83/r2m4R9ZzXPnz61NhqWz2jmzzHvtoY0CQLGZ6LwYNhasn2cBFEJLy5Z+WxGqDE0juD+oqbV9NP1ufa6kqGy3nIvl8HFESC/eCKH70biNGqEEt7U+3cdLn+pXyTH968vJ/6z+M0r39J+kNEP934KD+p+KRknO/CPcuK6srpVysru6G+iurMmB/rOoAawoG8Ws6PL6TXoON+rpN3uu4U2HHl73n1Y9gxNVAGTZ/tOdYD6KaES3pTc2uFnvqcaPvgkei3oT/F93m06+fP0+icr5Re+qXc7pn9L9/Z+6SdT/Lfiw+6IUhvhOhSAIgiAIgiAIgiAIgiAIgiBvnr97lKMIACgAAA==
```

POST the chart to CNR

```
curl -XPOST http://localhost:5000/api/v1/packages/myname/elasticsearch -d '
{
"blob": "H4sIAP3mAFgAA....",
"release": "2.2.1",
"media_type": "helm"
}'
```

### Pull the chart

Find the digest from the package-name/release/media-type

```
curl -XGET http://localhost:5000/api/v1/packages/myname/elasticsearch/2.2.1/helm
{
"channels": [],
"content": {
"digest": "72ed15c9a65961ecd034cca098ec18eb99002cd402824aae8a674a8ae41bd0ef",
"mediaType": "application/vnd.cnr.package.helm.v1.tar+gzip",
"size": 583,
"urls": []
},
"created_at": "2016-11-16T17:13:07.806579",
"mediaType": "application/vnd.cnr.package-manifest.helm.v1.json",
"package": "myname/elasticsearch",
"release": "2.2.1"
}

```

Fetch the blob

```
curl -XGET \
http://localhost:5000/api/v1/packages/myname/elasticsearch/blobs/sha256/72ed15c9a65961ecd034cca098ec18eb99002cd402824aae8a674a8ae41bd0ef \
-o elasticsearch-chart.tar.gz
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cnr-server-0.2.7.post2.tar.gz (44.5 kB view details)

Uploaded Source

Built Distribution

cnr_server-0.2.7.post2-py2.py3-none-any.whl (55.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file cnr-server-0.2.7.post2.tar.gz.

File metadata

File hashes

Hashes for cnr-server-0.2.7.post2.tar.gz
Algorithm Hash digest
SHA256 9c2671c834dcb1d1936080372b284288d1012a8f9ad95fe57f03a29ebcfc5889
MD5 c2dd871f626587d87d637fde1cd1c46d
BLAKE2b-256 75d70eae2684891adca5b084c2a68312516a6ba35c8d1f699012cbc205e5ab46

See more details on using hashes here.

File details

Details for the file cnr_server-0.2.7.post2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for cnr_server-0.2.7.post2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 60e7464318ffa09e87e7a4366f013044506bafe80d09859f1b3de6edb4c452e0
MD5 5d78f81c6275e74300317bd6b299062d
BLAKE2b-256 a9e7bed1a8b503190d1487ce2fc871666f0ad01203af9f50e0a864c95a906398

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page