MonolithMorph
In this project, I successfully deployed a monolithic Node.js application to a Docker container and then decoupled it into microservices without any downtime. The application is a message board that allows users to interact through threads and messages.
-
Clone the Repository
git clone <your-repo-link> cd <your-repo-directory>
-
AWS Account: Sign up here if you don't have one.
-
Confirm installation with:
docker --version
- AWS CLI:
-
Confirm installation:
aws --version
-
macOS:
curl -Lo copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-darwin && chmod +x copilot && sudo mv copilot /usr/local/bin/copilot && copilot —help
-
Linux x86 (64-bit):
curl -Lo copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux && chmod +x copilot && sudo mv copilot /usr/local/bin/copilot && copilot —help
-
Linux (ARM):
curl -Lo copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux-arm64 && chmod +x copilot && sudo mv copilot
-
Windows:
Invoke-WebRequest -OutFile 'C:\Program Files\copilot.exe' https://github.com/aws/copilot-cli/releases/latest/download/copilot-windows.exe
-
cd ./amazon-ecs-nodejs-microservices/ copilot app init
-
copilot env init
-
copilot env deploy --name api
-
copilot svc init
-
copilot svc deploy --name monolith
- Use the provided AWS Copilot URL to test endpoints.
-
copilot svc init --app api --dockerfile ./3-microservices/services/posts/Dockerfile --name posts --svc-type "Load Balanced Web Service" copilot svc init --app api --dockerfile ./3-microservices/services/threads/Dockerfile --name threads --svc-type "Load Balanced Web Service" copilot svc init --app api --dockerfile ./3-microservices/services/users/Dockerfile --name users --svc-type "Load Balanced Web Service"
- AWS Copilot sets the path based on the service name. Edit the
manifest.yml
for each service to adjust the path.
-
copilot svc deploy --name posts copilot svc deploy --name threads copilot svc deploy --name users
-
copilot svc delete --name monolith
- Use the provided URLs to validate the microservices deployment.
-
copilot app delete --name api
Congratulations! You've now broken a monolithic application into microservices, offering more flexibility and scalability.