Skip to content

Commit

Permalink
Added basic makefile to automatize the installation steps.
Browse files Browse the repository at this point in the history
  • Loading branch information
pantierra committed Oct 31, 2024
1 parent 6a90664 commit ed98c19
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 81 deletions.
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Makefile for eoapi-k8s

# Variables
HELM_REPO_URL=https://devseed.com/eoapi-k8s/
HELM_CHART_NAME=eoapi/eoapi
PGO_CHART_VERSION=5.5.2

.PHONY: all deploy minikube help

# Default target
all: deploy

deploy:
@echo "Installing dependencies."
@command -v helm >/dev/null 2>&1 || { echo "helm is required but not installed"; exit 1; }
helm install --set disable_check_for_upgrades=true pgo oci://registry.developers.crunchydata.com/crunchydata/pgo --version $(PGO_CHART_VERSION)
@echo "Adding eoAPI helm repository."
@helm repo add eoapi $(HELM_REPO_URL)
@echo "Installing eoAPI helm chart."
@cd ./helm-chart && \
helm install --namespace eoapi --create-namespace --set gitSha=$$(git rev-parse HEAD | cut -c1-10) eoapi ./eoapi

minikube:
@echo "Starting minikube."
@command -v minikube >/dev/null 2>&1 || { echo "minikube is required but not installed"; exit 1; }
minikube start
# Deploy eoAPI via the regular helm install routine
@make deploy
minikube addons enable ingress
@echo "eoAPI is now available at:"
@minikube service ingress-nginx-controller -n ingress-nginx --url

help:
@echo "Makefile commands:"
@echo " make deploy - Install eoAPI on a cluster kubectl is connected to."
@echo " make minikube - Install eoAPI on minikube."
@echo " make help - Show this help message."
111 changes: 30 additions & 81 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,97 +9,46 @@
</a>
</p>

## Table of Contents
* [What is eoAPI](#whatitis)
* [Getting Started](#gettingstarted)
* [Helm Installation](#helminstall)
* [Default Configuration and Options](#options)
* [Autoscaling / Monitoring / Observability](./docs/autoscaling.md)

<a name="whatitis"/>

## What is eoAPI?

[https://eoapi.dev/](https://eoapi.dev/)

<a name="gettingstarted"/>

## Getting Started

Make sure you have [helm](https://helm.sh/docs/intro/install/) installed on your machine.
Additionally, you will need a cluster to deploy the eoAPI helm chart. This can be on a cloud provider, like AWS, GCP, or any other that supports Kubernetes. You can also run a local cluster using minikube.i

### Local

For a local installation you can use a preinstalled [Minikube](https://minikube.sigs.k8s.io/), and simply execute the following command:

```bash
$ make minikube
```

### Cloud

If you don't have a k8s cluster set up on AWS or GCP then follow an IaC guide below that is relevant to you

> &#9432; The helm chart in this repo assumes your cluster has a few third-party add-ons and controllers installed. So
> it's in your best interest to read through the IaC guides to understand what those defaults are
* [AWS EKS Cluster Setup](./docs/aws-eks.md)

* [GCP GKE Cluster Setup](./docs/gcp-gke.md)

<a name="helminstall"/>

## Helm Installation

Once you have a k8s cluster set up you can `helm install` eoAPI with the following steps:

0. `eoapi-k8s` depends on the [Crunchydata Postgresql Operator](https://access.crunchydata.com/documentation/postgres-operator/latest/installation/helm). Install that first:

```python
$ helm install --set disable_check_for_upgrades=true pgo oci://registry.developers.crunchydata.com/crunchydata/pgo --version 5.5.2
```


1. Add the eoapi repo from https://devseed.com/eoapi-k8s/:

```python
$ helm repo add eoapi https://devseed.com/eoapi-k8s/
```

2. List out the eoapi chart versions

```python
$ helm search repo eoapi --versions
NAME CHART VERSION APP VERSION DESCRIPTION
eoapi/eoapi 0.2.14 0.3.1 Create a full Earth Observation API with Metada...
eoapi/eoapi 0.1.13 0.2.11 Create a full Earth Observation API with Metada...
```
3. Optionally override keys/values in the default `values.yaml` with a custom `config.yaml` like below:

```python
$ cat config.yaml
vector:
enable: false
pgstacBootstrap:
settings:
envVars:
LOAD_FIXTURES: "0"
RUN_FOREVER: "1"
```
4. Then `helm install` with those `config.yaml` values:

```python
$ helm install -n eoapi --create-namespace eoapi eoapi/eoapi --version 0.1.2 -f config.yaml
```

5. or check out this repo and `helm install` from this repo's `helm-chart/` folder:

```python
######################################################
# create os environment variables for required secrets
######################################################
$ export GITSHA=$(git rev-parse HEAD | cut -c1-10)

$ cd ./helm-chart

$ helm install \
--namespace eoapi \
--create-namespace \
--set gitSha=$GITSHA \
eoapi \
./eoapi
```

<a name="options"/>

## Configuration Options and Defaults
Read about [Default Configuration](./docs/configuration.md#default-configuration) and
other [Configuration Options](./docs/configuration.md#additional-options) in the documentation

Then simply execute the following command:

```bash
$ make deploy
```

### Manual step-by-step installation

Instead of using the `make` commands above you can also [manually `helm install` eoAPI](./docs/helm-install.md).


## More information

* Read about [Default Configuration](./docs/configuration.md#default-configuration) and
other [Configuration Options](./docs/configuration.md#additional-options)
* Learn about [Autoscaling / Monitoring / Observability](./docs/autoscaling.md)
59 changes: 59 additions & 0 deletions docs/helm-install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Manual Helm Install

0. `eoapi-k8s` depends on the [Crunchydata Postgresql Operator](https://access.crunchydata.com/documentation/postgres-operator/latest/installation/helm). Install that first:

```bash
$ helm install --set disable_check_for_upgrades=true pgo oci://registry.developers.crunchydata.com/crunchydata/pgo --version 5.5.2
```

1. Add the eoapi repo from https://devseed.com/eoapi-k8s/:

```bash
$ helm repo add eoapi https://devseed.com/eoapi-k8s/
```

2. List out the eoapi chart versions

```bash
$ helm search repo eoapi --versions
NAME CHART VERSION APP VERSION DESCRIPTION
eoapi/eoapi 0.2.14 0.3.1 Create a full Earth Observation API with Metada...
eoapi/eoapi 0.1.13 0.2.11 Create a full Earth Observation API with Metada...
```

3. Optionally override keys/values in the default `values.yaml` with a custom `config.yaml` like below:

```bash
$ cat config.yaml
vector:
enable: false
pgstacBootstrap:
settings:
envVars:
LOAD_FIXTURES: "0"
RUN_FOREVER: "1"
```

4. Then `helm install` with those `config.yaml` values:

```bash
$ helm install -n eoapi --create-namespace eoapi eoapi/eoapi --version 0.1.2 -f config.yaml
```

5. or check out this repo and `helm install` from this repo's `helm-chart/` folder:
```bash
######################################################
# create os environment variables for required secrets
######################################################
$ export GITSHA=$(git rev-parse HEAD | cut -c1-10)
$ cd ./helm-chart
$ helm install \
--namespace eoapi \
--create-namespace \
--set gitSha=$GITSHA \
eoapi \
./eoapi
```

0 comments on commit ed98c19

Please sign in to comment.