diff --git a/Makefile b/Makefile new file mode 100755 index 00000000..e7cb63be --- /dev/null +++ b/Makefile @@ -0,0 +1,38 @@ +# 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 dependency build ./eoapi && \ + 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 | head -n 1 + +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." diff --git a/README.md b/README.md index 5bca7d22..9a05c8b9 100644 --- a/README.md +++ b/README.md @@ -9,97 +9,48 @@

-## Table of Contents -* [What is eoAPI](#whatitis) -* [Getting Started](#gettingstarted) -* [Helm Installation](#helminstall) -* [Default Configuration and Options](#options) -* [Autoscaling / Monitoring / Observability](./docs/autoscaling.md) - - - ## What is eoAPI? [https://eoapi.dev/](https://eoapi.dev/) - - ## 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. + +### 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 +``` + +Once the deployment is done, the url to access eoAPI will be printed to your terminal. + +### 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 > ⓘ 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) - - - -## 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 - ``` - - - -## 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 + +Make sure you have your `kubectl` configured to point to the cluster you want to deploy eoAPI to. 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) diff --git a/docs/helm-install.md b/docs/helm-install.md new file mode 100644 index 00000000..b89565b2 --- /dev/null +++ b/docs/helm-install.md @@ -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 + ```