Giter Site home page Giter Site logo

guilospanck / dota2-counters-backend Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 8 KB

Backend hosted on an EC2 Amazon instance to serve as backend to the react native application Dota2CountersReactNative.

License: Apache License 2.0

JavaScript 100.00%
backend node ec2 dota2

dota2-counters-backend's Introduction

Dota 2 Counters - Backend

Backend hosted on an EC2 Amazon instance to serve as backend to the react native application Dota2CountersReactNative.


Some configurations to remember

FOR NODE APPLICATIONS YOU'LL NEED PM2:

  1. Install PM2 on your server
npm install pm2@latest -g

➡️ PM2 it's a package that is going to run the process in the background.

  1. Go to your server.js folder and run
pm2 start server.js

➡️ If you have problems and need to add node params, you can do something like:

pm2 start server.js --node-args="--max-http-header-size=16384"

Other configs to pm2:

pm2 status
pm2 restart {index}

TO FORWARD PORTS IN UBUNTU:

  1. cat /proc/sys/net/ipv4/ip_forward ➡️ verify if port forwarding is enabled (1: enabled, 0: disabled)
  2. if disabled (0), then:
    • sudo nano /etc/sysctl.conf
    • uncomment the following line: net.ipv4.ip_forward
    • sudo sysctl -p /etc/sysctl.conf (to enable changes)
  3. cat /proc/sys/net/ipv4/ip_forward ➡️ verify if port forwarding is enabled (1: enabled, 0: disabled)
  4. set port forwarding:
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport {PORT_OF_YOUR_INSTANCE} -j REDIRECT --to-port {PORT_OF_YOUR_SERVER_APPLICATION}

For e.g.:

sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080

where: - {PORT_OF_YOUR_INSTANCE} is the port opened on your machine (usually 80, 443, 22 ...) - {PORT_OF_YOUR_SERVER_APPLICATION} is the port that you're listening on your application (on server.js for node) 5) Now open your firewall to that port

sudo iptables -A INPUT -p tcp -m tcp --sport {PORT_OF_YOUR_INSTANCE} -j ACCEPT

For e.g.:

sudo iptables -A INPUT -p tcp -m tcp --sport 80 -j ACCEPT)

And:

sudo iptables -A OUTPUT -p tcp -m tcp --dport {PORT_OF_YOUR_INSTANCE} -j ACCEPT

TO SET CRONTAB:

  1. Enable cron: sudo systemctl enable cron
  2. Type crontab -e and then enter
  3. select nano as your editor (usually option 1)
  4. Set your crontab service (go to cron guru for examples)
30 03 * * * python3 /home/ubuntu/dota2cp/dotabuff_scrapper.py

It'll run dotabuff_scrapper.py everyday at 03:30am.

➡️ (don't forget the "/" before the path in "/home...", otherwise will not work)

➡️ (always test before, in other words, test on the terminal: python3 /home/ubuntu/dota2cp/dotabuff_scrapper.py)

dota2-counters-backend's People

Contributors

guilospanck avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.