diff --git a/3d-editor.conf b/3d-editor.conf index dd15c76..e913ec0 100644 --- a/3d-editor.conf +++ b/3d-editor.conf @@ -1,30 +1,19 @@ +#origin git@github.com:ToywheelDev/3d_editor.git server { listen 80; - listen 443 ssl; - + server_name 3d-editor.gamewheel.local 3d-editor-debug.gamewheel.local; - root /srv/gamewheel.local/3d-editor; - index index.html; + root /usr/share/gamewheel/gw_3d_editor; - access_log /var/log/nginx/3d-editor.gamewheel.local.access.log; - error_log /var/log/nginx/3d-editor.gamewheel.local.error.log; - - ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem; - ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key; - ssl_session_timeout 5m; - ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; - ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES"; - ssl_prefer_server_ciphers on; - -# location ~ \.php$ { -# fastcgi_pass 127.0.0.1:9001; -# fastcgi_index index.php; -# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; -# fastcgi_param SCRIPT_URL $request_uri; -# fastcgi_param SERVER_NAME $http_host; -# include fastcgi_params; -# } + location ~ \.php$ { + fastcgi_pass 127.0.0.1:9001; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param SCRIPT_URL $request_uri; + fastcgi_param SERVER_NAME $http_host; + include fastcgi_params; + } location / { add_header Access-Control-Allow-Origin $http_origin; @@ -33,14 +22,13 @@ server { } location @node { - proxy_pass_request_headers on; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-NginX-Proxy true; - # Replace here with proper host/port - proxy_pass http://127.0.0.1:3103; - proxy_ssl_session_reuse off; - proxy_set_header Host $http_host; - proxy_redirect off; + proxy_pass_request_headers on; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://127.0.0.1:3103; + proxy_ssl_session_reuse off; + proxy_set_header Host $http_host; + proxy_redirect off; } } diff --git a/3d-racing.conf b/3d-racing.conf new file mode 100644 index 0000000..90154fe --- /dev/null +++ b/3d-racing.conf @@ -0,0 +1,27 @@ +#origin https://github.com/ToywheelDev/3d-racing.git +server { + listen 80; + + server_name 3d-racing.gamewheel.local 3d-racing-debug.gamewheel.local; + + root /usr/share/gamewheel/3d-racing; + + index index.html; + + location / { + add_header Access-Control-Allow-Origin $http_origin; + autoindex on; + try_files $uri $uri/ @node; + } + + location @node { + proxy_pass_request_headers on; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://127.0.0.1:3102; + proxy_ssl_session_reuse off; + proxy_set_header Host $http_host; + proxy_redirect off; + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..20303fc --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +#Configuration Package for Gamewheel +This is a central repository which aims to be a replacement +for all configuration packages. + +Every configuration lies in a different branch. + +Each branch corresponds to a server configuration, ex. tj-dev is for +TJ's dev machine. + +gw-3d should be deployed on the gw-3d server + +if we have a gw-3d-beta server, this branch would be called gw-3d-beta + +and so on. + +Secure (Sensitive configuration options) go into secure.js. + +public configuration options go into config.js. + +config.js is linked to from every other package via symbolic link. + +When config.js is required server side, it is automatically merged +with secure.js in order to produce a global server side configuration, +whilst only exposing config.js public to client side. \ No newline at end of file diff --git a/api-runtime.conf b/api-runtime.conf new file mode 100644 index 0000000..ced8b3d --- /dev/null +++ b/api-runtime.conf @@ -0,0 +1,69 @@ +#origin git@github.com:ToywheelDev/GW_Runtime.git +#origin git@github.com:ToywheelDev/gw-statistic.git +server { + listen 80; + + server_name api-runtime.gamewheel.local; + + #root /usr/share/gamewheel/GW_Runtime - port 3108 (old api runtime) + #root /usr/share/gamewheel/gw-statistic - port 3109 (new api runtime) + + location /lead/trigger/ { + auth_basic "Restricted"; #For Basic Auth + auth_basic_user_file /etc/nginx/.htpasswd; #For Basic Auth + proxy_pass_request_headers on; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://127.0.0.1:3109; + proxy_ssl_session_reuse off; + proxy_set_header Host $http_host; + proxy_redirect off; + proxy_read_timeout 99999s; + proxy_connect_timeout 99999s; + proxy_send_timeout 99999s; + } + + location /form { + proxy_pass_request_headers on; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://127.0.0.1:3108; + proxy_ssl_session_reuse off; + proxy_set_header Host $http_host; + proxy_redirect off; + proxy_read_timeout 99999s; + proxy_connect_timeout 99999s; + proxy_send_timeout 99999s; + } + + location /lead { + proxy_pass_request_headers on; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://127.0.0.1:3108; + proxy_ssl_session_reuse off; + proxy_set_header Host $http_host; + proxy_redirect off; + proxy_read_timeout 99999s; + proxy_connect_timeout 99999s; + proxy_send_timeout 99999s; + } + + location / { + proxy_pass_request_headers on; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://127.0.0.1:3109; + proxy_ssl_session_reuse off; + proxy_set_header Host $http_host; + proxy_redirect off; + proxy_read_timeout 99999s; + proxy_connect_timeout 99999s; + proxy_send_timeout 99999s; + } +} + diff --git a/api.conf b/api.conf new file mode 100644 index 0000000..a27fd68 --- /dev/null +++ b/api.conf @@ -0,0 +1,25 @@ +#origin git@github.com:ToywheelDev/gamewheel-api.git +server { + listen 80; + + server_name api.gamewheel.local; + + root /usr/share/gamewheel/api; + + location / { + add_header Access-Control-Allow-Origin $http_origin; + autoindex on; + try_files $uri $uri/ @node; + } + + location @node { + proxy_pass_request_headers on; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://127.0.0.1:3107; + proxy_ssl_session_reuse off; + proxy_set_header Host $http_host; + proxy_redirect off; + } +} diff --git a/api16.conf b/api16.conf new file mode 100644 index 0000000..ed97c13 --- /dev/null +++ b/api16.conf @@ -0,0 +1,25 @@ +#origin git@github.com:ToywheelDev/GW_Config.git +server { + listen 80; + + server_name api16.gamewheel.local; + + root /usr/share/gamewheel/GW_Config; + + location / { + add_header Access-Control-Allow-Origin $http_origin; + autoindex on; + try_files $uri $uri/ @node; + } + + location @node { + proxy_pass_request_headers on; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://127.0.0.1:3104; + proxy_ssl_session_reuse off; + proxy_set_header Host $http_host; + proxy_redirect off; + } +} diff --git a/app.conf b/app.conf new file mode 100644 index 0000000..d0b2fd9 --- /dev/null +++ b/app.conf @@ -0,0 +1,19 @@ +#origin git@github.com:ToywheelDev/gw-app.git +server { + listen 80; + + server_name app.gamewheel.local; + + root /usr/share/gamewheel/gw-app/dist; + + location / { + proxy_pass_request_headers on; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://127.0.0.1:3106; + proxy_ssl_session_reuse off; + proxy_set_header Host $http_host; + proxy_redirect off; + } +} diff --git a/config.js b/config.js index 6b78ebf..4b2e604 100644 --- a/config.js +++ b/config.js @@ -1,65 +1,66 @@ var config = { vr_pong: { - url: "http://pong", - port: 3101, - debugPort: 3201 + url: "http://pong.gamewheel.com" }, vr_racer: { - url: "http://racer", - port: 3102, - debugPort: 3202 + url: "http://racer.gamewheel.com" }, editor: { url: "http://3d-editor.gamewheel.com", - port: 3103, - debugPort: 3203, - cluster: false, default: { platform: 'gamewheel', account: 'root', subAccount: 'root' }, - uploadPath : '/uploads' + uploadPath: '/uploads' }, api16: { url: "http://api16.gamewheel.com", - port: 3104, - debugPort: 3204, - cluster: false, - cors: false, - mailer: { - host: 'localhost', - port: 9025, - secure: false, - debug: true, - ignoreTLS: true - }, - mongodb: { - host: 'mongodb://127.0.0.1', - db: 'gamewheel', - port: 27017, - shardPort: 27018, - options: { - db: { - native_parser: true - }, - server: { - poolSize: 5, - keepAlive: 120 - }, - user: '', - pass: '', - autoIndex: false - } - }, - sessionKey: 'iJswK29klj20Jos02mJK8ud9239j23' + }, + tools: { + url: "http://tools.gamewheel.com", + default: { + platform: 'gamewheel', + account: 'root', + subAccount: 'root' + } + }, + app: { + url: 'http://app.gamewheel.com' + }, + api: { + url: 'http://api.gamewheel.com' + }, + api_runtime: { + url: 'http://api-runtime.gamewheel.com', + version: "1.0.0" + }, + masker: { + url: 'http://masker.gamewheel.com' + }, + statistics: { + url: 'http://api-runtime.gamewheel.com' + }, + port: { + url: 'http://port.gamewheel.com' + }, + gate: { + url: 'http://gate.gamewheel.com' }, environment: { - mode : 'production' + mode: 'production' } }; if (typeof module !== 'undefined') { + + if (typeof require !== 'undefined') { + var secure = require('./secure'); + var _ = require('lodash'); + + _.merge(config, secure); + } + module.exports = config; } diff --git a/gate.conf b/gate.conf new file mode 100644 index 0000000..b537eba --- /dev/null +++ b/gate.conf @@ -0,0 +1,25 @@ +#origin git@github.com:ToywheelDev/gamewheel-gate.git +server { + listen 80; + + server_name gate.gamewheel.local; + + root /usr/share/gamewheel/gate; + + location / { + add_header Access-Control-Allow-Origin $http_origin; + autoindex on; + try_files $uri $uri/ @node; + } + + location @node { + proxy_pass_request_headers on; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://127.0.0.1:3111; + proxy_ssl_session_reuse off; + proxy_set_header Host $http_host; + proxy_redirect off; + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..3b7fb62 --- /dev/null +++ b/package.json @@ -0,0 +1,12 @@ +{ + "name": "gamewheel-config", + "version": "0.0.1", + "author": "Theunis J. Botha", + "description": "Tools for Gamewheel", + "repository": "https://github.com/ToywheelDev/config.git", + "license": "UNLICENSED", + "readme": "README.md", + "dependencies": { + "lodash": "^4.16.6" + } +} diff --git a/port.conf b/port.conf new file mode 100644 index 0000000..1738fe6 --- /dev/null +++ b/port.conf @@ -0,0 +1,25 @@ +#origin git@github.com:ToywheelDev/gamewheel-port.git +server { + listen 80; + + server_name port.gamewheel.local; + + root /usr/share/gamewheel/port; + + location / { + add_header Access-Control-Allow-Origin $http_origin; + autoindex on; + try_files $uri $uri/ @node; + } + + location @node { + proxy_pass_request_headers on; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://127.0.0.1:3110; + proxy_ssl_session_reuse off; + proxy_set_header Host $http_host; + proxy_redirect off; + } +} diff --git a/secure.js b/secure.js new file mode 100644 index 0000000..dc697e5 --- /dev/null +++ b/secure.js @@ -0,0 +1,154 @@ +var secure = { + vr_pong: { + port: 3101, + debugPort: 3201 + }, + vr_racer: { + port: 3102, + debugPort: 3202 + }, + editor: { + port: 3103, + debugPort: 3203, + cluster: false + }, + api16: { + port: 3104, + debugPort: 3204, + cluster: false, + cors: false, + mailer: { + host: 'localhost', + port: 9025, + secure: false, + debug: true, + ignoreTLS: true + }, + mongodb: { + host: 'mongodb://127.0.0.1', + db: 'gamewheel', + port: 27017, + shardPort: 27018, + options: { + db: { + native_parser: true + }, + server: { + poolSize: 5, + keepAlive: 120 + }, + user: '', + pass: '', + autoIndex: false + } + }, + sessionKey: 'iJswK29klj20Jos02mJK8ud9239j23' + }, + tools: { + port: 3105, + debugPort: 3205, + liveReloadPort: 3405, + mysqlUserExport: { + host: "127.0.0.1", + port: 3306, + user: "root", + password: "", + database: "gw_core" + }, + mongoUserImport: { + host: "127.0.0.1", + port: 27017, + options: { + user: '', + pass: '' + } + } + }, + app: { + port: 3106, + debugPort: 3206, + liveReloadPort: 3406 + }, + api: { + port: 3107, + debugPort: 3207, + liveReloadPort: 3407, + mongodb: { + host: 'mongodb://127.0.0.1', + db: 'apidev', + port: 27017, + shardPort: 27018, + options: { + db: { + native_parser: true + }, + server: { + poolSize: 5, + keepAlive: 120 + }, + user: '', + pass: '', + autoIndex: false + } + }, + mailer: { + host: 'localhost', + port: 9025, + secure: false, + debug: true, + ignoreTLS: true + }, + sessionKey: 'iJswK29klj20Jos02mJK8ud9239j23' + }, + api_runtime: { + port: 3108, + debugPort: 3208, + liveReloadPort: 3408, + cors: true, + cluster: false, + auth: { + secret: "xDKsyQm2F52Y9hfqv7yG80tu1wv90zkH", + token_duration: 86400000, + api_key: "gw_rocks", + admin: { + email: "admin@gamewheel.com", + password: "gw_config_api_rocks" + } + }, + db: { + type: "mysql", + host: "127.0.0.1", + port: 3306, + database: "gw_core", + user: "root", + password: "", + max_connections: 10 + }, + game_session_timeout: 180000 + }, + masker: { + auth_key: "gw_masker_rocks" + }, + statistics: { + port: 3109, + debugPort: 3209, + liveReloadPort: 3409, + mongodb: { + host: 'mongodb://127.0.0.1', + db: 'statistic' + } + }, + port: { + port: 3110, + debugPort: 3210 + }, + gate: { + port: 3111, + debugPort: 3211 + } +}; + +if (typeof module !== 'undefined') { + module.exports = secure; +} + diff --git a/tools.conf b/tools.conf new file mode 100644 index 0000000..e857551 --- /dev/null +++ b/tools.conf @@ -0,0 +1,34 @@ +#origin git@github.com:ToywheelDev/tools.git +server { + listen 80; + + server_name tools.gamewheel.local tools-debug.gamewheel.local; + + root /usr/share/gamewheel/tools; + + location ~ \.php$ { + fastcgi_pass 127.0.0.1:9001; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param SCRIPT_URL $request_uri; + fastcgi_param SERVER_NAME $http_host; + include fastcgi_params; + } + + location / { + add_header Access-Control-Allow-Origin $http_origin; + autoindex on; + try_files $uri $uri/ @node; + } + + location @node { + proxy_pass_request_headers on; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-NginX-Proxy true; + proxy_pass http://127.0.0.1:3105; + proxy_ssl_session_reuse off; + proxy_set_header Host $http_host; + proxy_redirect off; + } +}