Initial commit

This commit is contained in:
Ben 2020-04-26 01:31:21 +01:00
parent af146be6a3
commit 43a1c245eb
12 changed files with 443 additions and 0 deletions

12
.gitmodules vendored Normal file
View File

@ -0,0 +1,12 @@
[submodule "houdini"]
path = houdini-asyncio
url = https://github.com/solero/houdini-asyncio
[submodule "dash"]
path = dash
url = https://github.com/solero/dash
[submodule "legacy-media"]
path = legacy-media
url = https://git.solero.me/solero/legacy-media
[submodule "vanilla-media"]
path = vanilla-media
url = https://git.solero.me/solero/vanilla-media

106
config.py Normal file
View File

@ -0,0 +1,106 @@
"""
Server bind
-----------
Here place the address and port you
would like dash to run on.
ADDRESS : str
Address to bind to.
PORT : int
Port to listen on.
"""
ADDRESS = '0.0.0.0'
PORT = 3000
"""
PostgreSQL credentials
----------------------
Here place the PostgreSQL credentials
where your Houdini database is located.
"""
POSTGRES_HOST = 'db'
POSTGRES_NAME = 'postgres'
POSTGRES_USER = 'postgres'
POSTGRES_PASSWORD = 'postgres'
"""
Google reCAPTCHA
----------------
GCAPTCHA_URL : str
Google captcha verify URL. Normally you do not need to
modify this.
GSECRET_KEY : str
Your reCAPTCHA secret key obtained from Google.
.. Google reCAPTCHA registration:
https://www.google.com/recaptcha/admin/create
"""
GCAPTCHA_URL = 'https://www.google.com/recaptcha/api/siteverify'
GSECRET_KEY = ''
"""
Player usernames
----------------
USERNAME_FORCE_CASE : bool
Force capitalized username no matter what user has
submitted.
ex:
BASIL -> Basil
APPROVE_USERNAME : bool
Approves username automatically so they do not have
to be approved by an administrator.
"""
USERNAME_FORCE_CASE = True
APPROVE_USERNAME = False
"""
Player activation
-----------------
ACTIVATE_PLAYER : bool
Activate player automatically so no email needs to be sent.
Enabling this option requires a SendGrid API key.
ACTIVATE_LINK : str
URL player is taken to for activation.
ACTIVATE_REDIRECT : str
URL to redirect to when player has activated their account
via email.
"""
ACTIVATE_PLAYER = True
ACTIVATE_LINK = 'http://secure.clubpenguin.com/create/activate/'
ACTIVATE_REDIRECT = ''
"""
Email
-----
SITE_NAME : str
The name of your site.
FROM_EMAIL : str
Will appear as the sender for emails sent via the SendGrid
API.
SENDGRID_API_KEY : str
Required for sending emails via the SendGrid API.
EMAIL_WHITELIST : list
List of email domains to accept. If set to an empty list
or `None` then dash will assume all email domains are
accepted.
MAX_ACCOUNT_EMAIL : int
Number of accounts which can be tied to a single email
address.
.. SendGrid registration:
https://signup.sendgrid.com/
"""
SITE_NAME = 'Houdini'
FROM_EMAIL = 'noreply@houdi.ni'
SENDGRID_API_KEY = ''
EMAIL_WHITELIST = ['gmail.com', 'hotmail.com']
MAX_ACCOUNT_EMAIL = 5
"""
Cryptography
------------
STATIC_KEY : str
Static key used to hash passwords. Should not be
changed unless required by login server auth.
"""
STATIC_KEY = 'houdini'

1
dash Submodule

@ -0,0 +1 @@
Subproject commit e99056e4fb9ec966fc5f862ca9fd56a4a877a283

14
default.conf Normal file
View File

@ -0,0 +1,14 @@
server {
listen 80 default_server;
server_name _;
location /play {
root /usr/share/nginx/legacy/;
index index.html index.htm;
}
location /media {
root /usr/share/nginx/legacy/;
index index.html index.htm;
}
}

159
docker-compose.yml Normal file
View File

