PistonDevelopers / pluto

Game competition server software for Rust gamedev community
MIT License
14 stars 4 forks source link

Server setup #32

Open bvssvni opened 8 years ago

bvssvni commented 8 years ago

Set up a Droplet on DigitalOcean.com (10$ bonus). Ubuntu 14.04.3 x64 Recommend setting up a SSH public key (link to instructions on Droplet setup page).

How to use Vim:
    I - edit mode
    ESC - view mode
    :wq - save and exit

These instructions assume you know how to use Vim.
# - remote (SSH)
$ - local (Terminal)

Addd a user with administrator privileges:
# ssh root@<ip>
# adduser <myname>
# gpasswd -a <myname> sudo
# su - <myname>
# mkdir .ssh
# chmod 700 .ssh
# vim .ssh/authorized_keys

Copy public key into the `authorized_keys` file.
$ cat ~/.ssh/id_rsa.pub
# <hit I to goto insert mode>
# <paste in the text with Ctrl+V>
# <press ESC, type ':wq', ENTER>

Test the user login through another Terminal window:
# ssh <myname>@<ip>

Disable root login to improve security, using root login Terminal window.
Make sure to test the user login first!
# vim /etc/ssh/sshd_config
# <find line with 'PermitRootLogin yes'>
# <hit I to goto insert mode>
# <change 'yes' to 'no'>
# <hit ESC, type ':wq', ENTER>
# service ssh restart
# exit

Install Rust, clone the Pluto repo and install packages:
# curl -sSf https://static.rust-lang.org/rustup.sh | sh
# sudo apt-get install git
# git clone https://github.com/PistonDevelopers/pluto
# sudo apt-get install pkg-config
# sudo apt-get install gcc
# sudo apt-get install libssl-dev

Change the ip address in the source to your Droplet's ip address:
# cd pluto
# vim src/main.rs
# <hit I to goto insert mode>
# <Change 'localhost' to your Droplet's ip address, change port to 80>
# <press ESC, type ':wq', ENTER>

Run the website (requires sudo because of port 80):
# sudo cargo run --release

Run the website even when not connected through SSH:
# sudo nohup cargo run --release &

Kill process:
# ps aux | grep pluto
# kill <pid>

Restart:
# sudo shutdown -r now