ready to serve

beta.r3js.org
cybafelo 2019-06-11 19:02:02 +00:00
parent 9752611b6d
commit 5f2d9509ba
5 changed files with 83 additions and 83 deletions

View File

@ -2,15 +2,13 @@ var environment = {
path : '/usr/share/cybafelo', path : '/usr/share/cybafelo',
protocol : 'https', protocol : 'https',
websocketProtocol : 'wss', websocketProtocol : 'wss',
websocketApp : 'r3-websocket', websocketApp : 'websocket',
context : 'dev', domain : 'r3js.org',
domain : 'cybafelo.local',
remoteDomain : 'cybafelo.com', remoteDomain : 'cybafelo.com',
remoteEnvironment : 'live' remoteEnvironment : 'live'
}; };
var protocol = environment.protocol; var protocol = environment.protocol;
var context = environment.context;
var domain = environment.domain; var domain = environment.domain;
var remoteDomain = environment.remoteDomain; var remoteDomain = environment.remoteDomain;
var remoteEnvironment = environment.remoteEnvironment; var remoteEnvironment = environment.remoteEnvironment;
@ -19,7 +17,7 @@ var websocketApp = environment.websocketApp;
var config = { var config = {
editor: { editor: {
url: protocol + '://' + context + '-r3-3ditor.' + domain, url: protocol + '://editor.' + domain,
default: { default: {
platform: 'cybafelo', platform: 'cybafelo',
account: 'root', account: 'root',
@ -28,7 +26,7 @@ var config = {
} }
}, },
api: { api: {
url: protocol + '://' + context + '-r3-api.' + domain, url: protocol + '://api.' + domain,
remoteUrl: protocol + '://' + remoteEnvironment + '-r3-api.' + remoteDomain, remoteUrl: protocol + '://' + remoteEnvironment + '-r3-api.' + remoteDomain,
uploadPath: '/uploads', uploadPath: '/uploads',
clientPassword: '"kent sent me" motherfucker!' clientPassword: '"kent sent me" motherfucker!'
@ -36,13 +34,12 @@ var config = {
websocket: { websocket: {
protocol : websocketProtocol, protocol : websocketProtocol,
domain : domain, domain : domain,
context : context,
application: websocketApp, application: websocketApp,
host : context + '-' + websocketApp + '.' + domain, host : websocketApp + '.' + domain,
url : websocketProtocol + '://' + context + '-' + websocketApp + '.' + domain url : websocketProtocol + '://' + websocketApp + '.' + domain
}, },
portal: { portal: {
url: protocol + '://' + context + '-r3-portal.' + domain url: protocol + '://portal.' + domain
}, },
db: {}, db: {},
environment : environment environment : environment

8
hosts
View File

@ -9,7 +9,7 @@
# the app has to have a 1 to 1 mapping to the folder name which you cloned from the repo: # the app has to have a 1 to 1 mapping to the folder name which you cloned from the repo:
127.0.1.1 dev-r3-3ditor.cybafelo.local 127.0.1.1 editor.r3js.org
127.0.1.1 dev-r3-portal.cybafelo.local 127.0.1.1 portal.r3js.org
127.0.1.1 dev-r3-api.cybafelo.local 127.0.1.1 api.r3js.org
127.0.1.1 dev-r3-websocket.cybafelo.local 127.0.1.1 websocket.r3js.org

View File

@ -1,76 +1,77 @@
# Define our node ports # Define our node ports
upstream r3-api { upstream api {
server 127.0.0.1:3104; server 127.0.0.1:3104;
} }
upstream r3-websocket { upstream websocket {
server 127.0.0.1:3105; server 127.0.0.1:3105;
} }
upstream php { upstream php {
server 127.0.0.1:9001; server 127.0.0.1:9001;
} }
# Now define our sites # Now define our sites
server { server {
listen 443 ssl default_server; listen 443 ssl default_server;
listen 80 default_server; listen 80 default_server;
listen [::]:80 default_server ipv6only=on; listen [::]:80 default_server ipv6only=on;
ssl_certificate /etc/letsencrypt/live/r3js.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/r3js.org/privkey.pem;
ssl_certificate /usr/share/cybafelo/r3-config/cybafelo.local.cert.pem; ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate_key /usr/share/cybafelo/r3-config/cybafelo.local.key.pem; ssl_ciphers HIGH:!aNULL:!MD5;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
client_max_body_size 20M; client_max_body_size 20M;
server_name ~^(?<environment>.*?)-(?<app>.*?)\.(?<host_domain>.*); server_name ~^(?<app>.*?)\.(?<host_domain>.*);
root /usr/share/cybafelo/$app; root /usr/share/cybafelo/r3js.org/$app;
location ~ \.php$ { location ~ \.php$ {
if ($request_method = OPTIONS) {
add_header Access-Control-Allow-Origin $http_origin;
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS";
add_header Access-Control-Allow-Headers "Authorization, Content-Type, x-authorization";
add_header Access-Control-Allow-Credentials true;
return 200;
}
add_header Access-Control-Allow-Origin $http_origin; if ($request_method = OPTIONS) {
add_header Access-Control-Allow-Origin $http_origin;
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS";
add_header Access-Control-Allow-Headers "Authorization, Content-Type, x-authorization";
add_header Access-Control-Allow-Credentials true;
return 200;
}
add_header Access-Control-Allow-Origin $http_origin;
add_header Access-Control-Allow-Credentials true; add_header Access-Control-Allow-Credentials true;
fastcgi_pass php; fastcgi_pass php;
fastcgi_index index.php; fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_URL $request_uri; fastcgi_param SCRIPT_URL $request_uri;
fastcgi_param SERVER_NAME $http_host; fastcgi_param SERVER_NAME $http_host;
include fastcgi_params; include fastcgi_params;
} }
location = / { location = / {
if ($request_method = OPTIONS) { if ($request_method = OPTIONS) {
add_header Access-Control-Allow-Origin $http_origin; add_header Access-Control-Allow-Origin $http_origin;
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"; add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS";
add_header Access-Control-Allow-Headers "Authorization, Content-Type, x-authorization"; add_header Access-Control-Allow-Headers "Authorization, Content-Type, x-authorization";
add_header Access-Control-Allow-Credentials true; add_header Access-Control-Allow-Credentials true;
return 200; return 200;
} }
add_header Access-Control-Allow-Origin $http_origin; add_header Access-Control-Allow-Origin $http_origin;
add_header Access-Control-Allow-Credentials true; add_header Access-Control-Allow-Credentials true;
try_files /index.html @node; try_files /index.html @node;
} }
location ~ { location ~ {
if ($request_method = OPTIONS) { if ($request_method = OPTIONS) {
add_header Access-Control-Allow-Origin $http_origin; add_header Access-Control-Allow-Origin $http_origin;
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"; add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS";
add_header Access-Control-Allow-Headers "Authorization, Content-Type, x-authorization"; add_header Access-Control-Allow-Headers "Authorization, Content-Type, x-authorization";
add_header Access-Control-Allow-Credentials true; add_header Access-Control-Allow-Credentials true;
return 200; return 200;
} }
add_header Access-Control-Allow-Origin $http_origin; add_header Access-Control-Allow-Origin $http_origin;
add_header Access-Control-Allow-Credentials true; add_header Access-Control-Allow-Credentials true;
add_header X-Content-Type-Options "nosniff"; add_header X-Content-Type-Options "nosniff";
@ -78,30 +79,30 @@ server {
} }
location @node { location @node {
add_header Access-Control-Allow-Credentials true; add_header Access-Control-Allow-Credentials true;
# WebSocket support # WebSocket support
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
# Normal parameters # Normal parameters
proxy_pass_request_headers on; proxy_pass_request_headers on;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true; proxy_set_header X-NginX-Proxy true;
# Set Environment, App, and Domain # Set Environment, App, and Domain
proxy_set_header X-R3-Env $environment; proxy_set_header X-R3-Env live;
proxy_set_header X-R3-App $app; proxy_set_header X-R3-App $app;
proxy_set_header X-R3-Host $host_domain; proxy_set_header X-R3-Host $host_domain;
# Pass Everything to our app # Pass Everything to our app
proxy_pass http://$app; proxy_pass http://$app;
proxy_ssl_session_reuse off; proxy_ssl_session_reuse off;
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_redirect off; proxy_redirect off;
} }
} }

View File

@ -1,3 +1,4 @@
#!/bin/bash #!/bin/bash
cd /usr/share/cybafelo/r3-api cd /usr/share/cybafelo/r3-api
pm2 start bin/start --node-args="--inspect=3204" --name "r3-api" #pm2 start bin/start --node-args="--inspect=3204" --name "r3-api"
pm2 start bin/start --name "r3-api"

View File

@ -1,3 +1,4 @@
#!/bin/bash #!/bin/bash
cd /usr/share/cybafelo/r3-websocket cd /usr/share/cybafelo/r3-websocket
pm2 start index.js --node-args="--inspect=3205" --name "r3-websocket" #pm2 start index.js --node-args="--inspect=3205" --name "r3-websocket"
pm2 start index.js --name "r3-websocket"