Israel-Laguan / parrot-echo

Web Service's Backend and Frontend, powered by Node.js and Docker!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parrot Echo | Echo system in JavaScript

Forks Stargazers Issues-open Issues-closed Contributors contributions welcome

Logo

Parrot Echo

Web Service's Backend and Frontend, powered by Node.js and Docker!

πŸ–ŠοΈπŸž Report a Bug πŸ™‹β€β™‚οΈ Request Feature

An EchoServer is an application that allows a client and a server to connect so a client can send a message to the server and the server can receive the message and send, or echo, it back to the client.

Server

A server is a computer or computer program that provides a service to another computer, or client. For example, the internet is based on web servers that respond to requests from clients via web browsers. How do you connect to a server to access it services? Often, you will connect to a server over a computer network, which is a group of computers connected together in order to share resources. To connect to a server, you need to know the port number that the server socket is listening on, which is an endpoint for communication between the client and the server. Each port number is associated with an IP address, a numerical label assigned to each device connected to a computer network, and a protocol type, preset rules and guidelines for communicating data. With the port number and IP address, you can attempt to establish a connection to a server. It is important to note that when building an echo server, it is not a requirement to be connected within a network. The server can be run locally on a computer and a client can connect to the server via the same computer.

Client

A client is responsible for sending a message to the server, and is also where the message is echoed back to. Once the server is running, or listening for connections, a client is able to send a request to the server. With the correct port number and IP address, and if everything goes to plan, the server accepts the connection and creates a new socket. Through the newly created socket, the client and server can now communicate by writing to or reading from the socket. Dealing with Input and Output

In order to build an echo server that receives a client message and echoes it back to the client, getting the input and output streams from a connected socket is necessary for creating the communication channels between the client and server. These streams are flows of data that mean the client can now send messages to the server, and the server can echo back the message to the client.

Run It

  • Be sure to setup docker-compose and have git.
  • Run this:
> git clone https://github.com/Israel-Laguan/parrot-echo.git
> cd parrot-echo
> docker-compose build
> npm i && npm run initialize
> docker-compose up

docker-build

docker-up

Alternativelly you can have both services in different terminals. After building, in one terminal run docker-compose up server

docker-up-server

And in another one docker-compose run frontend

docker-run-frontend

Not a fan of Docker or need more information? Each folder contains instructions about how to setup your PC for run each service locally! Also you can run in root ('parrot-echo/') npm run start to start both services! In this case remember to change proxy on client!

DevOps

We developed an infrastructure to deploy this project on AWS. The infrastructure has 3 AWS EC2 instances that are defined below:

  • Build Server

    Launched an AWS EC2 instance of type t2.micro configured with GitHub Actions Runner, it is recommended to use an instance of type m6in.large based on the characteristics recommended in the Github documentation. In addition, we have created the GitHub Actions YAML files, these are for the different environments (Development, Stage and Production).

    Actions copy the files (in this case the "server" folder) to the server where they will eventually be deployed, using appleboy/scp-action. The code is then executed using appleboy/ssh-action.

    Build Server

  • Backend Business Server

    Launched an AWS EC2 instance of type t2.micro, the instance type depends on the number of concurrent connections, project needs, and other factors.

    This has NGINX, an HTTP server used to redirect the requests that the server receives to the different subdomains; PM2, a process manager for Node.js and Let's Encrypt, a free certificate authority for generating and signing SSL certificates for different domains.

    Development

    Development

    Stage

    Stage

    Production

    Production

  • PostgreSQL Server

    Launched an AWS EC2 instance of type t2.micro, which deploys a PostgreSQL database manager, accessible from PGAdmin or any client application, through its own subdomain: db.teamnovasoft.tk.

    PGAdmin1 PGAdmin2

  • Changes in project files

    The project needs a file ecosystem.config.js to work, it has a list (array) of apps, each of them corresponds to a stage (Dev, Stage, Prod). This file will be read by PM2 and will run the application

Author

Contributing

contributions welcome

🀝 Contributions, issues and feature requests are welcome! Feel free to check the issues page. Be sure to review the contributing guidelines.

Happy programming πŸ˜ƒ ✌️

Show your support

πŸ€— Give a ⭐️ if you like this project!

Icons from:

Icons8

License

License

πŸ“ This project is licensed under the Apache 2
Feel free to fork this project and improve it

About

Web Service's Backend and Frontend, powered by Node.js and Docker!

License:Apache License 2.0


Languages

Language:JavaScript 94.8%Language:HTML 2.0%Language:SCSS 1.9%Language:Dockerfile 0.8%Language:Procfile 0.5%