Skip to content

Commit

Permalink
Adds Helm chart repository to Github Actions
Browse files Browse the repository at this point in the history
Closes #394
  • Loading branch information
vchendrix committed May 9, 2023
1 parent b4d6f85 commit cbbbbaa
Show file tree
Hide file tree
Showing 29 changed files with 1,326 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .github/lintconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
chart-dirs: helm
check-version-increment: true
debug: false
remote: origin
target-branch: main
validate-chart-schema: true
validate-maintainers: false
validate-yaml: true
35 changes: 35 additions & 0 deletions .github/workflows/lint_helm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Lint Helm Charts

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


jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v2
with:
version: v3.4.0

- uses: actions/setup-python@v4
with:
python-version: 3.7

- name: Helm Chart Testing
uses: helm/[email protected]

- name: Run chart-testing (lint)
run: |
CHANGED=`ct list-changed --config .github/lintconfig.yaml;`;
LINTCONF=$CT_CONFIG_DIR/lintconf.yaml;
for c in $CHANGED; do echo "$c/Chart.yaml"; yamllint --config-file $LINTCONF $c/Chart.yaml; echo "$c/values.yaml"; yamllint --config-file $LINTCONF $c/values.yaml; done;
19 changes: 13 additions & 6 deletions .github/workflows/sphinx.yaml → .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Deploy Sphinx site to Pages
name: Deploy Pages
# Builds and deploys docs and helm charts

