Installation on ubuntu 14.04 LTS - Laforeta/ooi2 GitHub Wiki
What is OOI?
Online Objects Integration (OOI) is a web-based Kancolle proxy for direct access of Kancolle without interaction with the DMM website.
OOI works the best on linux or BSD based servers. While it is technically possible to host OOI on a Windows server, performance is expected to be poor.
Source Code repository:
https://github.com/acgx/ooi2
Source with translations:
https://github.com/Laforeta/ooi2
Installation on Ubuntu
Install the following packages as root:
apt-get update && apt-get upgrade
apt-get install gcc python3-dev python3-pip python-virtualenv git nginx supervisor libcurl4-openssl-dev
Clone OOI from source repository:
cd /srv
git clone https://github.com/Laforeta/ooi2.git
Generate a virtualenv for OOI (because Python2 cannot into Python3):
virtualenv -p /usr/bin/python3 --no-site-packages ooi2
Enable the virtualenv and install dependencies in PIP.
source /srv/ooi2/bin/activate
pip install -U pip
pip install -U setuptools
pip install pycurl
pip install tornado
deactivate
Prefetch game files
Due to certain technical limitations, a number of files have to be prefetched from the game servers.
mkdir /srv/_kcs
cd /srv/_kcs
wget http://203.104.209.102/kcs/resources/image/world/125_006_184_015_l.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_184_015_s.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_184_016_l.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_184_016_s.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_187_205_l.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_187_205_s.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_187_229_l.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_187_229_s.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_187_253_l.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_187_253_s.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_188_025_l.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_188_025_s.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_189_007_l.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_189_007_s.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_189_039_l.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_189_039_s.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_189_071_l.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_189_071_s.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_189_103_l.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_189_103_s.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_189_135_l.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_189_135_s.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_189_167_l.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_189_167_s.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_189_215_l.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_189_215_s.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_189_247_l.png
wget http://203.104.209.102/kcs/resources/image/world/125_006_189_247_s.png
wget http://203.104.209.102/kcs/resources/image/world/203_104_105_167_l.png
wget http://203.104.209.102/kcs/resources/image/world/203_104_105_167_s.png
wget http://203.104.209.102/kcs/resources/image/world/203_104_209_023_l.png
wget http://203.104.209.102/kcs/resources/image/world/203_104_209_023_s.png
wget http://203.104.209.102/kcs/resources/image/world/203_104_209_039_l.png
wget http://203.104.209.102/kcs/resources/image/world/203_104_209_039_s.png
wget http://203.104.209.102/kcs/resources/image/world/203_104_209_055_l.png
wget http://203.104.209.102/kcs/resources/image/world/203_104_209_055_s.png
wget http://203.104.209.102/kcs/resources/image/world/203_104_209_071_l.png
wget http://203.104.209.102/kcs/resources/image/world/203_104_209_071_s.png
wget http://203.104.209.102/kcs/resources/image/world/203_104_209_102_l.png
wget http://203.104.209.102/kcs/resources/image/world/203_104_209_102_s.png
wget http://203.104.209.102/kcs/resources/image/world/203_104_248_135_l.png
wget http://203.104.209.102/kcs/resources/image/world/203_104_248_135_s.png
wget http://203.104.209.102/kcs/mainD2.swf
Set up supervisord
Create a new supervisord configuration file:
vim /etc/supervisor/conf.d/ooi2.conf
The configuration file should contain the following fields:
[program:ooi2]
command=/srv/ooi2/bin/python3 /srv/ooi2/ooi.py
environment=OOI_SECRET="$random_secret_passphrase"
directory=/srv/ooi2
autostart=true
autorestart=true
user=www-data
ooi.py is the main executable script and accepts the following launch arguments:
- --port=$TCP_port_number TCP port number OOI will listen for requests, if not specified it will default to 8000;
- --mp Toggles multithreading;
- --debug Toggles debugging output in logs, Multithreading is turned off whenever this argument is used.
- --maintain Toggles maintenance mode when you wish to take the site offline, i.e. during game maintenance.
Additional options are available as environment variables. Enter these options as a single line delimited by semicolons in the “environment=” field.
- OOI_KCS_DOMAIN: Cache redirection to another domain over HTTP;
- OOI_KCS_HTTPS_DOMAIN: Cache redirection to another domain over HTTPS;
- OOI_PROXY_HOST: Make OOI connect via an upstream proxy, useful for debugging
- OOI_PROXY_PORT: Specifies port number of the upstream proxy.
Restart supervisor after you have finished editing the config files:
service supervisor restart
If the –mp argument is used to start OOI, it is highly recommended to manually kill all processes spawned by python between restarts:
service supervisor stop
killall python3
service supervisor start
Note that error logs will be saved to in filenames beginning with ooi2-stderr...
/var/log/supervisor/
Nginx configuration example
A minimum of three configuration files is required for OOI. This example covers the basics; one can always add other functions such as TLS and caching on top of what’s shown here. In theory any http server capable of operating in reverse proxy mode will work, e.g. apache and httpd.
/etc/nginx/kcs_upstream.conf contains the source address to pull the cache files from:
upstream kcs_backend {
server 203.104.209.71:80;
server 125.6.184.15:80;
server 125.6.184.16:80;
server 125.6.187.205:80;
server 125.6.187.229:80;
server 125.6.187.253:80;
server 125.6.188.25:80;
server 203.104.248.135:80;
server 125.6.189.7:80;
server 125.6.189.39:80;
server 125.6.189.71:80;
server 125.6.189.103:80;
server 125.6.189.135:80;
server 125.6.189.167:80;
server 125.6.189.215:80;
server 125.6.189.247:80;
server 203.104.209.23:80;
server 203.104.209.39:80;
server 203.104.209.55:80;
server 203.104.209.102:80;
}
/etc/nginx/ooi2_proxy.conf defines the internal proxy between OOI and nginx:
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_connect_timeout 2m;
proxy_read_timeout 5m;
proxy_pass http://127.0.0.1:8000;
Timeouts defined here are rather conservative. In practice they could be set to 1m or shorter.
/etc/nginx/sites-enabled/ooi2.conf contains configuration for the public-facing side of OOI. Replace www.exampledomain.com in this template with your own domain name or public IP address.
include /etc/nginx/kcs_upstream.conf;
server {
listen 80;
server_name www.exampledomain.com;
location = /favicon.ico {
alias /srv/ooi2/static/img/favicon.ico;
}
location ^~ /static/ {
alias /srv/ooi2/static/;
}
location ^~ /_kcs/ {
alias /srv/_kcs/;
}
location /kcs/ {
proxy_pass http://kcs_backend;
}
location ~ /kcs/resources/image/world/(.*)\.png$ {
include /etc/nginx/ooi2_proxy.conf;
}
location = /kcs/mainD2.swf {
include /etc/nginx/ooi2_proxy.conf;
}
location / {
include /etc/nginx/ooi2_proxy.conf;
}
access_log /var/log/nginx/ooi2-access.log;
error_log /var/log/nginx/ooi2-error.log;
}
Restart nginx service after you finish editing the configuration file:
service nginx restart
Assuming you have no firewalls restricting external access to port 80, the service should now be accessible over your specific host name.
Optional: Ubuntu server comes with an easy to configure firewalld (ufw). It it highly recommended that you use it for better security.
ufw allow ssh
ufw allow http
ufw enable
Customisable components
/customize/ contains a bunch of files that could be modified to change the appearance of OOI in browser.
- title.html - Title of the main page;
- info.htm - Information panel on the right ;
- copyrigth.html - Copyright bar at the bottom of pages;
- notice.html - Information panel displayed below the embedded flash module;
- statistic.html - This is where your analytics/trackers should dwell;
Limitations and Known Issues
The following functions are not supported and unlikely to be implemented in the near term
* Facebook/Google logins
* Make purchases via the item shop
* Change signature in ranking
* Set up in-game ID (Newly registered accounts only)
Should your account ever get flagged for a password reset, you have to do it via the dmm.com website.