@ -0,0 +1,159 @@
version: '3.7'
services:
db:
image: postgres:12.2-alpine
restart: always
environment:
POSTGRES_PASSWORD: postgres
networks:
- wand
ports:
- 5432:5432
volumes:
- ./houdini-asyncio/houdini.sql:/docker-entrypoint-initdb.d/houdini.sql
redis:
image: redis:5.0.9-alpine
networks:
- wand
ports:
- 6379
web:
image: nginx:1.17.10-alpine
ports:
- 80:80
networks:
- wand
links:
- dash:dash
volumes:
- ./legacy-media:/usr/share/nginx/legacy
- ./vanilla-media:/usr/share/nginx/vanilla
- ./default.conf:/etc/nginx/conf.d/default.conf
- ./legacy.conf:/etc/nginx/conf.d/legacy.conf
- ./vanilla.conf:/etc/nginx/conf.d/vanilla.conf
houdini_login:
build: ./houdini-asyncio
image: houdini
networks:
- wand
ports:
- 6112:6112
volumes:
- ./houdini-asyncio:/usr/src/houdini
depends_on:
- db
- redis
links:
- db:db
- redis:redis
command: ["dockerize", "-wait", "tcp://db:5432", "-wait", "tcp://redis:6379", "-wait-retry-interval", "3s",
"python", "bootstrap.py", "login",
"--redis-address", "redis",
"--database-address", "db",
"--database-user", "postgres",
"--database-password", "postgres"]
houdini_blizzard:
image: houdini
networks:
- wand
ports:
- 9875:9875
volumes:
- ./houdini-asyncio:/usr/src/houdini
depends_on:
- houdini_login
links:
- db:db
- redis:redis
command: ["dockerize", "-wait", "tcp://db:5432", "-wait", "tcp://redis:6379", "-wait-retry-interval", "3s",
"python", "bootstrap.py", "world",
"--redis-address", "redis",
"--database-address", "db",
"--database-user", "postgres",
"--database-password", "postgres"]
houdini_glaciar:
image: houdini
networks:
- wand
ports:
- 9876:9876
volumes:
- ./houdini-asyncio:/usr/src/houdini
depends_on:
- houdini_login
links:
- db:db
- redis:redis
command: ["dockerize", "-wait", "tcp://db:5432", "-wait", "tcp://redis:6379", "-wait-retry-interval", "3s",
"python", "bootstrap.py", "world",
"-id", "3101", "--name", "glaciar", "--port", "9876", "--lang", "es",
"--redis-address", "redis",
"--database-address", "db",
"--database-user", "postgres",
"--database-password", "postgres"]
houdini_avalanche:
image: houdini
networks:
- wand
ports:
- 9877:9877
volumes:
- ./houdini-asyncio:/usr/src/houdini
depends_on:
- houdini_login
links:
- db:db
- redis:redis
command: ["dockerize", "-wait", "tcp://db:5432", "-wait", "tcp://redis:6379", "-wait-retry-interval", "3s",
"python", "bootstrap.py", "world",
"-id", "3102", "--name", "avalanche", "--port", "9877", "--lang", "pt",
"--redis-address", "redis",
"--database-address", "db",
"--database-user", "postgres",
"--database-password", "postgres"]
houdini_yeti:
image: houdini
networks:
- wand
ports:
- 9878:9878
volumes:
- ./houdini-asyncio:/usr/src/houdini
depends_on:
- houdini_login
links:
- db:db
- redis:redis
command: ["dockerize", "-wait", "tcp://db:5432", "-wait", "tcp://redis:6379", "-wait-retry-interval", "3s",
"python", "bootstrap.py", "world",
"-id", "3103", "--name", "yeti", "--port", "9878", "--lang", "fr",
"--redis-address", "redis",
"--database-address", "db",
"--database-user", "postgres",
"--database-password", "postgres"]
dash:
build: ./dash
networks:
- wand
ports:
- 3000
volumes:
- ./dash:/usr/src/dash
- ./config.py:/usr/src/dash/config.py
depends_on:
- db
- redis
links:
- db:db
command: dockerize -wait tcp://db:5432 python bootstrap.py -c config.py
networks:
wand:
driver: bridge

1
houdini-asyncio Submodule

@ -0,0 +1 @@
Subproject commit 82d7d90c0e59f27cb17e24ce830cc791e84d16fe

1
legacy-media Submodule

@ -0,0 +1 @@
Subproject commit 82eed3529ac82caccf127b254659d4d3abe125e4

34
legacy.conf Normal file
View File

@ -0,0 +1,34 @@
server {
server_name play.*;
location / {
root /usr/share/nginx/legacy/play;
index index.html index.htm;
}
location /create_account/create_account.php {
proxy_pass http://dash:3000/create;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /create/activate {
proxy_pass http://localhost:3000/create/activate;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
server_name media.*;
location / {
root /usr/share/nginx/legacy/media;
index index.html index.htm;
}
}

58
nginx.conf Normal file
View File

@ -0,0 +1,58 @@
user nginx;
pid /run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 65535;
events {
multi_accept on;
worker_connections 65535;
}
http {
charset utf-8;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
log_not_found off;
types_hash_max_size 2048;
client_max_body_size 16M;
include mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log warn;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_dhparam /etc/nginx/dhparam.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_stapling on;
ssl_stapling_verify on;
resolver 1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220 valid=60s;
resolver_timeout 2s;
server {
listen 80 default_server;
server_name _;
location /play {
root /usr/share/nginx/legacy/play;
index index.html index.htm;
}
location /media {
root /usr/share/nginx/legacy/media;
index index.html index.htm;
}
}
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

22
servers.xml Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!---
Eventually the clients will all look here to establish a connection to
houdini. Right now, this file is redundant.
--->
<servers>
<environment name="stage">
<login address="127.0.0.1" port="6112" />
<language locale="en">
<server id="3100" name="Blizzard" safe="false" address="127.0.0.1" port="9875" />
</language>
<language locale="es">
<server id="3101" name="Glaciar" safe="false" address="127.0.0.1" port="9876" />
</language>
<language locale="pt">
<server id="3102" name="Avalanche" safe="false" address="127.0.0.1" port="9877" />
</language>
<language locale="fr">
<server id="3103" name="Yeti" safe="false" address="127.0.0.1" port="9878" />
</language>
</environment>
</servers>

1
vanilla-media Submodule

@ -0,0 +1 @@
Subproject commit acb4b9401609bc0cd01872be0e94d65bdc4ca03c

34
vanilla.conf Normal file
View File

@ -0,0 +1,34 @@
server {
server_name new.*;
location / {
root /usr/share/nginx/vanilla/play;
index index.html index.htm;
}
location ~ ^/avatar/(.*)/cp$ {
proxy_pass http://dash:3000/avatar/$1$is_args$args;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
server_name vanilla.*;
location / {
root /usr/share/nginx/vanilla/media;
index index.html index.htm;
}
location /social/autocomplete/v2/search/suggestions {
proxy_pass http://localhost:3000/autocomplete;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}