Skip to content

How to setup ripple

Howl edited this page Nov 8, 2016 · 7 revisions

How to setup ripple

This is a basic guide on how to set up your own ripple instance.


Requirements

  • PHP
  • nginx (or Apache)
  • MySQL
  • Python 3
  • flask, tornado, pymysql, psutils and bcrypt

We have tested ripple on Ubuntu Server 15.10 with PHP 5.6.4, nginx 1.9.11, MySQL 5.6.18 and Python 3.5.1


nginx configuration

Use this configuration as a sample, DO NOT COPY AND PASTE IT ENTIRELY AND EXPECT IT TO WORK!

# Web frontend/PHP backend
server {
    listen 80;
    listen 443 ssl;    # required for stable/beta/cutting edge support
    server_name ripple.moe osu.ppy.sh www.osu.ppy.sh;
    root /path/to/ripple/osu.ppy.sh;

    # required for stable/beta/cutting edge support
    ssl on;
    ssl_certificate /path/to/ppy.sh.cert.pem;
    ssl_certificate_key /path/to/ppy.sh.key.pem;

    ...

    # PHP FastCGI
    location ~ \.php$ {
        ...
    }

    # nginx rewrite
    location / {
        rewrite ^/(u|d)/[0-9]+$ /rewrite.php;
    }
}

# Avatar server
server {
    listen 80;
    listen 443 ssl;    # required for stable/beta/cutting edge support
    server_name a.ppy.sh a.ripple.moe;

    # required for stable/beta/cutting edge support
    ssl on;
    ssl_certificate /path/to/ppy.sh.cert.pem;
    ssl_certificate_key /path/to/ppy.sh.key.pem;

    root /path/to/ripple/a.ppy.sh;
    client_max_body_size 5M;
    client_body_buffer_size 256K;
    try_files $uri @shout;

    location @shout {
        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 https;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://127.0.0.1:5000;    # default port is 5000
    }
}

# Bancho server
server {
    listen 80;
    listen 443 ssl;    # required for stable/beta/cutting edge support
    server_name c.ppy.sh c1.ppy.sh c.ripple.moe;

    # required for stable/beta/cutting edge support
    ssl on;
    ssl_certificate /path/to/ppy.sh.cert.pem;
    ssl_certificate_key /path/to/ppy.sh.key.pem;

    root /path/to/ripple/c.ppy.sh;
    client_max_body_size 5M;
    client_body_buffer_size 256K;
    try_files $uri @shout;

    location @shout {
        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 https;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://127.0.0.1:5001;    # default port is 5001
    }
}

This is the whole configuration one of our developers uses in their dev instance of ripple.

You must have an HTTPS certificate in order to use ripple with stable/beta/cuttine edge. If you don't want to generate one or you want to play only on fallback, you can remove listen 443 ssl and every other ssl option

Web frontend configuration

  • First of all, move to a directory you want and clone the git repo
  • Then, create a empty MySQL database, move to path/to/ripple/osu.ppy.sh/inc and copy config.sample.php as config.php
  • Open config.php with a text editor and configure your MySQL settings
  • Now we need to import and update the database. Run this magic command
$ php path/to/ripple/ci-system/migrate.php

and you are good to go

Avatar server configuration

  • The avatar server is very easy to set up, you only need to install flask with this command
$ pip install flask
  • You can run the avatar server with
$ python3 path/to/ripple/a.ppy.sh

Bancho configuration

  • Bancho needs flask, tornado, pymysql, psutil and bcrypt to run. Let's install them
$ pip install flask 
$ pip install tornado
$ pip install pymysql
$ pip install psutil
$ pip install bcrypt
  • To run the server, you can simply to
$ python3 /path/to/ripple/c.ppy.sh/pep.py
  • If this is the first time you run the server, pep.py will create a config.ini file inside its folder. You have to configure it according to this page

Cronjob configuration

  • Set up a cronjob that runs this command every half an hour:
php /path/to/ripple/osu.ppy.sh/cron.php

(use crontab -e to edit your crontab)

And now?

Ripple should be up and running. Open your website, create an account and run this MySQL query to get admin privileges
UPDATE users SET rank = 4 WHERE username = 'your_username_here'

You can play on your ripple instance by installing a self-signed certificate and adding the following lines to your hosts file

127.0.0.1 osu.ppy.sh
127.0.0.1 a.ppy.sh
127.0.0.1 c.ppy.sh
127.0.0.1 c1.ppy.sh

Where 127.0.0.1 is your server's address