setup and apxtri.js for setup

This commit is contained in:
philc 2024-11-08 09:57:10 +01:00
parent 21681bfb82
commit b81e71d978
2 changed files with 20 additions and 8 deletions

View File

@ -33,7 +33,8 @@ adminapi is a special tribe that rules all tribes to provide a SAAS solution eas
### Tech pre-request
#### For dev:
## CReate your town for dev or for prod
Install an ubuntu desktop machine https://ubuntu.com/desktop
```
$ sudo apt update
@ -79,18 +80,29 @@ $ wget https://testwall-ants.ndda.fr/setup.sh
$ chmod +x setup.sh
$ . setup.sh adminapi https://testwall-ants.ndda.fr https://gitea.ndda.fr/apxtri/adminapi
```
Open http://adminapx.adminapi/index_en.html in your browser after installation. you are ready to dev in adminapi or in your tribe by following the web interface.
Open http://admin.adminapi.dev.ants/index_en.html (**notice the dot instead of -** ) in your browser after installation. you are ready to dev in adminapi
To add a new tribe from an existing tribe host in testwall-ants.ndda.fr, we want set a dev env from git repo named smatchit with data that come from testwall-ants.ndda.fr the last night. To get data you must have the password to access backup. Then you must set your nginx conf from the interface
Then you can conf your town from the web interface.
NB: if the machine is a production (not located in your localhost) don't forget to add in your /etc/hosts
"public IP adresse" admin.adminapi.dev.ants
Until the web interface allow it here are usefull process to:
* create an empty tribe call tribename
```
run . setup.sh tribename
```
This will create a new tribe that you can manage in http://admin.tribename.dev.ants don't forget /etc/hosts update (a standard .giitignore is generate ready if you want to version your code in apxtri)
* To add a new tribe from an existing tribe host in testwall-ants.ndda.fr, we want set a dev env from git repo named smatchit with data that come from testwall-ants.ndda.fr the last night. To get data you must have the password to access backup.
```
. setup.sh smatchit https://testwall-ants.ndda.fr https://gitea.ndda.fr/smatchit/smatchit
```
You can create a git project of your tribe, we add a default .gitignore to not ignore data store in object.
If you want to contribute fixing bug, add new features in adminapi please push in your branch and send an email to support@need-data.com.
#### For production

View File

@ -105,7 +105,7 @@ apxtri.setuptribe = async (tribe, conf) => {
const townnation = inittribe.townpath.split("/").slice(-1)[0].split("-");
inittribe.townId = townnation[0];
inittribe.nationId = townnation[1];
inittribe.dns.push(`adminapi.${inittribe.townId}.${inittribe.nationId}`);
inittribe.dns.push(`admin.adminapi.${inittribe.townId}.${inittribe.nationId}`);
} catch (err) {
console.log("Your town folder must be something townid-nation");
}
@ -184,7 +184,7 @@ apxtri.setuptribe = async (tribe, conf) => {
);
inittribe.website = "admin";
fs.outputFileSync(
`../adminapi/nginx/${inittribe.website}.${tribe}.${inittribe.townId}.${inittribe.nationId}.conf`,
`../${tribe}/nginx/${inittribe.website}.${tribe}.${inittribe.townId}.${inittribe.nationId}.conf`,
Mustache.render(nginxapx, inittribe)
);
fs.outputFileSync(