BUILT AN ONLINE CODING PLATFORM FROM SCRATCH AND DOCKERISED THE APPLICATION AND FINALLY HOSTED IN EC2 SERVER
1.Launch the instance..(in mycase I launched t2.micro)
2.ssh to the instance and clone the github repo using git clone
3.install the latest node package(in my case I installed nodev18.18.0 since my different packages in the application was not supporting lower packages)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
source ~/.bashrc
nvm list-remote
nvm install v18.18.0
node -v
4.go inside the folder and enter the environment variables needed in the project along with other modules.
5.Open the port 3000 and 8000 in security group
6.run the command inside the ec2
6.Hit the public IP in the ec2 server
building image:
docker build -t imagename:version .
eg: docker build -t himashree/onlinecoding_platform:latest .
to containeraise image:
docker container run -d -p 3000:3000 -p 8000:8000 himashree/onlinecoding_platform:latest
additional command:
to check continers:
docker container ls