eChat
Table of Contents
About The Project
This Project will be something between epal.gg or battlebuddy.gg
Built With
-
Server
-
Web
Getting Started Development
This is an example of setting up your project locally. To get a local copy up and running follow these simple example steps.
Prerequisites Development
This project requires NodeJS (version 14 or later), Postgres and Yarn. Node and Postgres are really easy to install. To make sure you have them available on your machine, try running the following command.
-
node
-
postgres
-
important to install yarn packet manager & typescript globally
(Optional) SMPT Email, Cloudinary account and Twitch API (look up .env.development)
Installation Development
-
Clone the repo
git clone https://github.com/0-don/echat/ cd echat/ code .
+ Run 2 Terminals at the same time, 1 Server & 1 Web
Server Development
-
create
./server/.envenvironment file- Be sure too create `.env` file as explained in the `.env.development` -
from root
echat/folder, run server.
Web Development
-
./web/.env.localgraphql server url port- change NEXT_PUBLIC_GRAPHQL_SERVER_URL, to your specified url & port from the ./server/.env file -
from root
echat/folder, run web.
Getting Started Production
This is an example of setting up your project on the web. To get the local copy up and running on the web follow these simple example steps.
Prerequisites Production
This project requires preferrably a Ubuntu Linux VPS (version 20 or later), nginx, nodejs, postgres, github actions, docker. We will be going over each step individually.
-
node
cd ~ curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh && sudo bash nodesource_setup.sh sudo apt install nodejs node -v
- some node global dependecies
sudo npm i pm2 yarn typescript -g
- some node global dependecies
-
postgres
sudo apt install postgresql postgresql-contrib
-
(optional) Configure PostgreSQL to allow remote connection
-
find postgress config
$ find / -name "postgresql.conf" /var/lib/pgsql/9.4/data/postgresql.conf -
Open
postgresql.conffile and replace line:listen_addresses = 'localhost'with
listen_addresses = '*' -
restart postgres
sudo systemctl restart nginx
-
-
(optional) Create db example
sudo -u postgres createdb -O USERNAME DATABASE
-
-
nginx
sudo apt install nginx sudo ufw app list sudo ufw allow 'Nginx HTTP' systemctl status nginx- (optional) restart nginx
sudo systemctl restart nginx
- (optional) test the config
- (optional) restart nginx
-
docker (will be using it only for github actions .env file creation)
sudo apt install apt-transport-https ca-certificates curl software-properties-common 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 bionic stable" sudo apt install docker-ce #Docker with sudo sudo usermod -aG docker ${USER} su - ${USER}
Installation Production
-
First of all you need to setup github action secrets from
./server/.env -
set up your workflows in like in
./.github/workflows/node.js.yml -
set up action runner as shown here
while still beeing in the action-runner folder run this:(this will setup background process for the actions)
sudo ./svc.sh install sudo ./svc.sh start
-
nginx setup (use your site-name.com)
sudo nano /etc/nginx/sites-available/site-name.com.conf
paste this config
server { root /var/www/html; index index.html index.htm index.nginx-debian.html; server_name site-name.com www.site-name.com; client_max_body_size 200M; location / { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Connection $http_connection; client_max_body_size 200M; } location /graphql { proxy_pass http://localhost:4001/graphql; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Connection $http_connection; client_max_body_size 200M; }- Dont forget to change site-name.com, http://localhost:3000, http://localhost:4001/graphqlcopy config to enabled sites and test the config & restart nginx
sudo ln -s /etc/nginx/sites-available/site-name.com.conf /etc/nginx/sites-enabled/ nginx -t sudo service nginx restart
-
SSL (choose your site-name.com)
sudo apt install python3-certbot-nginx sudo certbot --nginx -d site-name.com -d www.site-name.com
Usage
Register, Login chat with a gamer, book them and play with them. For more examples, please refer to the FAQ
Roadmap
See the open issues for a list of proposed features (and known issues).
Contributing
Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE for more information.
Contact
Your Email - don.cryptus@gmail.com
Project Link: https://github.com/0-don/echat/