Browse Source

docs: make aws ecs steps expandable and add digitalocean (app)

pull/3976/head
Wing-Kam Wong 2 years ago
parent
commit
87e36dcba9
  1. 201
      packages/noco-docs/content/en/getting-started/installation.md

201
packages/noco-docs/content/en/getting-started/installation.md

@ -276,93 +276,142 @@ It is mandatory to configure `NC_DB` environment variables for production usecas
### AWS ECS (Fargate) ### AWS ECS (Fargate)
#### Create ECS Cluster <details>
<summary>Click to Expand</summary>
``` #### Create ECS Cluster
aws ecs create-cluster \
--cluster-name <YOUR_ECS_CLUSTER>
```
#### Create Log group ```
aws ecs create-cluster \
--cluster-name <YOUR_ECS_CLUSTER>
```
``` #### Create Log group
aws logs create-log-group \
--log-group-name /ecs/<YOUR_APP_NAME>/<YOUR_CONTAINER_NAME>
```
#### Create ECS Task Definiton ```
aws logs create-log-group \
--log-group-name /ecs/<YOUR_APP_NAME>/<YOUR_CONTAINER_NAME>
```
Every time you create it, it will add a new version. If it is not existing, the version will be 1. #### Create ECS Task Definiton
```bash Every time you create it, it will add a new version. If it is not existing, the version will be 1.
aws ecs register-task-definition \
--cli-input-json "file://./<YOUR_TASK_DEF_NAME>.json"
```
<alert> ```bash
This json file defines the container specification. You can define secrets such as NC_DB and environment variables here. aws ecs register-task-definition \
</alert> --cli-input-json "file://./<YOUR_TASK_DEF_NAME>.json"
```
Here's the sample Task Definition <alert>
This json file defines the container specification. You can define secrets such as NC_DB and environment variables here.
```json </alert>
{
"family": "nocodb-sample-task-def", Here's the sample Task Definition
"networkMode": "awsvpc",
"containerDefinitions": [{ ```json
"name": "<YOUR_CONTAINER_NAME>", {
"image": "nocodb/nocodb:latest", "family": "nocodb-sample-task-def",
"essential": true, "networkMode": "awsvpc",
"logConfiguration": { "containerDefinitions": [{
"logDriver": "awslogs", "name": "<YOUR_CONTAINER_NAME>",
"options": { "image": "nocodb/nocodb:latest",
"awslogs-group": "/ecs/<YOUR_APP_NAME>/<YOUR_CONTAINER_NAME>", "essential": true,
"awslogs-region": "<YOUR_AWS_REGION>", "logConfiguration": {
"awslogs-stream-prefix": "ecs" "logDriver": "awslogs",
} "options": {
}, "awslogs-group": "/ecs/<YOUR_APP_NAME>/<YOUR_CONTAINER_NAME>",
"secrets": [{ "awslogs-region": "<YOUR_AWS_REGION>",
"name": "<YOUR_SECRETS_NAME>", "awslogs-stream-prefix": "ecs"
"valueFrom": "<YOUR_SECRET_ARN>" }
}], },
"environment": [{ "secrets": [{
"name": "<YOUR_ENV_VARIABLE_NAME>", "name": "<YOUR_SECRETS_NAME>",
"value": "<YOUR_ENV_VARIABLE_VALUE>" "valueFrom": "<YOUR_SECRET_ARN>"
}], }],
"portMappings": [{ "environment": [{
"containerPort": 8080, "name": "<YOUR_ENV_VARIABLE_NAME>",
"hostPort": 8080, "value": "<YOUR_ENV_VARIABLE_VALUE>"
"protocol": "tcp" }],
}] "portMappings": [{
}], "containerPort": 8080,
"requiresCompatibilities": [ "hostPort": 8080,
"FARGATE" "protocol": "tcp"
], }]
"cpu": "256", }],
"memory": "512", "requiresCompatibilities": [
"executionRoleArn": "<YOUR_ECS_EXECUTION_ROLE_ARN>", "FARGATE"
"taskRoleArn": "<YOUR_ECS_TASK_ROLE_ARN>" ],
} "cpu": "256",
``` "memory": "512",
"executionRoleArn": "<YOUR_ECS_EXECUTION_ROLE_ARN>",
"taskRoleArn": "<YOUR_ECS_TASK_ROLE_ARN>"
}
```
#### Create ECS Service #### Create ECS Service
```bash ```bash
aws ecs create-service \ aws ecs create-service \
--cluster <YOUR_ECS_CLUSTER> \ --cluster <YOUR_ECS_CLUSTER> \
--service-name <YOUR_SERVICE_NAME> \ --service-name <YOUR_SERVICE_NAME> \
--task-definition <YOUR_TASK_DEF>:<YOUR_TASK_DEF_VERSION> \ --task-definition <YOUR_TASK_DEF>:<YOUR_TASK_DEF_VERSION> \
--desired-count <DESIRED_COUNT> \ --desired-count <DESIRED_COUNT> \
--launch-type "FARGATE" \ --launch-type "FARGATE" \
--platform-version <VERSION> \ --platform-version <VERSION> \
--health-check-grace-period-seconds <GRACE_PERIOD_IN_SECOND> \ --health-check-grace-period-seconds <GRACE_PERIOD_IN_SECOND> \
--network-configuration "awsvpcConfiguration={subnets=["<YOUR_SUBSETS>"], securityGroups=["<YOUR_SECURITY_GROUPS>"], assignPublicIp=ENABLED}" \ --network-configuration "awsvpcConfiguration={subnets=["<YOUR_SUBSETS>"], securityGroups=["<YOUR_SECURITY_GROUPS>"], assignPublicIp=ENABLED}" \
--load-balancer targetGroupArn=<TARGET_GROUP_ARN>,containerName=<CONTAINER_NAME>,containerPort=<YOUR_CONTAINER_PORT> --load-balancer targetGroupArn=<TARGET_GROUP_ARN>,containerName=<CONTAINER_NAME>,containerPort=<YOUR_CONTAINER_PORT>
``` ```
<alert>
If your service fails to start, you may check the logs in ECS console or in Cloudwatch. Generally it fails due to the connection between ECS container and NC_DB. Make sure the security groups have the correct inbound and outbound rules.
</alert>
```
</details>
### DigitalOcean (App)
<details>
<summary>Click to Expand</summary>
#### Create Apps
On Home page, Click on Create icon & Select Apps (Deploy your code).
![Screenshot 2022-02-19 at 12 17 43 PM](https://user-images.githubusercontent.com/86527202/154790558-f8fe5580-5a58-412c-9c2e-145587712bf2.png)
#### Choose Source: Docker Hub
![Screenshot 2022-02-19 at 12 22 01 PM](https://user-images.githubusercontent.com/86527202/154790563-b5b6d5b4-0bdc-4718-8cea-0a7ee52f283b.png)
#### Choose Source: Repository
Configure Source Repository as `nocodb/nocodb`. Optionally you can pick release tag if you are interested in specific NocoDB version.
![Screenshot 2022-02-19 at 12 23 11 PM](https://user-images.githubusercontent.com/86527202/154790564-1dcb5e33-3a57-471a-a44c-835a410a0cb7.png)
#### [Optional] Additional Configurations
![Screenshot 2022-02-19 at 12 24 44 PM](https://user-images.githubusercontent.com/86527202/154790565-c0234b2e-ad50-4042-90b6-4f8798f1d585.png)
#### Name your web service
Pick a name for your NocoDB application. This name will become part of URL subsequently
Pick nearest Region for cloud hosting
![Screenshot 2022-02-19 at 12 28 11 PM](https://user-images.githubusercontent.com/86527202/154790567-a6e65e4e-9aa0-4edb-998e-da8803ad6e23.png)
#### Finalize and Launch
- Select hosting plan for your NocoDB application
- Click "Launch APP"
![Screenshot 2022-02-19 at 12 29 23 PM](https://user-images.githubusercontent.com/86527202/154790570-62044713-5cca-4d06-82ec-f3cc257218a1.png)
Application will be build & URL will be live in a minute! The URL will be something like https://simply-nocodb-rsyir.ondigitalocean.app/
</details>
<alert>
If your service fails to start, you may check the logs in ECS console or in Cloudwatch. Generally it fails due to the connection between ECS container and NC_DB. Make sure the security groups have the correct inbound and outbound rules.
</alert>
## Sample Demos ## Sample Demos

Loading…
Cancel
Save