Skip to content

Install on game hosting

mbto edited this page Sep 1, 2021 · 3 revisions

Install on game hosting

  1. Install Java 11 from at adoptopenjdk.net or github.com/raphw/raphw.github.io or oracle.com/java if not installed
  2. Install MySQL server 8+ or use existed

Be sure, MySQL server have a default time-zone setting in [mysqld] section, example:

[mysqld]
default-time-zone='+03:00' # or yours time zone
  1. Create MySQL schemas:
CREATE DATABASE `funnyranks` CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci'
CREATE DATABASE `funnyranks_maxmind_country` CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci'
  1. Create MySQL user:
-- username:funnyranks password:funnyranks (or yours)
CREATE USER `funnyranks`@`%` IDENTIFIED WITH mysql_native_password BY 'funnyranks';
GRANT Alter, Alter Routine, Create, Create Routine, Create Temporary Tables, Create View, Delete, 
Drop, Event, Execute, Grant Option, Index, Insert, Lock Tables, References, Select, Show View, 
Trigger, Update ON `funnyranks`.* TO `funnyranks`@`%`;
GRANT Alter, Alter Routine, Create, Create Routine, Create Temporary Tables, Create View, Delete, 
Drop, Event, Execute, Grant Option, Index, Insert, Lock Tables, References, Select, Show View, 
Trigger, Update ON `funnyranks_maxmind_country`.* TO `funnyranks`@`%`;
  1. Download tables https://github.com/mbto/funnyranks/blob/master/funnyranks.sql
  2. Import tables:

Unix:

mysql -u root --password=root --comments funnyranks < "/opt/funnyranks/funnyranks.sql"

Windows:

"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe" -u root --password=root --comments funnyranks < "C:\funnyranks\funnyranks.sql"
  1. Download broker from releases (.jar)
  2. Download config file application.properties from https://github.com/mbto/funnyranks/blob/master/src/main/resources/application.properties
  3. Configure values in application.properties as you need:
  • funnyranks.broker.name=broker_1 - unique broker name. Each broker instance must have unique broker name per hosting.
  • funnyranks.datasource.jdbcUrl=jdbc:mysql://127.0.0.1:3306/
  • funnyranks.datasource.username=funnyranks
  • funnyranks.datasource.password=funnyranks (or yours)
  • server.servlet.context-path=/
  • server.port=8080
  • ...
  1. Create launch script:

Unix - launch.sh:

#!/bin/bash
java -jar /opt/funnyranks/funnyranks.jar --spring.config.location=/opt/funnyranks/application.properties >> /opt/funnyranks/logs/funnyranks.log 2>&1

or

#!/bin/bash
java -jar /opt/funnyranks/funnyranks.jar --spring.config.location=/opt/funnyranks/application.properties --logging.file=/opt/funnyranks/logs/funnyranks.log

Windows - launch.bat:

@echo off
start "funnyranks" "C:\Program Files\Java\jdk-11.0.11\bin\java.exe" -jar C:\funnyranks\funnyranks.jar --spring.config.location=C:\funnyranks\application.properties --logging.file=C:\funnyranks\logs\funnyranks.log
exit
  1. Administrate funnyranks broker available in http://127.0.0.1:8080/

Done

For graceful shutdown broker on Ctrl+C or signal kill process_pid or from http://127.0.0.1:8080/brokers

Clone this wiki locally