diff --git a/README.md b/README.md index 2d0ea63..308e13a 100644 --- a/README.md +++ b/README.md @@ -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. -## 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 /town-nation/ - apxtrib/middlewares + apxtrib/ core system that manage used tribe adminapi referential endepoint https://.../api/routeName/... + /middlewares /models /lg refName.json {msgkey:mustache template} /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 /pagans/ anonymous numerique identity /blocks/ blockchain database - /tribes/idx/ tribe's files space + /tribes/ tribe's files space + /idx/ /itm/admin.json - /adminapi/schema/ list of schemaName.json - /schema/lg list of schemaName_lg.json language data - /objects/idx/ list of indexName.json - /itm/ list of object content store by apxid.json - /www/cdn web public access file - /adminapx/index_lg.html administration webapp - /website/ - /tribeName + /adminapi/ Allow apxtribe management + /schema/ list of schemaName.json + /schema/lg list of schemaName_lg.json language data + /objects/idx/ list of indexName.json + /itm/ list of object content store by apxid.json + /www/cdn web public access file + /adminapx/index_lg.html administration webapp + /website/ + /tribeName/ + /api/routes Specific web service https://.../api/tribename/routeName/endpoint + /middlewares + /models + + /schema list of t + /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 **Documentation for apxtri usage to start**, tuto HOW TO for user, dev ... is [here](https://apxtri.org/doc) diff --git a/models/lg/Pagans_fr.json b/models/lg/Pagans_fr.json index e3e55f5..d868d47 100644 --- a/models/lg/Pagans_fr.json +++ b/models/lg/Pagans_fr.json @@ -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", "emailerr": "Verifier votre email {{email}}", "aliasorprivkeytooshort": "Vérifiez votre alias et votre clé privée", diff --git a/package.json b/package.json index 1491fd4..2b0ed07 100755 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "logpm2": "pm2 logs apxtri.js --lines 200", "dev": "node apxtri.js mode:dev", "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" }, "apidoc": { diff --git a/routes/pagans.js b/routes/pagans.js index 6a49f98..70d6ec7 100755 --- a/routes/pagans.js +++ b/routes/pagans.js @@ -271,7 +271,7 @@ router.put("/person", checkHeaders, isAuthenticated, (req, res) => { * @apiGroup Pagans * @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: * 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'}} @@ -305,7 +305,7 @@ router.get("/keyrecovery/:tribe/:email", checkHeaders, (req, res) => { * @apiGroup Pagans * @apiDescription Send to email recovery if exist key files * - * @apiSuccess {object} + * @apiSuccess {object} send recovery mail for alias * @apiSuccessExample {json} Success-Response: * HTTP/1.1 200 OK * {"status":200, "ref":"Pagans", "msg":"recoveryemailsent", "data":{email,tribe,nbalias:1, nbqent:1 or 0}} diff --git a/setup/adminapx_1.zip b/setup/adminapx_1.zip new file mode 100644 index 0000000..7fc1e86 Binary files /dev/null and b/setup/adminapx_1.zip differ diff --git a/setup/conf/initconf.json b/setup/conf/ASUPinitconf.json similarity index 100% rename from setup/conf/initconf.json rename to setup/conf/ASUPinitconf.json diff --git a/setup/conf/setup_xx.json b/setup/conf/ASUPsetup_xx.json similarity index 100% rename from setup/conf/setup_xx.json rename to setup/conf/ASUPsetup_xx.json diff --git a/setup/conf/nginx.conf.mustache b/setup/conf/nginx/nginx.conf.mustache similarity index 89% rename from setup/conf/nginx.conf.mustache rename to setup/conf/nginx/nginx.conf.mustache index 54caaae..5bdf9e8 100755 --- a/setup/conf/nginx.conf.mustache +++ b/setup/conf/nginx/nginx.conf.mustache @@ -5,7 +5,7 @@ pid /var/run/nginx.pid; #include /etc/nginx/modules-enabled/*.conf; events { - worker_connections 1024; + worker_connections {{nginx.worker_connections}}; } http { include /etc/nginx/mime.types; @@ -37,7 +37,6 @@ http { ## # Virtual Host Configs ## - {{#nginx.include}} - include {{{.}}}; - {{/nginx.include}} + include /etc/nginx/conf.d/*.conf; + include /home/{{sudoerUser}}/apxtowns/{{townId}}-{{nationId}}/conf/nginx/*.conf; } diff --git a/setup/conf/nginxmodelwebsite.conf.mustache b/setup/conf/nginx/nginxmodelwebsite.conf.mustache similarity index 53% rename from setup/conf/nginxmodelwebsite.conf.mustache rename to setup/conf/nginx/nginxmodelwebsite.conf.mustache index 0481808..199b7fd 100755 --- a/setup/conf/nginxmodelwebsite.conf.mustache +++ b/setup/conf/nginx/nginxmodelwebsite.conf.mustache @@ -1,12 +1,12 @@ server { 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; if ( $uri ~ ^/trk/ ){ 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/ { if ( $uri ~ ^/trk/redirect ){ return 301 $arg_url; @@ -15,52 +15,36 @@ location ~* /trk/ { } location /Checkjson.js { - alias {{{dirapi}}}/api/models/Checkjson.js; + alias {{foldertowns}}/{{townId}}-{{nationId}}/apxtri/models/Checkjson.js; } location ~* /nationchains/(blocks|pagans|towns|nations)/ { # Warning: never add tribes for keeping it private -root {{{dirapi}}}/; +root {{foldertowns}}/{{townId}}-{{nationId}}/nationchains/; } location ~* /nationchains/models/ { rewrite /nationchains/models/(.*$) /$1 break; - root {{{dirapi}}}/api/models/lg/; + root {{foldertowns}}/{{townId}}-{{nationId}}/apxtri/models/lg/; } location ~* /nationchains/schema/ { #outside of nationchains for git purpose rewrite /nationchains/schema/(.*$) /$1 break; -root {{{dirapi}}}/adminapi/schema/; +root {{{foldertowns}}/{{townId}}-{{nationId}}/nationchains/tribes/adminapi/schema/; } location ~* /{{tribeId}}/schema/{ rewrite /{{tribeId}}/schema/(.*$) /$1 break; - root {{dirtown}}/tribes/{{tribeId}}/schema/; + root {{foldertowns}}/{{townId}}-{{nationId}}/nationchains/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"; + root {{foldertowns}}/{{townId}}-{{nationId}}/nationchains/tribes/{{tribeId}}/api/models/lg/; } 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/; + root {{foldertowns}}/{{townId}}-{{nationId}}/nationchains/tribes/{{tribeId}}/www//cdn/; } location /api/ { @@ -72,7 +56,7 @@ include proxy_params; location /apxwebapp/ { rewrite /apxwebapp/(.*$) /$1 break; -root {{{dirapxwebapp}}}/apxwebapp/; +root {{foldertowns}}/apxwebapp/; index index.html index_en.html; } @@ -80,12 +64,12 @@ index index.html index_en.html; 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}}}; +{{#private}} +auth_basic "Mot de passe {{privatelogin}}"; +auth_basic_user_file {{{foldertowns}}/{{townId}}-{{nationId}}/nationchains/tribes/{{tribeId}}/.htpasswd; +{{/private}} +root {{foldertowns}}/{{townId}}-{{nationId}}/nationchains/tribes/{{tribeId}}/www/{{{website}}}; +index index.html {{{pageindex}}}; } error_page 404 /404.html; # redirect server error pages to the static page /50x.html diff --git a/setup/conf/nginxproxyparams.mustache b/setup/conf/nginx/nginxproxyparams.mustache similarity index 100% rename from setup/conf/nginxproxyparams.mustache rename to setup/conf/nginx/nginxproxyparams.mustache diff --git a/setup/conf/townconf.json b/setup/conf/townconf.json new file mode 100644 index 0000000..2adc5cf --- /dev/null +++ b/setup/conf/townconf.json @@ -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": "" + } + } \ No newline at end of file