Set Up Your Real Time Chat App On Amazon Ec2 With Docker and Feathersjs
Set Up Your Real Time Chat App On Amazon Ec2 With Docker and Feathersjs
Reda Boumahdi
Follow
Aug 9, 2017 · 6 min read
Introduction
Amazon AWS is a service where you can borrow a machine
(sometimes for free) to do whatever you want. We are going to
learn how to set up a server to run a real time Chat App with
FeathersJS. FeathersJS is an open source REST and real time
API framework.We will need to set up a database and Feathers.
We will launch those 2 parts on your Amazon AWS service. This is
a simple tutorial, where we will learn how to run your real time
app on your Amazon AWS.
Install Docker
Now, we need to install Docker on your ec2 machine. Docker
runs “kind of” virtual machine which are called images, but are
way lighter than virtual machines. Docker will allow you to run all
the bricks of your app with a simple command line ! The good
thing about Docker is that it encapsulates all the software you
may need. This is precisely what we want to do when we run an
app, we wrap the different components of our architecture in
containers.
To install docker, you can type on your ec2 terminal the following
commands :
> curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo
apt-key add -
> sudo add-apt-repository "deb [arch=amd64]
https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
> sudo apt-get update
> apt-cache policy docker-ce
> sudo apt-get install -y docker-ce
> sudo systemctl status docker
You can notice that the folder is empty, but the app is running!
You can copy the content of the docker container to your host
machine with this command:
> sudo docker cp feathersChatApp:/usr/src/app .
http://ec2-54-187-133-189.us-west-
2.compute.amazonaws.com:3000/
You should have the same picture as this one. Now you can chat
with your friends or build a code on top of this “boilerplate”,
manage or change the database, etc…
You can signup, login, and test your real time chat app by creating
two accounts and exchange messages.
Now Close Your Terminal And Enjoy
Your App!
Conclusion
Today you learned to deploy a real time application to Amazon.
Real time is easy to set up with FeathersJS. Docker can help you
encapsulate all FeathersJS environment and push it to Amazon.
Docker can even help you launch your application on Amazon and
restart it when it crashes, but it is not a production
ready environment. You can now start coding and enriching your
real time application and deploy it to the cloud.
In the next articles, we will deploy deep learning / big data
applications. Don’t hesitate to follow me to get notified when the
next article comes out!
More links
1. More on Docker an incredible tool to build and ship apps
2. More on Amazon AWS to get to know all the products
3. More on setting up Dockers
4. More on Feathers and real time apps