|
1 | | ---- |
2 | | -hide: |
3 | | - - navigation |
4 | | ---- |
| 1 | +# Deployment |
5 | 2 |
|
| 3 | +eoAPI can be deployed using Kubernetes or AWS CDK. |
6 | 4 |
|
7 | | -## Via [eoapi-cdk](https://github.com/developmentseed/eoapi-cdk) |
| 5 | +## Kubernetes (Recommended) |
8 | 6 |
|
| 7 | +Production-ready deployment with high availability, auto-scaling, and monitoring. |
9 | 8 |
|
10 | | -[eoapi-cdk](https://github.com/developmentseed/eoapi-cdk) is a set of AWS CDK constructs that can be used to easily deploy eoAPI services on AWS with the CDK. |
| 9 | +**→ [Complete Kubernetes Documentation](./deployment/kubernetes/index.md)** |
11 | 10 |
|
12 | | -[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. |
| 11 | +- Multi-cloud support (AWS, GCP, Azure) |
| 12 | +- Helm-based installation |
| 13 | +- Built-in monitoring and autoscaling |
13 | 14 |
|
14 | | -An example of Cloud Stack is available for AWS (RDS for the database and Lambda for the APIs). |
| 15 | +## AWS CDK |
15 | 16 |
|
16 | | -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 them to AWS, and handle the creation of the Lambda and API Gateway resources. |
| 17 | +Serverless deployment using AWS Lambda, RDS, and API Gateway. |
17 | 18 |
|
18 | | -The example commands here will deploy a CloudFormation stack called `eoAPI-staging`. |
| 19 | +**→ [Complete AWS CDK Documentation](./deployment/aws/index.md)** |
19 | 20 |
|
20 | | -1. Clone the `eoapi` repo and install dependencies |
21 | | - ```bash |
22 | | - # Download eoapi repo |
23 | | - git clone https://github.com/developmentseed/eoapi-template.git |
24 | | - cd eoapi-template |
25 | | - |
26 | | - # Create a virtual environment |
27 | | - python -m venv .venv |
28 | | - source .venv/bin/activate |
29 | | - |
30 | | - # install cdk dependencies |
31 | | - python -m pip install -r requirements.txt |
32 | | - ``` |
33 | | - |
34 | | -2. Install node dependency - requires node version 14+ |
35 | | - ```bash |
36 | | - npm install |
37 | | - ``` |
38 | | - |
39 | | -3. Update settings |
40 | | - |
41 | | - Set environment variable or complex code in the `.env` or `config.yaml` file (e.g., https://github.com/developmentseed/eoapi-template/blob/main/config.yaml.example). |
42 | | - |
43 | | - See https://github.com/developmentseed/eoapi-template/blob/main/infrastructure/config.py for more info on the configuration options. |
44 | | - |
45 | | - |
46 | | -4. Install CDK and connect to your AWS account. This step is only necessary once per AWS account. The environment variables `PROJECT_ID` and `STAGE` determines the name of the stack |
47 | | -(e.g., eoAPI-staging or eoAPI-production) |
48 | | - ```bash |
49 | | - # Deploy the CDK toolkit stack into an AWS environment. |
50 | | - PROJECT_ID=eoAPI \ |
51 | | - STAGE=staging \ |
52 | | - npx cdk bootstrap |
53 | | -
|
54 | | - # or to a specific region |
55 | | - AWS_DEFAULT_REGION=us-west-2 \ |
56 | | - AWS_REGION=us-west-2 \ |
57 | | - PROJECT_ID=eoAPI \ |
58 | | - STAGE=staging \ |
59 | | - npx cdk bootstrap |
60 | | - ``` |
61 | | - |
62 | | -5. Pre-Generate CFN template |
63 | | - |
64 | | - ```bash |
65 | | - PROJECT_ID=eoAPI \ |
66 | | - STAGE=staging \ |
67 | | - npx cdk synth --all # Synthesizes and prints the CloudFormation template for this stack |
68 | | - ``` |
69 | | - |
70 | | -6. Deploy |
71 | | - |
72 | | - ```bash |
73 | | - # Note: a VPC stack is needed for the database |
74 | | - PROJECT_ID=eoAPI \ |
75 | | - STAGE=staging \ |
76 | | - npx cdk deploy vpceoAPI-staging eoAPI-staging |
77 | | -
|
78 | | - # Deploy in a specific region |
79 | | - AWS_DEFAULT_REGION=eu-central-1 \ |
80 | | - AWS_REGION=eu-central-1 \ |
81 | | - PROJECT_ID=eoAPI \ |
82 | | - STAGE=staging \ |
83 | | - npx cdk deploy vpceoAPI-staging eoAPI-stagingg --profile {my-aws-profile} |
84 | | - ``` |
85 | | - |
86 | | -If you get an error saying that the max VPCs have been reached, you have hit the limit for the number of VPCs per unique AWS account and region combination. You can change the AWS region to a region with fewer VPCs and deploy again to fix this. |
87 | | - |
88 | | -## Via [eoapi-k8s](https://github.com/developmentseed/eoapi-k8s) |
89 | | - |
90 | | -[eoapi-k8s](https://github.com/developmentseed/eoapi-k8s) has the IaC and Helm charts for deploying eoAPI services on AWS and GCP. |
91 | | - |
92 | | -**Getting started** |
93 | | - |
94 | | -If you still need to set up a k8s cluster on AWS or GCP, then follow an IaC guide below that is relevant to you. |
95 | | - |
96 | | -> ⓘ The helm chart in this repo assumes your cluster has a few third-party add-ons and controllers installed. So |
97 | | -> It's in your best interest to read through the IaC guides to understand what those defaults are |
98 | | -
|
99 | | -* :octicons-link-external-16: [AWS EKS Cluster Setup](https://github.com/developmentseed/eoapi-k8s/blob/main/docs/aws-eks.md) |
100 | | -
|
101 | | -* :octicons-link-external-16: [TBD: GCP GKE Cluster Setup](https://github.com/developmentseed/eoapi-k8s/blob/main/docs/gcp-gke.md) |
102 | | -
|
103 | | -**Helm Installation** |
104 | | -
|
105 | | -Once you have a k8s cluster set up, you can `helm install` eoAPI as follows |
106 | | -
|
107 | | -1. `helm install` from this repo's `helm-chart/` folder: |
108 | | - |
109 | | - ```python |
110 | | - ###################################################### |
111 | | - # create os environment variables for required secrets |
112 | | - ###################################################### |
113 | | - $ export GITSHA=$(git rev-parse HEAD | cut -c1-10) |
114 | | - $ export PGUSER=s00pers3cr3t |
115 | | - $ export POSTGRES_USER=s00pers3cr3t |
116 | | - $ export POSTGRES_PASSWORD=superuserfoobar |
117 | | - $ export PGPASSWORD=foobar |
118 | | -
|
119 | | - $ cd ./helm-chart |
120 | | -
|
121 | | - $ helm install \ |
122 | | - --namespace eoapi \ |
123 | | - --create-namespace \ |
124 | | - --set gitSha=$GITSHA \ |
125 | | - --set db.settings.secrets.PGUSER=$PGUSER \ |
126 | | - --set db.settings.secrets.POSTGRES_USER=$POSTGRES_USER \ |
127 | | - --set db.settings.secrets.PGPASSWORD=$PGPASSWORD \ |
128 | | - --set db.settings.secrets.POSTGRES_PASSWORD=$POSTGRES_PASSWORD \ |
129 | | - eoapi \ |
130 | | - ./eoapi |
131 | | - ``` |
132 | | - |
133 | | -2. or `helm install` from https://devseed.com/eoapi-k8s/: |
134 | | - |
135 | | - ```python |
136 | | - # add the eoapi helm repo locally |
137 | | - $ helm repo add eoapi https://devseed.com/eoapi-k8s/ |
138 | | -
|
139 | | - # List out the eoapi chart versions |
140 | | - $ helm search repo eoapi |
141 | | - NAME CHART VERSION APP VERSION DESCRIPTION |
142 | | - eoapi/eoapi 0.1.1 0.1.0 Create a full Earth Observation API with Metada... |
143 | | - eoapi/eoapi 0.1.2 0.1.0 Create a full Earth Observation API with Metada... |
144 | | -
|
145 | | - # add the required secret overrides to an arbitrarily named `.yaml` file (`config.yaml` below) |
146 | | - $ cat config.yaml |
147 | | - db: |
148 | | - settings: |
149 | | - secrets: |
150 | | - PGUSER: "username" |
151 | | - POSTGRES_USER: "username" |
152 | | - PGPASSWORD: "password" |
153 | | - POSTGRES_PASSWORD: "password" |
154 | | -
|
155 | | - # then run `helm install` with those overrides |
156 | | - helm install eoapi eoapi/eoapi --version 0.1.1 -f config.yaml |
157 | | - ``` |
| 21 | +- Pay-per-request pricing |
| 22 | +- Managed infrastructure |
| 23 | +- AWS-native integration |
0 commit comments