Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deployment docs #115

Merged
merged 3 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,15 @@ Note: services might have incompatible dependencies which you can resolve by usi

## Deployment

This repository has the demonstration runtimes that are consistently updated with new functionality.
This repository has current runtimes that are consistently updated with new functionality.

The default runtimes are available through separate repositories ([eoapi-cdk](https://github.com/developmentseed/eoapi-cdk) and [eoapi-k8s](https://github.com/developmentseed/eoapi-k8s)).
The services can be deployed locally via docker with `docker-compose up`.
zacharyDez marked this conversation as resolved.
Show resolved Hide resolved

A demonstration application is accessible with the repository [eoapi-template](https://github.com/developmentseed/eoapi-template).
Two IaC repositories are available:
zacharyDez marked this conversation as resolved.
Show resolved Hide resolved
- [eoapi-cdk](https://github.com/developmentseed/eoapi-cdk): A set of AWS CDK constructs to deploy eoAPI services
- [eoapi-k8s](https://github.com/developmentseed/eoapi-k8s): IaC and Helm charts for deploying eoAPI services on AWS and GCP

Finally, [eoapi-template](https://github.com/developmentseed/eoapi-template) is an AWS CDK app that shows how to configure the eoapi-cdk constructs.

## Contribution & Development

Expand Down
81 changes: 75 additions & 6 deletions docs/src/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ hide:
- navigation
---

The default runtimes are available through separate repositories ([eoapi-cdk](https://github.com/developmentseed/eoapi-cdk) and [eoapi-k8s](https://github.com/developmentseed/eoapi-k8s)).

A demonstration application is accessible with the repository [eoapi-template](https://github.com/developmentseed/eoapi-template).
## Via [eoapi-cdk](https://github.com/developmentseed/eoapi-cdk)

## AWS (Lambda)

An example of Cloud Stack is available for AWS (RDS for the database and Lambda for the APIs)
[eoapi-cdk](https://github.com/developmentseed/eoapi-cdk) is a set of AWS CDK constructs to deploy eoAPI services.

[eoapi-template](https://github.com/developmentseed/eoapi-template) is an AWS CDK app that shows how to configure the [eoapi-cdk](https://github.com/developmentseed/eoapi-cdk) constructs.

An example of Cloud Stack is available for AWS (RDS for the database and Lambda for the APIs).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove the following section and replace with a simple eoapi-cdk example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't seem to find the equivalent for the eoAPI-k8s version. @alukach @sharkinsspatial could you put together a short getting started example for the eoapi-cdk repo?

Copy link
Member

@alukach alukach Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To help me understand what we're trying to do here...

I think we should remove the following section and replace with a simple eoapi-cdk example

@vincentsarago why do you suggest this? What do you feel is insufficient regarding what is currently written.


The stack is deployed by the [AWS CDK](https://aws.amazon.com/cdk/) utility. Under the hood, CDK will create the deployment packages required for AWS Lambda, upload it to AWS, and handle the creation of the Lambda and API Gateway resources.

Expand Down Expand Up @@ -86,6 +88,73 @@ The example commands here will deploy a CloudFormation stack called `eoAPI-stagi

If you get an error saying that the max VPC's has been reached, this means that you have hit the limit for the amount of VPCs per unique AWS account and region combination. You can change the AWS region to a region that has less VPCs and deploy again to fix this.

## K8S
## Via [eoapi-k8s](https://github.com/developmentseed/eoapi-k8s)

[eoapi-k8s](https://github.com/developmentseed/eoapi-k8s) has the IaC and Helm charts for deploying eoAPI services on AWS and GCP.

**Getting started**

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)

A Kubernetes chart is currently being developed at https://github.com/developmentseed/eoapi-k8s
* [TBD: GCP GKE Cluster Setup](./docs/gcp-gke.md)

**Helm Installation**

Once you have a k8s cluster set up you can `helm install` eoAPI as follows

1. `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)
$ export PGUSER=s00pers3cr3t
$ export POSTGRES_USER=s00pers3cr3t
$ export POSTGRES_PASSWORD=superuserfoobar
$ export PGPASSWORD=foobar

$ cd ./helm-chart

$ helm install \
--namespace eoapi \
--create-namespace \
--set gitSha=$GITSHA \
--set db.settings.secrets.PGUSER=$PGUSER \
--set db.settings.secrets.POSTGRES_USER=$POSTGRES_USER \
--set db.settings.secrets.PGPASSWORD=$PGPASSWORD \
--set db.settings.secrets.POSTGRES_PASSWORD=$POSTGRES_PASSWORD \
eoapi \
./eoapi
```

2. or `helm install` from https://devseed.com/eoapi-k8s/:

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

# list out the eoapi chart versions
$ helm search repo eoapi
NAME CHART VERSION APP VERSION DESCRIPTION
eoapi/eoapi 0.1.1 0.1.0 Create a full Earth Observation API with Metada...
eoapi/eoapi 0.1.2 0.1.0 Create a full Earth Observation API with Metada...

# add the required secret overrides to an arbitrarily named `.yaml` file (`config.yaml` below)
$ cat config.yaml
db:
settings:
secrets:
PGUSER: "username"
POSTGRES_USER: "username"
PGPASSWORD: "password"
POSTGRES_PASSWORD: "password"

# then run `helm install` with those overrides
helm install eoapi eoapi/eoapi --version 0.1.1 -f config.yaml
```