Skip to content
/ echat Public

Find some fun people to play with and have a good time.

Notifications You must be signed in to change notification settings

0-don/echat

Repository files navigation

Logo

eChat

Find some fun people to play with and have a good time.
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started Development
  3. Getting Started Production

About The Project

This Project will be something between epal.gg or battlebuddy.gg

Built With

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

    node -v
    v16.5.0
  • postgres

    psql -help
  • important to install yarn packet manager & typescript globally

    npm i yarn typescript -g

(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

  1. create ./server/.env environment file

    - Be sure too create `.env` file as explained in the `.env.development`
  2. from root echat/ folder, run server.

    yarn server

Web Development

  1. ./web/.env.local graphql server url port

    - change NEXT_PUBLIC_GRAPHQL_SERVER_URL, to your specified url & port from the ./server/.env file
  2. from root echat/ folder, run web.

    yarn 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
  • 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.conf file 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
      sudo nginx -t
  • 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

  1. First of all you need to setup github action secrets from ./server/.env

  2. set up your workflows in like in ./.github/workflows/node.js.yml

  3. 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/graphql

    copy 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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. 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/

Releases

No releases published

Packages

No packages published

Languages