full code
This commit is contained in:
34
setup/conf/initconf.json
Normal file
34
setup/conf/initconf.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"dns": ["devfarm-ants"],
|
||||
"towns": [
|
||||
{ "townId": "wall", "nationId": "ants", "dns": "wall-ants.ndda.fr" }
|
||||
],
|
||||
"api": {
|
||||
"port": 3020,
|
||||
"languages": ["en", "fr"],
|
||||
"exposedHeaders": ["xdays", "xhash", "xalias", "xlang", "xtribe", "xapp","xuuid"],
|
||||
"nationObjects": [
|
||||
"schema",
|
||||
"blocks",
|
||||
"nations",
|
||||
"towns",
|
||||
"tribes",
|
||||
"pagans"
|
||||
],
|
||||
"unittesting": ["middlewares", "models", "routes", "nationchains"],
|
||||
"appset": { "trust proxy": true },
|
||||
"bodyparse": {
|
||||
"urlencoded": {
|
||||
"limit": "50mb",
|
||||
"extended": true
|
||||
},
|
||||
"json": { "limit": "500mb" }
|
||||
}
|
||||
},
|
||||
"nginx": {
|
||||
"restart": "sudo systemctl restart nginx",
|
||||
"worker_connections": 1024,
|
||||
"include": ["/etc/nginx/conf.d/*.conf"],
|
||||
"pageindex": "index_en.html"
|
||||
}
|
||||
}
|
43
setup/conf/nginx.conf.mustache
Executable file
43
setup/conf/nginx.conf.mustache
Executable file
@@ -0,0 +1,43 @@
|
||||
user {{{sudoerUser}}};
|
||||
worker_processes auto;
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
#include /etc/nginx/modules-enabled/*.conf;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$time_iso8601###$status###$request';
|
||||
|
||||
log_format tracker escape=json
|
||||
'{"time":"$time_iso8601","alias":"$arg_alias","uuid":"$arg_uuid",'
|
||||
'"lg":"$arg_lg","consentcookie":"$arg_consentcookie","version":"$arg_version",'
|
||||
'"srckey":"$arg_srckey","request_filename":"$request_filename",'
|
||||
'"remoteaddr":"$remote_addr","httpxforwardedfor":"$http_x_forwarded_for",'
|
||||
'"httpreferer":"$http_referer","httpuseragent":"$http_user_agent","request":"$request"}';
|
||||
|
||||
log_format mainold '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_buffers 4 32k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/x-font-ttf application/javascript font/eot font/opentype image/svg+xml image/x-icon text/plain;
|
||||
|
||||
##
|
||||
# Virtual Host Configs
|
||||
##
|
||||
{{#nginx.include}}
|
||||
include {{{.}}};
|
||||
{{/nginx.include}}
|
||||
}
|
97
setup/conf/nginxmodelwebsite.conf.mustache
Executable file
97
setup/conf/nginxmodelwebsite.conf.mustache
Executable file
@@ -0,0 +1,97 @@
|
||||
server {
|
||||
server_name {{#dns}} {{.}} {{/dns}};
|
||||
access_log {{{nginx.logs}}}.access.log main;
|
||||
|
||||
set $trackme 0;
|
||||
if ( $uri ~ ^/trk/ ){
|
||||
set $trackme 1;
|
||||
}
|
||||
access_log {{{nginx.logs}}}.trk.log tracker if=$trackme ;
|
||||
location ~* /trk/ {
|
||||
if ( $uri ~ ^/trk/redirect ){
|
||||
return 301 $arg_url;
|
||||
}
|
||||
rewrite ^/trk/(.*)$ /$1;
|
||||
}
|
||||
|
||||
location /Checkjson.js {
|
||||
alias {{{dirapi}}}/api/models/Checkjson.js;
|
||||
}
|
||||
location ~* /nationchains/(blocks|pagans|towns|nations)/ {
|
||||
# Warning: never add tribes for keeping it private
|
||||
root {{{dirapi}}}/;
|
||||
}
|
||||
location ~* /nationchains/models/ {
|
||||
rewrite /nationchains/models/(.*$) /$1 break;
|
||||
root {{{dirapi}}}/api/models/lg/;
|
||||
}
|
||||
location ~* /nationchains/schema/ {
|
||||
#outside of nationchains for git purpose
|
||||
rewrite /nationchains/schema/(.*$) /$1 break;
|
||||
root {{{dirapi}}}/adminapi/schema/;
|
||||
}
|
||||
location ~* /{{tribeId}}/schema/{
|
||||
rewrite /{{tribeId}}/schema/(.*$) /$1 break;
|
||||
root {{dirtown}}/tribes/{{tribeId}}/schema/;
|
||||
}
|
||||
|
||||
location ~* /{{tribeId}}/models/{
|
||||
rewrite /{{tribeId}}/models/(.*$) /$1 break;
|
||||
root {{dirtown}}/tribes/{{tribeId}}/api/models/lg/;
|
||||
}
|
||||
|
||||
# /plugins/pluginame/components/xxx?plugin=pluginname&pluginkey=key
|
||||
# acess if exist pluginkey
|
||||
location /plugins/ {
|
||||
add_header X-debug "plugins local $arg_plugin/keys/$arg_pluginkey sent";
|
||||
root {{{nginx.fswww}}}/plugins/;
|
||||
if (-f {{{nginx.fswww}}}/plugins/$arg_plugin/keys/$arg_pluginkey) {
|
||||
rewrite /plugins/([^/]+)/components/([^\?]+) /$1/components/$2 break;
|
||||
}
|
||||
return 403 "No valid token access for plugin:$arg_plugin with token:$arg_pluginkey please ask your admin";
|
||||
}
|
||||
|
||||
location /cdn/ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public";
|
||||
rewrite /cdn/(.*$) /$1 break;
|
||||
root {{{nginx.fswww}}}/cdn/;
|
||||
}
|
||||
|
||||
location /spacedev/ {
|
||||
rewrite /spacedev/(.*$) /$1 break;
|
||||
root {{{nginx.fswww}}}spacedev/{{{nginx.website}}}/dist/;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
rewrite /api/(.*$) /$1 break;
|
||||
proxy_pass http://localhost:{{{api.port}}};
|
||||
proxy_redirect off;
|
||||
include proxy_params;
|
||||
}
|
||||
|
||||
location /apxwebapp/ {
|
||||
rewrite /apxwebapp/(.*$) /$1 break;
|
||||
root {{{dirapxwebapp}}}/apxwebapp/;
|
||||
index index.html index_en.html;
|
||||
}
|
||||
|
||||
#to add htpasswd install apache2-utils => sudo htpasswd -c dirtown/tribes/tribeId/.htpasswd loginname passwd see man for
|
||||
option
|
||||
|
||||
location / {
|
||||
{{#nginx.private}}
|
||||
auth_basic "Mot de passe {{nginx.privatelogin}}";
|
||||
auth_basic_user_file {{dirtown}}/tribes/{{tribeId}}/.htpasswd;
|
||||
{{/nginx.private}}
|
||||
root {{{nginx.fswww}}}/{{{nginx.website}}};
|
||||
index index.html {{{nginx.pageindex}}};
|
||||
}
|
||||
error_page 404 /404.html;
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/local/nginx/html;
|
||||
}
|
||||
}
|
11
setup/conf/nginxproxyparams.mustache
Normal file
11
setup/conf/nginxproxyparams.mustache
Normal file
@@ -0,0 +1,11 @@
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
client_max_body_size 10m;
|
||||
client_body_buffer_size 128k;
|
||||
proxy_connect_timeout 90;
|
||||
proxy_send_timeout 90;
|
||||
proxy_read_timeout 90;
|
||||
proxy_buffers 32 4k;
|
||||
proxy_set_header X-NginX-Proxy true;
|
1
setup/conf/setup_xx.json
Normal file
1
setup/conf/setup_xx.json
Normal file
@@ -0,0 +1 @@
|
||||
{"nationId":"ants","townId":"devfarm","dns":"devfarm-ants","comment":"Auto generate setup from apxtri after node apxtri nationId:value townId:value dns:domaine_to_access","mayorId":"philc"}
|
Reference in New Issue
Block a user