This is part 2. This project covers debugging the AWS configuration and deploying the simple web application to a Elastic Beanstalk multi docker container configuration. Check out part 1 which covers debugging the web application.
This project extends part 1, debugging an express server and simple webpack client. Check this it for even more debugging tips and tricks.
Part 2 adds Elastic Beanstalk to the project deployment configuration. This video covers how to debug the project with Elastic Beanstalk multi-docker container format.
This is the part 2 project configuration.
Setting | Value |
---|---|
Purpose | Debugging a client & server multi-container docker config hosted on Elastic Beanstalk |
Server | Express web server |
Client | Simple HTML/JavaScript webpack configuration |
Client Language | JavaScript |
Server Language | JavaScript |
Architecture | npm/node |
IDE | Visual Studio Code |
CI | Travis CI |
Hosting | Elastic Beanstalk |
License | GPL v3 |
Tutorial | Youtube Tutorial |
- From the project root, run
npm install
to download the libraries used in the client and server directories.
- Use the VS Code Launcher
1. Launch Server
- http://localhost:3000 - ./ server
- http://localhost:3000/api - ./api server
- Use the VS Code Launcher
2. Launch Client
- http://localhost:8080 - ./ client
Debug both the client and server together. The webpack dev server provides a reverse proxy to the server.
- Use the VS Code Launcher
3. Launch Client Chrome
- http://localhost:8080 - ./ client
- http://localhost:8080/api - ./api server
Make sure things work locally in the eb local run
runner!
- Run
npm install
- Run
npm run build
- Run
eb local run
- Open http://0.0.0.0:3000
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 |
Build from the root of this project.
- Run
npm install
- Run
npm run build
- The files will be output to the
./dist
directory. - Run
npm run serverFromDist
to run the server from./dist
build directory. - Open http://localhost:3000 or http://localhost:3000/api
Travis CI server deploys to Elastic Beanstalk.
This is a reference on how the Elastic Beanstalk application was created.
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 Application
and I use the default application name in this example. - Choose
Multi-container Docker
and 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 sandbox-staging-v1
where sandbox-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.