Host your own Server

Will Davies edited this page Oct 10, 2018 · 24 revisions

Supported Platforms

-Ubuntu is currently the only tested and recommended software platform.
-You can run Ubuntu on a PC, Amazon AWS server, Raspberry PI, or virtual box, and Roblu Cloud should still work fine.

Notes

If you're doing anything special, you may find this Java API useful: https://github.com/wdavies973/RobluCloud-API

Ports to forward on your router

  • TCP 80
  • TCP 8080
  • TCP 22
  • TCP 1337

Installation

  • Use PuTTTY to SSH into your server. If you don't know how to do this, check out a tutorial.
  • Make sure git is installed: sudo apt-get install git
  • Clone RobluCloud: git clone https://github.com/wdavies973/RobluCloud
  • Enter the following commands:
    • cd RobluCloud This is of critical importance, ALWAYS stay in this directory
    • sudo apt-get update
    • sudo apt-get upgrade
    • hostname, then set hostname to 127.0.0.1
    • sudo iptables -A INPUT -p tcp --dport 1337 -j ACCEPT
    • sudo apt-get install nodejs
  • Install Postgresql (database)
    • sudo apt-get install postgresql
    • sudo ln -s /usr/bin/nodejs /usr/bin/node
    • sudo su postgres
    • psql
    • create database production_database;
    • CREATE ROLE ubuntu;
    • ALTER ROLE ubuntu WITH LOGIN;
    • ALTER USER ubuntu PASSWORD 'underpressure';
    • \q to exit postgres
    • exit to return to main user
  • Install the following Node models:
    • sudo apt-get install npm
    • sudo npm install pm2 -g
    • sudo npm -g install sails
    • sudo npm install asyncawait --save
    • sudo npm install bcrypt-nodejs --save
    • sudo npm install ejs --save
    • sudo npm install async-handler --save
    • sudo npm install skipper --save
    • sudo npm install sails-postgresql --save
    • sudo npm install connect-redis@~3.0.2 --save --save-exact
    • sudo npm install
  • Test launch (You MUST do this, this command generates the database tables)
    • Type sudo sails lift, if no errors appear, your server is correctly configured. Press CTRL + C to cancel the sudo sails lift and proceed to the next section
  • Creating an Admin account on the server
    • sudo su postgres
    • psql
    • \connect production_database
    • INSERT INTO admin (auth) VALUES ('auth-string'); This auth string should be provided to the Java RobluCloud API to make any requests in the AdminRequest class
  • Creating a team on the server (to obtain a team code)
    • Paste the following URL in any web browser: [your-server-ip]/admin/createTeam?auth=[your-auth-code]&ownerEmail=[your-email-address]&officialName=[your-team-number]&code=[your-desired-team-code]

Managing the server

  • To launch:
    • cd RobluCloud
    • sudo pm2 start app.js -x -- --prod
  • To stop:
    • sudo pm2 kill
  • To view data within the database:
    • sudo su postgres
    • psql
    • \connect production_database;
    • Checkouts: SELECT * FROM checkouts;
    • Teams: SELECT code, official_team_name, owner_email, secret, number, active_event_name, last_content_edit, active FROM teams;
    • Admins: SELECT * FROM Admin;
  • Backup / Restore database:
    • Backup: pg_dumpall > all.sql
    • Restore: psql -f all.sql
  • To update the server:
    • Make sure to stop the server: sudo pm2 kill
    • cd RobluCloud
    • sudo git pull

Troubleshooting

  • Try deleting the production database and recreating it
    • cd RobluCloud
    • sudo su postgres
    • psql
    • drop database production_database;
    • create database production_database;
    • exit
    • sudo sails lift
  • If your admin auth code doesn’t work
    • cd RobluCloud
    • sudo su postgres
    • psql
    • \connect production_database;
    • INSERT INTO admin (auth) VALUES ('auth-string');
    • exit
  • Can’t create a team with API, try a local INSERT
    • cd RobluCloud
    • sudo su postgres
    • psql
    • \connect production_database;
    • (INSERT INTO teams (official_team_name, owner_email, secret, code) VALUES (‘name’, ‘email’, ‘secret’, ‘code’);
  • Restore / Backup database
    • Backup: pg_dumpall > all.sql
    • Restore: psql -f all.sql
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.