maj setup
This commit is contained in:
@@ -1 +0,0 @@
|
||||
["https://wallants.ndda.fr/nations/synchro"]
|
@@ -1,8 +1,7 @@
|
||||
{
|
||||
"dns": ["adminapx"],
|
||||
"dns": ["devfarm-ants"],
|
||||
"towns": [
|
||||
{ "townId": "wall", "nationId": "ants", "url": "wall-ants.ndda.fr" },
|
||||
{ "townId": "hill", "nationId": "ants", "url": "hill-ants.ndda.fr" }
|
||||
{ "townId": "wall", "nationId": "ants", "dns": "wall-ants.ndda.fr" }
|
||||
],
|
||||
"api": {
|
||||
"port": 3020,
|
||||
|
@@ -1,49 +1,49 @@
|
||||
server {
|
||||
server_name {{#dns}} {{.}} {{/dns}};
|
||||
access_log {{{nginx.logs}}}.access.log main;
|
||||
server_name {{#dns}} {{.}} {{/dns}};
|
||||
access_log {{{nginx.logs}}}.access.log main;
|
||||
|
||||
location ~* /nationchains/(schema|blocks|pagans|towns|nations)/ {
|
||||
# Warning: never add tribes for keeping it private
|
||||
root {{{dirapi}}}/;
|
||||
}
|
||||
|
||||
# /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/ {
|
||||
rewrite /cdn/(.*$) /$1 break;
|
||||
root {{{nginx.fswww}}}www/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 / {
|
||||
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;
|
||||
}
|
||||
location ~* /nationchains/(schema|blocks|pagans|towns|nations)/ {
|
||||
# Warning: never add tribes for keeping it private
|
||||
root {{{dirapi}}}/;
|
||||
}
|
||||
|
||||
# /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/ {
|
||||
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 / {
|
||||
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;
|
||||
}
|
||||
}
|
1
adminapi/www/adminapx/conf/setup_xx.json
Normal file
1
adminapi/www/adminapx/conf/setup_xx.json
Normal file
@@ -0,0 +1 @@
|
||||
{"nationId":"ants","townId":"devfarm","dns":["devfarm-ants"],"comment":"Auto generate setup from apxtrib after node apxtrib nationId:value townId:value dns:domaine_to_access"}
|
@@ -31,7 +31,7 @@
|
||||
<script src="cdn/share/js/openpgp.min.js"></script>
|
||||
<script src="cdn/share/js/mustache.min.js"></script>
|
||||
<script src="cdn/share/js/axios.min.js"></script>
|
||||
<script src="static/js/apxtribcli.js"></script>
|
||||
<script src="static/js/apx.js"></script>
|
||||
<script src="static/js/apxpagans.js"></script>
|
||||
<script src="static/js/apxtribes.js"></script>
|
||||
<script src="static/js/apxtowns.js"></script>
|
||||
@@ -47,7 +47,7 @@
|
||||
<body>
|
||||
|
||||
<div id="apxtitle" class="p-5 bg-primary text-white text-center" apptoload="app.load('apxtitle','title','setup')"
|
||||
add2data tpldata="static/tpldata/setup_xx.json">
|
||||
add2data tpldata="conf/setup_xx.json">
|
||||
<h1>apXtrib</h1>
|
||||
<p> Manage and understand apXtrib back-end</p>
|
||||
</div>
|
||||
@@ -88,8 +88,8 @@
|
||||
<a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button"
|
||||
aria-expanded="false">Mayor's Town</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" add2data tpl="static/tpl/townsetup_en.mustache"
|
||||
onclick="app.load('apxmain','townsetup','setup')">Chain a town</a></li>
|
||||
<li><a class="dropdown-item" add2data tpl="static/tpl/townowner_en.mustache"
|
||||
onclick="app.load('apxmain','townowner',towns.loadtpldata())">Own this town</a></li>
|
||||
<li><a class="dropdown-item" href="#">Manage Tribes</a></li>
|
||||
<li><a class="dropdown-item" href="#">Backup Town/Tribes</a></li>
|
||||
<li>
|
||||
@@ -126,7 +126,8 @@
|
||||
<ul class="dropdown-menu">
|
||||
<li><a class="dropdown-item" href="#">Odmdb Schema</a></li>
|
||||
<li><a class="dropdown-item" href="#">Odmdb CRUD</a></li>
|
||||
<li><a class="dropdown-item" href="#">Host a web app</a></li>
|
||||
<li><a class="dropdown-item" add2data tpl="static/tpl/devophostawebapp_en.mustache"
|
||||
onclick="app.load('apxmain','devophostawebapp',tribes.loadtpldata())">Host a web app</a></li>
|
||||
<li>
|
||||
<hr class="dropdown-divider">
|
||||
</li>
|
||||
|
@@ -1,41 +1,33 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "socialworld/objects/schema/towns",
|
||||
"$id": "schema/towns",
|
||||
"title": "Town",
|
||||
"description": "A town belonging to a nation from apXtrib world",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"townId": {
|
||||
"description": "|Towns|townnamedesc",
|
||||
"desclong": "|Townss|townnamedesclong",
|
||||
"info": "|Towns|townnameinfo",
|
||||
"type": "string",
|
||||
"pattern":"^[a-z0-9]*$"
|
||||
"pattern": "^[a-z0-9]*$"
|
||||
},
|
||||
"nationId": {
|
||||
"description": "|Towns|nationdesc",
|
||||
"desclong": "|Townss|nationdesclong",
|
||||
"type": "string",
|
||||
"$apxenumkey": "socialworld/objects/nations/searchindex/nations_uuid_uuid.json"
|
||||
},
|
||||
"mayorId": {
|
||||
"type": "string",
|
||||
"$apxenumkey": "socialworld/objects/nations/searchindex/nations_uuid_uuid.json"
|
||||
},
|
||||
"status": {
|
||||
"desc": "|Towns|statusdesc",
|
||||
"default": "active",
|
||||
"type": "string",
|
||||
"$apxenumkey": "data",
|
||||
"data": {
|
||||
"chain": { "desc": "|Towns|statuschain" },
|
||||
"tochain": { "desc": "|Towns|statustosync" },
|
||||
"unchain": { "desc": "|Towns|statusunchain" }
|
||||
"enum":["chain","unchain","tochain"]
|
||||
}
|
||||
},
|
||||
"url": {
|
||||
"desc": "|Towns|urldesc",
|
||||
"type": "string",
|
||||
"apxtype":"url"
|
||||
"dns": {
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"required": ["townId", "status", "nationId", "url"],
|
||||
"required": ["townId", "status", "nationId", "dns"],
|
||||
"apxprimarykey": "townId",
|
||||
"apxsearchindex": [
|
||||
{ "key": "status", "value": "townId" },
|
||||
|
@@ -4,6 +4,19 @@
|
||||
"use strict";
|
||||
var towns = towns || {};
|
||||
|
||||
towns.lauch =()=>{
|
||||
|
||||
}
|
||||
towns.loadtpldata = () => {
|
||||
// adapte tpldata to template tpl
|
||||
const dataowner = apx.data.tpldata.setup;
|
||||
dataowner.alias=apx.data.headers.xalias;
|
||||
dataowner.auth = dataowner.alias=="anonymous";
|
||||
dataowner.devtown = dataowner.townId == "devfarm";
|
||||
if (dataowner.mayorid) dataowner.owner = dataowner.mayorid == dataowner.alias;
|
||||
console.log('Data return to template',dataowner)
|
||||
return dataowner;
|
||||
};
|
||||
towns.owntown = () => {
|
||||
|
||||
|
||||
// only the owner can give ownership to someone else
|
||||
|
||||
};
|
||||
|
@@ -0,0 +1,19 @@
|
||||
/*eslint no-undef:0*/
|
||||
/*eslint-env browser*/
|
||||
|
||||
"use strict";
|
||||
var tribes = tribes || {};
|
||||
|
||||
tribes.loadtpldata = () => {
|
||||
// adapte tpldata to template tpl
|
||||
const datahost = apx.data.tpldata.setup;
|
||||
datahost.offers=[{offerid:"Z",title:" Offre gratuite Max space 1Mo public"},{offerid:"A",title:" Max space 5Mo public"},{offerid:"B",title:" Max space 5Mo private for less than 100 Persons"},{offerid:"C",title:" Max space 500 Mo private for less than 100 Persons"},{offerid:"D",title:" Max space 2 Go private for less than 1000 Persons"}],
|
||||
datahost.alias=apx.data.headers.xalias;
|
||||
datahost.auth = datahost.alias=="anonymous";
|
||||
console.log('Data return to template',datahost)
|
||||
return datahost;
|
||||
};
|
||||
tribes.addspaceweb = ( offer,domain, appname,msg) => {
|
||||
// Request to a druid to host space web accessible from a domain to share tribes data /persons / ...
|
||||
alert('Under construction to send notification to druid to get an access')
|
||||
};
|
||||
|
@@ -0,0 +1,57 @@
|
||||
<h4>Host a web app</h4>
|
||||
<p> A druid has to create a webapp space into his tribe/www/webappname. To do that he needs:</p>
|
||||
<ul>
|
||||
<li> a domain name that redirect to the IP of this town</li>
|
||||
<li> Define which method to push content, by simply using the upload browser or by creating a linux account to connect by sftp and mount it in distance machine.</li>
|
||||
</ul>
|
||||
<p>Option sftp: as sudo</p>
|
||||
<code>
|
||||
$ sudo useradd -s /bin/bash -m -d /home/sagark -c "sagark" sagark
|
||||
$ sudo paswd sagark to set a robust password
|
||||
$ chmod o+rwx folderappname # workspace/townId-nationId/tribes/tribeId/www/appname
|
||||
# su sagark
|
||||
$ mkdir -p --mode 700 ~/tribes/smatchit/www
|
||||
$ ln -s /home/phil/workspace/wall-ants/tribes/smatchit/www/smatchapp ~/tribes/smatchit/www/smatchapp
|
||||
# su sudoer to add file to jail user in his home
|
||||
$ sudo mkdir -p /home/sagark/dev
|
||||
$ cd /home/sagark/dev
|
||||
$ sudo mknod -m 666 null c 1 3
|
||||
$ sudo mknod -m 666 tty c 5 0
|
||||
$ sudo mknod -m 666 zero c 1 5
|
||||
$ sudo mknod -m 666 random c 1 8
|
||||
# change access right
|
||||
|
||||
$ userdel -r sagark
|
||||
</code>
|
||||
{{^auth}}
|
||||
<p><b>You have to be authenticate on this town with accessright on tribe to request a new web space for this tribe.</b></p>
|
||||
{{/auth}}
|
||||
{{#auth}}
|
||||
<p> Send him a request to create as alias:{{alias}}</p>
|
||||
<div class="col-md-6">
|
||||
<label for="inputdomain" class="form-label">A domain</label>
|
||||
<input type="text" class="form-control" id="inputdomain" placeholder="A register domain that redirect to the town IP">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="inputappname" class="form-label">Name of your app</label>
|
||||
<input type="text" class="form-control" id="inputappname" placeholder="folder name in www/ and name of xapp in header">
|
||||
</div>
|
||||
<div id="selectoffer" class="">
|
||||
<label for="selectoffer" class="col-12 col-form-label">Choose your offer</label>
|
||||
<div class="col-12">
|
||||
<select class="form-select" id="chooseoffer" aria-label="" placeholder="To get a hosting web place">
|
||||
{{#offers}}
|
||||
<option {{#selected}}selected{{/selected}} value="{{offerid}}">{{title}}</option>
|
||||
{{/offers}}
|
||||
</select>
|
||||
<input class="d-none" id="inputofferid" value="{{offerid}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label for="msgtodruid" class="form-label">Message</label>
|
||||
<textarea rows="5" id="msgtodruid" class="form-control" placeholder="A message to tribe's druid about hosting"></textarea>
|
||||
</div>
|
||||
<button class="btn btn-primary"
|
||||
onclick="tribes.addspaceweb(document.getElementById('inputofferid').value,document.getElementById('inputdomain').value,document.getElementById('inputappname').value,document.getElementById('msgtodruid').value);">
|
||||
Request a space web</button>
|
||||
{{/auth}}
|
@@ -77,7 +77,7 @@
|
||||
onclick="delete apx.data.auth;apx.data.headers=apxlocal.headers;apx.save();alert('delete apx.data.auth and reinit apx.data.header')">
|
||||
Remove headers</button>
|
||||
<hr>
|
||||
<h3>I proove that i own this alias</h3>
|
||||
<h3>I prove that i own this alias</h3>
|
||||
<div class="col-md-6">
|
||||
<label for="inputaliasauth" class="form-label">Your alias</label>
|
||||
<input type="text" class="form-control" id="inputaliasauth" placeholder="A public alias that any one see">
|
||||
|
46
adminapi/www/adminapx/static/tpl/townowner_en.mustache
Normal file
46
adminapi/www/adminapx/static/tpl/townowner_en.mustache
Normal file
@@ -0,0 +1,46 @@
|
||||
<div class="container">
|
||||
{{^auth}}
|
||||
<p> Sorry you need to have a valid authentification that prove that you are the major of this town to go ahead</p>
|
||||
{{/auth}}
|
||||
{{#auth}}
|
||||
<div class="row">
|
||||
<h4>Current setup</h4>
|
||||
<p>Your current town name: <b>{{townId}}</b> is link to nation: <b>{{nationId}}</b> and accessible with domain <b>{{#dns}}{{.}}{{/dns}}</b>.</p>
|
||||
{{#devtown}}
|
||||
<p> <b>devfarm</b> is a dev town that cannot be chain, to start dev means:</p>
|
||||
<ul>
|
||||
<li> install process made http://devfarm-ants available on your machine the /adminapi/www/adminapx/index_en.html to manage this dev town</li>
|
||||
<li>if not working, check that your /etc/hosts contain 127.0.0.1 devfarm-ants</li>
|
||||
<li>start the api in apxtrib folder $ yarn dev to allow manager adminapx to act on this trib</li>
|
||||
</ul>
|
||||
<p>Then you can dev in apxtrib to send your release to the project leader.</p>
|
||||
<p>You can dev some app as a tribe level into /devfarm-ants see menu Mayor's Town/Manage Tribes to create a dev tribe. You can unzip a tribe into a folder for debuging or dev with real backup data.</p>
|
||||
{{/devtown}}
|
||||
{{^mayorId}}
|
||||
<p>
|
||||
This town is not own by a mayor, anyone can use a pagan account to tell that he is owning this, so please,
|
||||
{{#auth}} you are authenticate under alias: {{alias}} <button class="btn btn-primary" onclick="towns.owntown();">Own this town</button>
|
||||
{{/auth}}
|
||||
{{^auth}} you have to be authenticat with an alias to own this town. go to Pagan / create login logout and authentify yourself and come back here.
|
||||
{{/auth}}
|
||||
{{/mayorId}}
|
||||
{{#owner}}
|
||||
<h4> Own & chain a town</h4>
|
||||
{{#devtown}}
|
||||
<p>You need to change town name (by default it is for dev "devfarm") by running on serveur as sudoer user: </p>
|
||||
<code>node apxtrib.js nationId:nationRequested townId:nameNotalreadyUse dns:domainToAccessTown </code>
|
||||
<p>Come back here.</p>
|
||||
{{/devtown}}
|
||||
{{^devtown}}
|
||||
<p> As owner you({{alias}}) can give the ownership of this town to an other alias. Be carefull when you click on this button you lose all your accessright on this town.</p>
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control" placeholder="Give alias to take the ownership" aria-label="New owner alias" aria-describedby="button-chgown">
|
||||
<button class="btn btn-outline-secondary" type="button" id="button-chgown">Give him the role on this town</button>
|
||||
</div>
|
||||
|
||||
|
||||
{{/devtown}}
|
||||
{{/owner}}
|
||||
</div>
|
||||
{{/auth}}
|
||||
</div>
|
@@ -1,50 +0,0 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<h4> Setup a new town</h4>
|
||||
<p>This form let you start joining a nation.</p>
|
||||
<p>For dev you can stay like this and use http instead of https. To join a nation you need:</p>
|
||||
<ul>
|
||||
<li> Get a domain name register to a publicIP that route web traffic from 80 and 443 to this machine</li>
|
||||
<li> Get a pagan identity and be authenticated <a onclick="app.load('apxmain','pagancreate',{})"> click here to create or authentify yoursefl</a>
|
||||
<li> Synchronize the nations, to update your nationchains (carefful all your local stuff will be deleted)</li>
|
||||
<li> Ready to your new mayor role of this town</li>
|
||||
<li> Start saling your hosting</li>
|
||||
</ul>
|
||||
<div class="col-sm-2">
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<div class="mb-3 row">
|
||||
<label for="selectnationid" class="col-sm-6 col-form-label">Select the nation to join</label>
|
||||
<div class="col-sm-6">
|
||||
<select class="form-select" data-nationId="{{nationId}}" aria-label="" placeholder="A nation">
|
||||
{{#nations}}
|
||||
<option {{#selected}}selected{{/selected}} value="{{nationId}}">{{nationId}}</option>
|
||||
{{/nations}}
|
||||
</select>
|
||||
<input class="d-none" id="inputnationId" value="{{nationId}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 row">
|
||||
<label for="inputtownid" class="col-sm-6 col-form-label">Your Town</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" value="{{townId}}" class="form-control" id="inputtownid">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 row">
|
||||
<label for="inputtribeid" class="col-sm-6 col-form-label">Your Tribes</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" value="{{tribeId}}" class="form-control" id="inputreibeid">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 row">
|
||||
<label for="inputdnstown" class="col-sm-6 col-form-label">Domain name of your town (to access this app from the web)</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" value="{{dns}}" class="form-control" id="inputdnstown">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button onclick="setup.lauchtown(document.getElementById('inputnationId').value, document.getElementById('inputtownId').value,document.getElementById('inputdns').value)" class="btn btn-primary mb-3">Launch this town</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user