-
Notifications
You must be signed in to change notification settings - Fork 1
Host your own Server
Will Davies edited this page Feb 27, 2020
·
25 revisions
-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.
If you're doing anything special, you may find this Java API useful: https://github.com/wdavies973/RobluCloud-API
- TCP 80
- TCP 8080
- TCP 22
- TCP 1337
- 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-legacy
- 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 to127.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 install npm
npm install -g npm
sudo npm install pm2 -g
sudo npm install sails -g
- If you get the "Unexpected token } in JSON", type
rm package-lock.json
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
- Type
- 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 theAdminRequest
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]
- Paste the following URL in any web browser:
- 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
- Backup:
- To update the server:
- Make sure to stop the server:
sudo pm2 kill
cd RobluCloud
sudo git pull
- Make sure to stop the server:
- 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