diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..93765c8 --- /dev/null +++ b/.gitmodules @@ -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 diff --git a/config.py b/config.py new file mode 100644 index 0000000..018ae01 --- /dev/null +++ b/config.py @@ -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' diff --git a/dash b/dash new file mode 160000 index 0000000..e99056e --- /dev/null +++ b/dash @@ -0,0 +1 @@ +Subproject commit e99056e4fb9ec966fc5f862ca9fd56a4a877a283 diff --git a/default.conf b/default.conf new file mode 100644 index 0000000..d533c62 --- /dev/null +++ b/default.conf @@ -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; + } +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2ca0a1a --- /dev/null +++ b/docker-compose.yml @@ -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 diff --git a/houdini-asyncio b/houdini-asyncio new file mode 160000 index 0000000..82d7d90 --- /dev/null +++ b/houdini-asyncio @@ -0,0 +1 @@ +Subproject commit 82d7d90c0e59f27cb17e24ce830cc791e84d16fe diff --git a/legacy-media b/legacy-media new file mode 160000 index 0000000..82eed35 --- /dev/null +++ b/legacy-media @@ -0,0 +1 @@ +Subproject commit 82eed3529ac82caccf127b254659d4d3abe125e4 diff --git a/legacy.conf b/legacy.conf new file mode 100644 index 0000000..767985c --- /dev/null +++ b/legacy.conf @@ -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; + } + +} diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..af6996d --- /dev/null +++ b/nginx.conf @@ -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/*; +} diff --git a/servers.xml b/servers.xml new file mode 100644 index 0000000..cbee56b --- /dev/null +++ b/servers.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + diff --git a/vanilla-media b/vanilla-media new file mode 160000 index 0000000..acb4b94 --- /dev/null +++ b/vanilla-media @@ -0,0 +1 @@ +Subproject commit acb4b9401609bc0cd01872be0e94d65bdc4ca03c diff --git a/vanilla.conf b/vanilla.conf new file mode 100644 index 0000000..683ff8c --- /dev/null +++ b/vanilla.conf @@ -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; + } +}