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.
## 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
/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
/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)

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",
"emailerr": "Verifier votre email {{email}}",
"aliasorprivkeytooshort": "Vérifiez votre alias et votre clé privée",

View File

@ -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": {

View File

@ -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}}

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;
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;
}

View File

@ -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

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": ""
}
}