on:
# Runs on pushes targeting the default branch
push:
branches: [ "main" ]
# Runs on publication of a release or prerelease
release:
types: [ released, prereleased ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -33,10 +34,16 @@ jobs:
python-version: "3.9"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get update
sudo apt-get install -y python-dev-is-python3 libldap2-dev libsasl2-dev libssl-dev
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
pip install -e ".[docs]"
- name: Build with Charts
# Outputs to the './_site' directory by default
run: |
helm dependency update helm
helm package -d ./_site/charts helm
helm repo index ./_site/charts
- name: Setup Pages
id: pages
uses: actions/configure-pages@v2
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[![.github/workflows/tests.yml](https://github.com/NGEET/ngt-archive/actions/workflows/tests.yml/badge.svg)](https://github.com/NGEET/ngt-archive/actions/workflows/tests.yml)
[![Deploy Sphinx site to Pages](https://github.com/NGEET/ngt-archive/actions/workflows/sphinx.yaml/badge.svg)](https://github.com/NGEET/ngt-archive/actions/workflows/sphinx.yaml)
[![Docker Image CI](https://github.com/NGEET/ngt-archive/actions/workflows/docker-image.yaml/badge.svg?branch=main)](https://github.com/NGEET/ngt-archive/actions/workflows/docker-image.yaml)
[![Lint Helm Charts](https://github.com/NGEET/ngt-archive/actions/workflows/lint_helm.yaml/badge.svg)](https://github.com/NGEET/ngt-archive/actions/workflows/lint_helm.yaml)

# NGEE Tropics Archive Service

Expand Down
4 changes: 4 additions & 0 deletions docs/helm_chart.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. _helmchart:

.. include:: ../helm/README.md
:parser: myst_parser.docutils_
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Contents:

intro
quickstart
helm_chart
releases
contact
license
Expand Down
1 change: 0 additions & 1 deletion docs/requirements.txt

This file was deleted.

Empty file added helm/.gitignore
Empty file.
23 changes: 23 additions & 0 deletions helm/.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/
23 changes: 23 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v2
name: ngt-archive
description: NGEE-Tropics Archive

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
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: 2.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.
appVersion: 3.0.0-p119
167 changes: 167 additions & 0 deletions helm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# Helm Chart

Next-Generation Ecosystem Experiments–Tropics (NGEE-Tropics) is a DOE-funded,
multi-institutional project led by Berkeley Lab, focused on how
tropical forests interact with Earth’s climate. This helm chart deploys the
The NGEE-Tropics archive service sits in the middle of the *NGEE Tropics data workflow*.

* Place to upload datasets and metadata.
* Datasets should consist of related data collections, not individual files (e.g. Sapflow collected at Manaus)
* Datasets will receive a DOI, and can be updated with new data.
* Datasets will be available for search to NGEE Tropics team, and (if policy allows) to public
* Makes NGEE-Tropics compliant with DOE Data Management Plan


## Get Access

```bash
$ helm repo add ngt-archive https://ngeet.github.io/ngt-archive/charts/
$ helm search repo ngt-archive
```

## Introduction

This chart bootstraps a **NGEE-Tropics Archive** deployment on either a [Kubernetes](http://kubernetes.io)
or [Rancher](https://rancher.com/) cluster using the [Helm](https://helm.sh) package manager.

## Installing the Chart

To install the chart with the release name `<release name>`:

```bash
$ helm upgrade --install <release name> ngt-archive/ngt-archive
```

The command deploys ESS-DIVE Fusion Database on the Kubernetes cluster in the default configuration.

> **Tip**: List all releases using `helm ls`
## Uninstalling the Chart

To uninstall/delete the `<release name>` deployment:

```bash
$ helm delete <release name>
```

The command removes all the Kubernetes components associated with the chart and deletes the release.


## Configuration

The following table lists the configurable parameters of the ESS-DIVE Fusion Db chart and their default values.

| Parameter | Description | Default |
| :----------------------- | :---------------------- | -------------- |
| `ka8.creatorId` | Kubernetes user id | `""` |
| `k8.clustername` | Kubernates cluster name | `""` |
| `uid` | User id of the ngt-archive containers | `""` |
| `gid` | Group id of the ngt-archive containers | `""` |
| `readOnly` | Is the archive in read-only mode? | `"false"` |
| `teamEmail` | The email address for the - No Reply <[email protected]> | `""` |
| `celeryConcurrency` | The concurrency number for the celery worker | `3` |
| `emailSubjectPrefix` | Subject prefix for emails sent by the application | `""` |
| `image.repository` | docker image for this helm chart | `"registry.nersc.gov/m2690/ngt-archive"` |
| `image.tag` | docker image tag. Overrides the image tag whose default is the chart appVersion. | `""` |
| `imagePullSecrets` | Global registries for image pull secrets | `[]` |
| `nameOverride` | overrides ngt-archive.name template | `""` |
| `fullnameOverride` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | `""` |
| `restore.importFile` | Restore from a backup. Set the name of the file to import. | `""` |
| `secretName.application` | Application secrets (auth-bind-ldap-password, google-maps-key, secret-key) | `""` |
| `secretName.database` | Database Password (db-password) | `""` |
| `secretName.certificate` | The secret that points to the certificate for this deployment (ngt-data) | `""` |
| `volume.dbClaim` | Postgres db volume name (change this name when restoring from backups) | `""` |
| `volume.backupDirectory` | the postgres db backup directory | `""` |
| `volume.importDirectory` | the directory under the backup to import (e.g. 20221016T230006) | `""` |
| `volume.dataDirectory` | directory where archive data is stored | `""` |
| `volume.dataImportDirectory` | directory where archive data is imported from | `""` |
| `ingress.name` | Name of the ingres. (Defaults to fullname) | `""` |
| `ingress.enabled` | manage external access to services (https://kubernetes.io/docs/concepts/services-networking/ingress/) | `false` |
| `ingress.annotations` | annotations for this ingress | `{}` |
| `ingress.hosts` | list of hosts for the ingress | `[{"host": "chart-example.local", "paths": []}]` |
| `ingress.tls` | transport layer security | `[]` |
| `env` | environment variables for deployment | `"[]"` |
| `web.serverName` | The server name of this host | `"localhost"` |
| `web.realIp.enabled` | enable configuration for real ips | `false` |
| `web.realIp.fromIps` | the list subnet addresses to accept real ips from (e.g. [ '10.42.0.0/16', '144.44.138.155/25' ]) | `[]` |
| `web.locations.root` | root location declarations (e.g. `[{"name": "proxy_set_header", "value": "X-Forwarded-Proto https", "comment": "Set protocol to HTTPS"}]`) | `[]` |


### Examples
The examples below are minimal installations. You will likely need to configure more parameters.

Basic installation.

```bash
$ helm install <release name> ngt-archive/ngt-archive
```

## People

+ [Contributors](https://github.com/NGEET/ngt-archive/graphs/contributors)

## Copyright

NGEE Tropics Archive (NGT Archive) Copyright (c) 2017, The
Regents of the University of California, through Lawrence Berkeley National
Laboratory (subject to receipt of any required approvals from the U.S.
Dept. of Energy). All rights reserved.

If you have questions about your rights to use or distribute this software,
please contact Berkeley Lab's Intellectual Property Office at
[email protected].

NOTICE. This Software was developed under funding from the U.S. Department
of Energy and the U.S. Government consequently retains certain rights. As
such, the U.S. Government has been granted for itself and others acting on
its behalf a paid-up, nonexclusive, irrevocable, worldwide license in the
Software to reproduce, distribute copies to the public, prepare derivative
works

# License

```
NGEE Tropics Archive (NGT Archive) Copyright (c) 2017,
The Regents of the University of California, through
Lawrence Berkeley National Laboratory (subject to receipt of any required
approvals from the U.S. Dept. of Energy). All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
(1) Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
(2) Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
(3) Neither the name of the University of California, Lawrence Berkeley
National Laboratory, U.S. Dept. of Energy nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
You are under no obligation whatsoever to provide any bug fixes, patches,
or upgrades to the features, functionality or performance of the source
code ("Enhancements") to anyone; however, if you choose to make your
Enhancements available either publicly, or directly to Lawrence Berkeley
National Laboratory, without imposing a separate written license agreement
for such Enhancements, then you hereby grant the following license: a
non-exclusive, royalty-free perpetual license to install, use, modify,
prepare derivative works, incorporate into other computer software,
distribute, and sublicense such enhancements or derivative works thereof,
in binary and source code form.
```
24 changes: 24 additions & 0 deletions helm/config/error503.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<title>NGEE-Tropics Archive Service -- Down For Maintenance</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
h1 { font-size: 50px; }
body { text-align:center; font: 20px Helvetica, sans-serif; color: #333; }
#email { color:darkgreen;font-weight:bold }
</style>
</head>
<body>
<h1> NGEE-Tropics Data Service</h1>
<h2>Down For Maintenance</h2>
<p>Sorry for the inconvenience, but we are performing a maintenance at the moment.</p>
<p>We will be back online shortly!</p>
<p>For questions contact:
<span style="color:darkgreen;font-style:italic">
<span id="email">ngee-tropics-archive</span> at
<span id="email">lbl</span> dot
<span id="email">gov</span>
</span></p>
</body>
</html>
30 changes: 30 additions & 0 deletions helm/config/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
user nginx;
worker_processes auto;

error_log /var/log/nginx/error.log notice;
pid /var/tmp/nginx.pid;

events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;

#gzip on;

include /etc/nginx/conf.d/*.conf;
}
Loading

0 comments on commit cbbbbaa

Please sign in to comment.