1
0
forked from apxtri/apxtri

modif setup

This commit is contained in:
philc 2023-12-10 08:33:09 +01:00
parent b2fccb1189
commit ed8a747b0b
11 changed files with 110 additions and 56 deletions

View File

@ -17,15 +17,10 @@ See [apxtri web site](https://apxtri.crabdance.com) how to create a new social w
All actors will have the same target to respect contracts and are free to leave or to stay into a nation, a town or a tribe. If a contract is not fair, then a nation, tribe, will be empty mean not creating value mean die. Only fair rules will survive but any try will rewards actor with XTRIB coin. All actors will have the same target to respect contracts and are free to leave or to stay into a nation, a town or a tribe. If a contract is not fair, then a nation, tribe, will be empty mean not creating value mean die. Only fair rules will survive but any try will rewards actor with XTRIB coin.
## Network topology
As it is decentralize organisation, a public address directory is replicated on each instance of a town into /nationchains .
Each town (instance) is accessible with an anonymlous DNS https://apxtri.crabdance.com where the IP adresse is update when elected town's IP to register a new block into the blockchain (each 10minutes).
```plaintext ```plaintext
/town-nation/ /town-nation/
apxtrib/middlewares apxtrib/ core system that manage used tribe adminapi referential endepoint https://.../api/routeName/...
/middlewares
/models /models
/lg refName.json {msgkey:mustache template} /lg refName.json {msgkey:mustache template}
/routes endpoint that return {status,ref,msg,data} /routes endpoint that return {status,ref,msg,data}
@ -39,19 +34,40 @@ Each town (instance) is accessible with an anonymlous DNS https://apxtri.crabdan
/towns/ nodes server /towns/ nodes server
/pagans/ anonymous numerique identity /pagans/ anonymous numerique identity
/blocks/ blockchain database /blocks/ blockchain database
/tribes/idx/ tribe's files space /tribes/ tribe's files space
/idx/
/itm/admin.json /itm/admin.json
/adminapi/schema/ list of schemaName.json /adminapi/ Allow apxtribe management
/schema/lg list of schemaName_lg.json language data /schema/ list of schemaName.json
/objects/idx/ list of indexName.json /schema/lg list of schemaName_lg.json language data
/itm/ list of object content store by apxid.json /objects/idx/ list of indexName.json
/www/cdn web public access file /itm/ list of object content store by apxid.json
/adminapx/index_lg.html administration webapp /www/cdn web public access file
/website/ /adminapx/index_lg.html administration webapp
/tribeName /website/
/tribeName/
/api/routes Specific web service https://.../api/tribename/routeName/endpoint
/middlewares
/models
/schema list of t
/tmp/tokens/ manage temporary keys /tmp/tokens/ manage temporary keys
``` ```
## Network topology
 As it is decentralize organisation, a public address directory is replicated on each instance of a town into /nationchains .
 
Each town (instance) is accessible with an anonymlous DNS https://apxtri.crabdance.com where the IP adresse is update when elected town's IP to register a new block into the blockchain (each 10minutes).
## Quick start:
Pre-request: linux maxhine (ubuntuserver swith sudoer apx)
1.  sudo apt install nginx 
## apxtri Documentation ## apxtri Documentation
**Documentation for apxtri usage to start**, tuto HOW TO for user, dev ... is [here](https://apxtri.org/doc) **Documentation for apxtri usage to start**, tuto HOW TO for user, dev ... is [here](https://apxtri.org/doc)

View File

@ -1,4 +1,4 @@
{ { "invalidalias":"Alias doit être composé exclusivement de minuscules ou de chiffres et contenir au moins 4 caracteres",
"aliasexist": "Cet alias {{alias}} existe", "aliasexist": "Cet alias {{alias}} existe",
"emailerr": "Verifier votre email {{email}}", "emailerr": "Verifier votre email {{email}}",
"aliasorprivkeytooshort": "Vérifiez votre alias et votre clé privée", "aliasorprivkeytooshort": "Vérifiez votre alias et votre clé privée",

View File

@ -19,7 +19,7 @@
"logpm2": "pm2 logs apxtri.js --lines 200", "logpm2": "pm2 logs apxtri.js --lines 200",
"dev": "node apxtri.js mode:dev", "dev": "node apxtri.js mode:dev",
"unittest": "node unittest.js", "unittest": "node unittest.js",
"apidoc": "apidoc -i middlewares routes -o ../nationchains/tribes/adminapi/www/apidoc", "apidoc": "apidoc -i middlewares routes -o ../nationchains/tribes/adminapi/www/cdn/apidoc",
"apidocsmatchit": "apidoc -i ../nationchains/tribes/smatchit/api/middlewares ../nationchains/tribes/smatchit/api/routes -o ../nationchains/tribes/smatchit/www/apidoc" "apidocsmatchit": "apidoc -i ../nationchains/tribes/smatchit/api/middlewares ../nationchains/tribes/smatchit/api/routes -o ../nationchains/tribes/smatchit/www/apidoc"
}, },
"apidoc": { "apidoc": {

View File

@ -271,7 +271,7 @@ router.put("/person", checkHeaders, isAuthenticated, (req, res) => {
* @apiGroup Pagans * @apiGroup Pagans
* @apiDescription Send mails with all registers identities (one per alias where recoveryauth.email is register) * @apiDescription Send mails with all registers identities (one per alias where recoveryauth.email is register)
* *
* @apiSuccess {object} * @apiSuccess {object} send recovery email
* @apiSuccessExample {json} Success-Response: * @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK * HTTP/1.1 200 OK
* {"status":200, "ref":"Pagans", "msg":"recoveryemailsent", "data":{email,tribe,nbalias:'number of alias with this email', nbqent:'number of eamil sent must = nbalias'}} * {"status":200, "ref":"Pagans", "msg":"recoveryemailsent", "data":{email,tribe,nbalias:'number of alias with this email', nbqent:'number of eamil sent must = nbalias'}}
@ -305,7 +305,7 @@ router.get("/keyrecovery/:tribe/:email", checkHeaders, (req, res) => {
* @apiGroup Pagans * @apiGroup Pagans
* @apiDescription Send to email recovery if exist key files * @apiDescription Send to email recovery if exist key files
* *
* @apiSuccess {object} * @apiSuccess {object} send recovery mail for alias
* @apiSuccessExample {json} Success-Response: * @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK * HTTP/1.1 200 OK
* {"status":200, "ref":"Pagans", "msg":"recoveryemailsent", "data":{email,tribe,nbalias:1, nbqent:1 or 0}} * {"status":200, "ref":"Pagans", "msg":"recoveryemailsent", "data":{email,tribe,nbalias:1, nbqent:1 or 0}}

BIN
setup/adminapx_1.zip Normal file

Binary file not shown.

View File

@ -5,7 +5,7 @@ pid /var/run/nginx.pid;
#include /etc/nginx/modules-enabled/*.conf; #include /etc/nginx/modules-enabled/*.conf;
events { events {
worker_connections 1024; worker_connections {{nginx.worker_connections}};
} }
http { http {
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
@ -37,7 +37,6 @@ http {
## ##
# Virtual Host Configs # Virtual Host Configs
## ##
{{#nginx.include}} include /etc/nginx/conf.d/*.conf;
include {{{.}}}; include /home/{{sudoerUser}}/apxtowns/{{townId}}-{{nationId}}/conf/nginx/*.conf;
{{/nginx.include}}
} }

View File

@ -1,12 +1,12 @@
server { server {
server_name {{#dns}} {{.}} {{/dns}}; server_name {{#dns}} {{.}} {{/dns}};
access_log {{{nginx.logs}}}.access.log main; access_log {{foldertowns}}/{{townId}}-{{nationId}}/nationchains/tribes/log/nginx/{{tribeId}}_{{website}}.access.log main;
set $trackme 0; set $trackme 0;
if ( $uri ~ ^/trk/ ){ if ( $uri ~ ^/trk/ ){
set $trackme 1; set $trackme 1;
} }
access_log {{{nginx.logs}}}.trk.log tracker if=$trackme ; access_log {{foldertowns}}/{{townId}}-{{nationId}}/nationchains/tribes/log/nginx/{{tribeId}}_{{website}}.trk.log tracker if=$trackme ;
location ~* /trk/ { location ~* /trk/ {
if ( $uri ~ ^/trk/redirect ){ if ( $uri ~ ^/trk/redirect ){
return 301 $arg_url; return 301 $arg_url;
@ -15,52 +15,36 @@ location ~* /trk/ {
} }
location /Checkjson.js { location /Checkjson.js {
alias {{{dirapi}}}/api/models/Checkjson.js; alias {{foldertowns}}/{{townId}}-{{nationId}}/apxtri/models/Checkjson.js;
} }
location ~* /nationchains/(blocks|pagans|towns|nations)/ { location ~* /nationchains/(blocks|pagans|towns|nations)/ {
# Warning: never add tribes for keeping it private # Warning: never add tribes for keeping it private
root {{{dirapi}}}/; root {{foldertowns}}/{{townId}}-{{nationId}}/nationchains/;
} }
location ~* /nationchains/models/ { location ~* /nationchains/models/ {
rewrite /nationchains/models/(.*$) /$1 break; rewrite /nationchains/models/(.*$) /$1 break;
root {{{dirapi}}}/api/models/lg/; root {{foldertowns}}/{{townId}}-{{nationId}}/apxtri/models/lg/;
} }
location ~* /nationchains/schema/ { location ~* /nationchains/schema/ {
#outside of nationchains for git purpose #outside of nationchains for git purpose
rewrite /nationchains/schema/(.*$) /$1 break; rewrite /nationchains/schema/(.*$) /$1 break;
root {{{dirapi}}}/adminapi/schema/; root {{{foldertowns}}/{{townId}}-{{nationId}}/nationchains/tribes/adminapi/schema/;
} }
location ~* /{{tribeId}}/schema/{ location ~* /{{tribeId}}/schema/{
rewrite /{{tribeId}}/schema/(.*$) /$1 break; rewrite /{{tribeId}}/schema/(.*$) /$1 break;
root {{dirtown}}/tribes/{{tribeId}}/schema/; root {{foldertowns}}/{{townId}}-{{nationId}}/nationchains/tribes/{{tribeId}}/schema/;
} }
location ~* /{{tribeId}}/models/{ location ~* /{{tribeId}}/models/{
rewrite /{{tribeId}}/models/(.*$) /$1 break; rewrite /{{tribeId}}/models/(.*$) /$1 break;
root {{dirtown}}/tribes/{{tribeId}}/api/models/lg/; root {{foldertowns}}/{{townId}}-{{nationId}}/nationchains/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/ { location /cdn/ {
expires 1y; expires 1y;
add_header Cache-Control "public"; add_header Cache-Control "public";
rewrite /cdn/(.*$) /$1 break; rewrite /cdn/(.*$) /$1 break;
root {{{nginx.fswww}}}/cdn/; root {{foldertowns}}/{{townId}}-{{nationId}}/nationchains/tribes/{{tribeId}}/www//cdn/;
}
location /spacedev/ {
rewrite /spacedev/(.*$) /$1 break;
root {{{nginx.fswww}}}spacedev/{{{nginx.website}}}/dist/;
} }
location /api/ { location /api/ {
@ -72,7 +56,7 @@ include proxy_params;
location /apxwebapp/ { location /apxwebapp/ {
rewrite /apxwebapp/(.*$) /$1 break; rewrite /apxwebapp/(.*$) /$1 break;
root {{{dirapxwebapp}}}/apxwebapp/; root {{foldertowns}}/apxwebapp/;
index index.html index_en.html; index index.html index_en.html;
} }
@ -80,12 +64,12 @@ index index.html index_en.html;
option option
location / { location / {
{{#nginx.private}} {{#private}}
auth_basic "Mot de passe {{nginx.privatelogin}}"; auth_basic "Mot de passe {{privatelogin}}";
auth_basic_user_file {{dirtown}}/tribes/{{tribeId}}/.htpasswd; auth_basic_user_file {{{foldertowns}}/{{townId}}-{{nationId}}/nationchains/tribes/{{tribeId}}/.htpasswd;
{{/nginx.private}} {{/private}}
root {{{nginx.fswww}}}/{{{nginx.website}}}; root {{foldertowns}}/{{townId}}-{{nationId}}/nationchains/tribes/{{tribeId}}/www/{{{website}}};
index index.html {{{nginx.pageindex}}}; index index.html {{{pageindex}}};
} }
error_page 404 /404.html; error_page 404 /404.html;
# redirect server error pages to the static page /50x.html # redirect server error pages to the static page /50x.html

55
setup/conf/townconf.json Normal file
View File

@ -0,0 +1,55 @@
{ "chaintonation":false,
"foldertowns":"xx/apxtowns",
"nationId": "xx",
"townId": "xx",
"sudoerUser": "xx",
"dns": ["xx"],
"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
},
"emailcontact":"wall-ants@ndda.fr",
"smtp": {
"host": "in-v3.mailjet.com",
"port": "587",
"auth": {
"user": "??",
"password": "??"
}
},
"sms": {
"url": "https://api.mailjet.com/v4/sms-send",
"Token": "",
"From": ""
}
}