I watched the following videos to prepare myself for week 1 of the cloud project bootcamp -
- Week 1 live stream
- Spend Considerations for week 1 by Chirag
- Container Security Considerations by Ashish
- Containerize the application - Dockerfile & docker-compose
- Containerize the frontend and backend
- Add PostgreSQL and DynamoDB local containers in the docker-compose.yml file
- How to ask for technical help
- Grading Homework Summaries
Added the following Dockerfile for the backend flask application.
docker build -t backend-flask ./backend-flask
Run
docker run --rm -p 4567:4567 -it backend-flask
Ran NPM Install before building the container since it needs to copy the contents of node_modules
cd frontend-react-js
npm i
Added the following Dockerfile for the frontend reactjs application.
docker build -t frontend-react-js ./frontend-react-js
docker run -p 3000:3000 -d frontend-react-js
Since there are 2 containers, we need to build and run them separately for the entire application to function. A better way is to list all the containers in a docker-compose file and run them at once.
Added the following docker-compose.yml at the root of the project.
Running this file will start all the containers mentioned in the file at once.
For future labs, we are going to use Postgres and DynamoDB local. Hence added these in the docker-compose file created in the previous step.
To test if the local DynamoDB works, I executed the following commands -
- Create a table
aws dynamodb create-table \
--endpoint-url http://localhost:8000 \
--table-name Music \
--attribute-definitions \
AttributeName=Artist,AttributeType=S \
AttributeName=SongTitle,AttributeType=S \
--key-schema AttributeName=Artist,KeyType=HASH AttributeName=SongTitle,KeyType=RANGE \
--provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1 \
--table-class STANDARD
- Put an Item
aws dynamodb put-item \
--endpoint-url http://localhost:8000 \
--table-name Music \
--item \
'{"Artist": {"S": "No One You Know"}, "SongTitle": {"S": "Call Me Today"}, "AlbumTitle": {"S": "Somewhat Famous"}}' \
--return-consumed-capacity TOTAL
- List Tables
aws dynamodb list-tables --endpoint-url http://localhost:8000
- Get Records
aws dynamodb scan --table-name cruddur_cruds --query "Items" --endpoint-url http://localhost:8000
To test if the PostgreSQL local works, I executed the following commands -
- Gain access to PostgreSQL -
psql -Upostgres --host localhost
- Checked for tables, tuples, relations
I have added a new endoint for notifications. This API is documented along with the other APIs in the OpenAI document.
I have made the necessary backend changes to add the new notifications endpoint in flask
I have added a new page in react to display the notifications for an user.
Apart from the required tasks, I have completed the following homework tasks -
- Push and tag an image to DockerHub
-
Research best practices of Dockerfiles and attempt to implement it in your Dockerfile
-
Learn how to install Docker on your localmachine and get the same containers running outside of Gitpod / Codespaces
- Launch an EC2 instance that has docker installed, and pull a container to demonstrate you can run your own docker processes.