Debugging and deploying Dart HTTP web server to Elastic Beanstalk.
| Setting | Value |
|---|---|
| Purpose | Debugging dart web server deployed in a multi-container docker config hosted on Elastic Beanstalk |
| Server | Dart http web server |
| Server Language | Dart |
| Architecture | Dart |
| IDE | Visual Studio Code |
| CI | Travis CI |
| Hosting | Elastic Beanstalk |
| License | GPL v3 |
| Tutorial | Youtube Tutorial |
- Run
pub getto initialize the project.
- Run
dart ./server/lib/server.dart
- Use the VS Code Launcher
1. Launch Server - http://localhost:8080 - ./ server
- http://localhost:8080/api - ./api server
Make sure things work locally in the eb local run runner!
- Run
eb local run - Open http://localhost:8080
| cmd | details |
|---|---|
| docker ps | list the docker containers and [container id]s |
| docker exec -it [container id] bash | /bin/bash into the container. (The container name could be used as well.) |
| eb local run | This will run the Dockerrun.aws.json multi-container configuration |
The dart tools are required to use this project.
Install the Dart VS Code plugin.
Add the program launcher, to launch the web server.
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Web Server",
"program": "lib/server.dart",
"request": "launch",
"type": "dart"
}
]
}
Configure the AWS CLI and EB CLI utilities.
Run aws configure to configure the AWS credentials locally.
Set up the Elastic Beanstalk application.
Run eb init to configure the Elastic Beanstalk hosting config.
- Choose the datacenter that makes sense to you. (I'll choose the default.)
- Choose
Create New Applicationand I use the default application name in this example. - Choose
Multi-container Dockerand the latest version. - Do not choose CodeCommit in this config.
- Choose the SSH key to setup SSH, if you want to use SSH.
This will create a project file ./.elasticbeanstalk/config.yml.
Set up an Elastic environment for your application.
Run eb create dartserver-staging-v1 where dartserver-staging-v1 is the enviornment name you choose.
The Dockerrun.aws.json will configure the docker container when deployed.
In this configuration I won't show how to build and deploy a Docker image to ECR.
