fix for deployement
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -5,7 +5,6 @@ | |||||||
| !LICENSE | !LICENSE | ||||||
| !.gitignore | !.gitignore | ||||||
| !backup.sh | !backup.sh | ||||||
| !setup.sh |  | ||||||
| !package.json | !package.json | ||||||
| !apxtri/ | !apxtri/ | ||||||
| !apxtri/** | !apxtri/** | ||||||
|   | |||||||
							
								
								
									
										13
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								README.md
									
									
									
									
									
								
							| @@ -70,12 +70,14 @@ $ node --version # to check the Node.js version | |||||||
| $ npm install --global yarn | $ npm install --global yarn | ||||||
| $ yarn --version # to check the yarn version | $ yarn --version # to check the yarn version | ||||||
| $ mkdir ~/apxtowns # if it does not exist | $ mkdir ~/apxtowns # if it does not exist | ||||||
|  |  | ||||||
|  | # Create a town name that does not exist for a nation and create forlder {tonwname}-{nation} | ||||||
|  | # Following example dev is a town and ants is a nation (you can create an existing town localy but you won't be able to join the ants network if this towns already exist)  | ||||||
| $ mkdir ~/apxtowns/dev-ants | $ mkdir ~/apxtowns/dev-ants | ||||||
| $ cd ~/apxtowns/dev-ants | $ cd ~/apxtowns/dev-ants | ||||||
| $ sudo chown {apxuser}:root /etc/nginx/nginx.conf | $ wget https://testwall-ants.ndda.fr/setup.sh | ||||||
| $ git clone https://gitea.ndda.fr/apxtri/adminapi.git | $ chmod +x setup.sh | ||||||
| $ yarn install  | $ ./setup.sh  adminapi https://testwall-ants.ndda.fr https://gitea.ndda.fr/apxtri/adminapi | ||||||
| $ yarn dev  |  | ||||||
| ``` | ``` | ||||||
| Open http://dev-ants in your browser after installation. you are ready to dev in adminapi or in your tribe by following the web interface. | Open http://dev-ants in your browser after installation. you are ready to dev in adminapi or in your tribe by following the web interface. | ||||||
|  |  | ||||||
| @@ -87,8 +89,5 @@ If you want to contribute fixing bug, add new features in adminapi please push i | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| step |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,7 +5,6 @@ const bodyParser = require("body-parser"); | |||||||
| const glob = require("glob"); | const glob = require("glob"); | ||||||
| const path = require("path"); | const path = require("path"); | ||||||
| const Mustache = require("mustache"); | const Mustache = require("mustache"); | ||||||
| const hosts = require("hosts"); |  | ||||||
| const cors = require("cors"); | const cors = require("cors"); | ||||||
| const express = require("express"); | const express = require("express"); | ||||||
| const process = require("process"); | const process = require("process"); | ||||||
| @@ -34,29 +33,13 @@ apxtri.main = async () => { | |||||||
|   } else { |   } else { | ||||||
|     await apxtri.setup(); |     await apxtri.setup(); | ||||||
|   } |   } | ||||||
|   //const conf = require(path.resolve(`../itm/adminapi.json`)); |  | ||||||
|   //const conf = fs.readJsonSync(`../adminapi/objects/tribes/idx/tribes_dns.json`); |  | ||||||
|   //let doms = conf.dns; // only dns of town during the init process |  | ||||||
|   //let tribelist; |  | ||||||
|   /*if (!fs.existsSync(`../adminapi/objects/tribes/idx/tribes_dns.json`)) { |  | ||||||
|     console.log("ERROR,Missing ../adminapi/objects/tribes/idx/tribes_dns.json"); |  | ||||||
|     process.exit(0); |  | ||||||
|   } |  | ||||||
|     */ |  | ||||||
|   /*  const tribesdns = fs.readJsonSync(`../adminapi/objects/tribes/idx/tribes_dns.json`); |  | ||||||
|   let doms=[] |  | ||||||
|   for (const tribe in tribedns){ |  | ||||||
|     tribedns[tribe].forEach(d=>{ |  | ||||||
|       if (!doms.includes(d)) doms.push(d); |  | ||||||
|     }) |  | ||||||
|   } |  | ||||||
| */ |  | ||||||
|   //apxtri.runexpress(fs.readJsonSync(`../adminapi/objects/tribes/idx/tribes_dns.json`)); |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| apxtri.setup = async () => { | apxtri.setup = async () => { | ||||||
|   console.log("Warning, this is a first install"); |   console.log("Warning, this is a first install"); | ||||||
|   const initadminapi = fs.readJsonSync("../adminapi/apxtri/initadminapi.json"); |   const initadminapi = fs.readJsonSync( | ||||||
|  |     "../adminapi/apxtri/setup/initadminapi.json" | ||||||
|  |   ); | ||||||
|   try { |   try { | ||||||
|     initadminapi.townpath = __dirname.replace("/adminapi/apxtri", ""); |     initadminapi.townpath = __dirname.replace("/adminapi/apxtri", ""); | ||||||
|     const townnation = initadminapi.townpath.split("/").slice(-1)[0].split("-"); |     const townnation = initadminapi.townpath.split("/").slice(-1)[0].split("-"); | ||||||
| @@ -112,7 +95,11 @@ apxtri.setup = async () => { | |||||||
|       } |       } | ||||||
|     } |     } | ||||||
|   }*/ |   }*/ | ||||||
|   if (!fs.existsSync("../adminapi/objects/nations")) { |   //check nation exist and town does not exist | ||||||
|  |   if ( | ||||||
|  |     !fs.existsSync("../adminapi/objects/nations/idx/lst_nations.json") || | ||||||
|  |     !fs.existsSync("../adminapi/objects/towns/idx/lst_towns.json") | ||||||
|  |   ) { | ||||||
|     console.log( |     console.log( | ||||||
|       `Sorry, check setup.sh process that was not able to init your adminapi/objects ` |       `Sorry, check setup.sh process that was not able to init your adminapi/objects ` | ||||||
|     ); |     ); | ||||||
| @@ -147,27 +134,30 @@ apxtri.setup = async () => { | |||||||
|   fs.outputJSONSync("../adminapi/objects/tribes/idx/tribes.json", idxadminapi, { |   fs.outputJSONSync("../adminapi/objects/tribes/idx/tribes.json", idxadminapi, { | ||||||
|     space: 2, |     space: 2, | ||||||
|   }); |   }); | ||||||
|   // check nginx conf and eventually adapt |   // check nginx conf and eventually change if not starting by user "current user"; | ||||||
|   let etcnginx = fs.readFileSync("/etc/nginx/nginx.conf") |   let etcnginx = fs.readFileSync("/etc/nginx/nginx.conf", "utf8"); | ||||||
|   const etcnginxlines=etcnginx.slipt("\n"); |   if (etcnginx.split("\n")[0] !== `user ${initadminapi.sudoUser};`) { | ||||||
|   if (etcnginx.slipt("\n")[0] !== `user ${initadminapi.sudoUser};`){ |  | ||||||
|     const nginxmain = fs.readFileSync("../adminapi/apxtri/setup/nginx.maincf"); |     const nginxmain = fs.readFileSync("../adminapi/apxtri/setup/nginx.maincf"); | ||||||
|     fs.outputFileSync("/etc/nginx/nginx.conf",Mustache.render(nginxmain,initadminapi),{adAdmin:true}) |     console.log("Modify /etc/nginx/nginx.conf"); | ||||||
|      |     fs.outputFileSync( | ||||||
|  |       "/etc/nginx/nginx.conf", | ||||||
|  |       Mustache.render(nginxmain, initadminapi), | ||||||
|  |       { adAdmin: true } | ||||||
|  |     ); | ||||||
|   } |   } | ||||||
|   |   // add conf for http://adminapx.adminapi | ||||||
|   const nginxapx = fs.readFileSync("./nginx/nginx.wwwscf"); |   const nginxapx = fs.readFileSync( | ||||||
|   fs.outputSync( |     "../adminapi/apxtri/setup/nginx.wwwscf", | ||||||
|     `/etc/nginx/nginx.conf`, |     "utf8" | ||||||
|     Mustache.render(nginxmain, initadminapi, "utf-8") |  | ||||||
|   ); |   ); | ||||||
|   fs.outputSync( |   initadminapi.website="adminapx"; | ||||||
|     `../nginx/adminapi-apx.conf`, |   fs.outputFileSync( | ||||||
|     Mustache.render(nginxapx, initadminapi, "utf-8") |     `../adminapi/nginx/adminapx.adminapi.conf`, | ||||||
|  |     Mustache.render(nginxapx, initadminapi) | ||||||
|   ); |   ); | ||||||
|   if (!hosts.exists("127.0.0.1", "apx.adminapi")) { |   // add hosts entry for local access  | ||||||
|     hosts.add("127.0.0.1", "apx.adminapi"); |   // this command is ran by the setup.sh | ||||||
|   } |   // sudo sed -i '/127.0.0.1 adminapx.adminapi/c\127.0.0.1 adminapx.adminapi' /etc/hosts | ||||||
|   const { exec } = require("child_process"); |   const { exec } = require("child_process"); | ||||||
|   exec(initadminapi.nginx.restart, (error, stdout, stderr) => { |   exec(initadminapi.nginx.restart, (error, stdout, stderr) => { | ||||||
|     if (error) { |     if (error) { | ||||||
| @@ -179,6 +169,10 @@ apxtri.setup = async () => { | |||||||
|       ); |       ); | ||||||
|     } |     } | ||||||
|   }); |   }); | ||||||
|  |   apxtri.runexpress( | ||||||
|  |     fs.readJsonSync(`../adminapi/objects/tribes/idx/tribes_dns.json`), | ||||||
|  |     fs.readJSONSync("../adminapi/objects/tribes/itm/adminapi.json") | ||||||
|  |   ); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| apxtri.runexpress = async (tribesdns, conf) => { | apxtri.runexpress = async (tribesdns, conf) => { | ||||||
| @@ -240,12 +234,12 @@ apxtri.runexpress = async (tribesdns, conf) => { | |||||||
|   const log = conf.api.activelog |   const log = conf.api.activelog | ||||||
|     ? conf.api.activelog.includes(currentmod) |     ? conf.api.activelog.includes(currentmod) | ||||||
|     : false; |     : false; | ||||||
|    |  | ||||||
|     console.log( |   console.log( | ||||||
|       currentmod, |     currentmod, | ||||||
|       " Allowed DOMs to access to this apxtri server:", |     " Allowed DOMs to access to this apxtri server:", | ||||||
|       JSON.stringify(doms) |     JSON.stringify(doms) | ||||||
|     ); |   ); | ||||||
|   console.log(currentmod, " app.locals.tribeids", app.locals.tribeids); |   console.log(currentmod, " app.locals.tribeids", app.locals.tribeids); | ||||||
|  |  | ||||||
|   // Cors management |   // Cors management | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ | |||||||
|     "urlinit":["http://apx.adminapi","https://testwall-ants.ndda.fr"], |     "urlinit":["http://apx.adminapi","https://testwall-ants.ndda.fr"], | ||||||
|     "idxname":{"towns":"towns","nation":"nations","pagans":"alias"}, |     "idxname":{"towns":"towns","nation":"nations","pagans":"alias"}, | ||||||
|     "dns": [ |     "dns": [ | ||||||
|         "apx.adminapi" |         "adminapx.adminapi" | ||||||
|     ], |     ], | ||||||
|     "status": "unchain", |     "status": "unchain", | ||||||
|     "nationId": "ants", |     "nationId": "ants", | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| user {{sudoUser}}; | user {{{sudoUser}}}; | ||||||
| worker_processes  auto; | worker_processes  auto; | ||||||
| error_log /var/log/nginx/error.log notice; | error_log /var/log/nginx/error.log notice; | ||||||
| pid        /var/run/nginx.pid; | pid        /var/run/nginx.pid; | ||||||
| @@ -38,5 +38,5 @@ http { | |||||||
|    # Virtual Host Configs |    # Virtual Host Configs | ||||||
|    ## |    ## | ||||||
|    include /etc/nginx/conf.d/*.conf; |    include /etc/nginx/conf.d/*.conf; | ||||||
|    include {{townpath}}/*/*/nginx/*.conf; |    include {{{townpath}}}/*/*/nginx/*.conf; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,19 +1,19 @@ | |||||||
| erver { | server { | ||||||
| server_name {{website}}.{{tribe}}; | server_name {{{website}}}.{{{tribeId}}}; | ||||||
| add_header 'Access-Control-Allow-Origin' '*' always; | add_header 'Access-Control-Allow-Origin' '*' always; | ||||||
| add_header 'Access-Control-Allow-Credentials' 'true' always; | add_header 'Access-Control-Allow-Credentials' 'true' always; | ||||||
| add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always; | add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always; | ||||||
| add_header 'Access-Control-Allow-Headers' '*' always; | add_header 'Access-Control-Allow-Headers' '*' always; | ||||||
| # usefull to debug nginx conf 3 next line: | # usefull to debug nginx conf 3 next line: | ||||||
| access_log {{townpath}}/{{tribe}}/logs/nginx/{{tribe}}_{{website}}.access.log main; | access_log {{{townpath}}}/{{{tribeId}}}/logs/nginx/{{{tribeId}}}_{{{website}}}.access.log main; | ||||||
| error_log  {{townpath}}/{{tribe}}/logs/nginx/{{tribe}}_{{website}}.error.log debug; | error_log  {{{townpath}}}/{{{tribeId}}}/logs/nginx/{{{tribeId}}}_{{{website}}}.error.log debug; | ||||||
| add_header xdebug "testmsg debug:  $uri - $request - liste args: $args -  url:$arg_url - alias:$arg_alias  " always; | add_header xdebug "testmsg debug:  $uri - $request - liste args: $args -  url:$arg_url - alias:$arg_alias  " always; | ||||||
|  |  | ||||||
| set $trackme 0;  | set $trackme 0;  | ||||||
| if ( $uri ~ ^/trk/ ){ | if ( $uri ~ ^/trk/ ){ | ||||||
|     set $trackme 1; |     set $trackme 1; | ||||||
| } | } | ||||||
| access_log {{townpath}}/{{tribe}}/logs/nginx/{{tribe}}_{{website}}.trk.log tracker if=$trackme ; | access_log {{{townpath}}}/{{{tribeId}}}/logs/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;  | ||||||
| @@ -21,43 +21,31 @@ location ~* /trk/ { | |||||||
|     rewrite ^/trk/(.*)$ /$1; |     rewrite ^/trk/(.*)$ /$1; | ||||||
| }    | }    | ||||||
| location /adminapi/Checkjson.js { | location /adminapi/Checkjson.js { | ||||||
|     alias {{townpath}}/adminapi/apxtri/models/Checkjson.js; |     alias {{{townpath}}}/adminapi/apxtri/models/Checkjson.js; | ||||||
| } | } | ||||||
| location ~* /adminapi/objects/tplstrings/ { | location /setup.sh { | ||||||
|     rewrite /adminapi/objects/tplstrings/(.*$) /$1 break; |     alias {{{townpath}}}/adminapi/apxtri/setup/setup.sh; | ||||||
|     root {{townpath}}/adminapi/objects/tplstrings/; |  | ||||||
| } | } | ||||||
| location ~* /adminapi/schema/ { | location ~ ^/.*/setup.*\.tar\.gz$ { | ||||||
|     rewrite /adminapi/schema/(.*$) /$1 break; |     rewrite /(.*$)/(.*$) /$1/backups/$1 break; | ||||||
|     root {{townpath}}/adminapi/schema/; |     root /home/phil/apxtowns/testwall-ants/; | ||||||
| } |  | ||||||
| location ~* /{{tribe}}/objects/tplstrings/ { |  | ||||||
|     rewrite /{{tribe}}/objects/tplstrings/(.*$) /$1 break; |  | ||||||
|     root {{townpath}}/{{tribe}}/objects/tplstrings/; |  | ||||||
| } |  | ||||||
| location ~* /{{tribe}}/schema/ { |  | ||||||
|     rewrite /{{tribe}}/schema/(.*$) /$1 break; |  | ||||||
|     root {{townpath}}/{{tribe}}/schema/; |  | ||||||
| } | } | ||||||
| location ~* /objectimg/.*/img/ { | location ~* /objectimg/.*/img/ { | ||||||
|     rewrite /objectimg/(.*)  /$1 break; |     rewrite /objectimg/(.*)  /$1 break; | ||||||
|     root {{townpath}}/{{tribe}}/objects/; |     root {{{townpath}}}/{{{tribeId}}}/objects/; | ||||||
| }  | }  | ||||||
|  |  | ||||||
| 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 {{townpath}}/{{tribe}}/objects/wwws/cdn/; |     root {{{townpath}}}/{{{tribeId}}}/objects/wwws/cdn/; | ||||||
| } | } | ||||||
|  |  | ||||||
| location /api/ { | location /api/ { | ||||||
|     rewrite /api/(.*$) /$1 break;  |     rewrite /api/(.*$) /$1 break;  | ||||||
|     proxy_pass http://localhost:3020; |     proxy_pass http://localhost:3020; | ||||||
|     proxy_redirect off; |     proxy_redirect off; | ||||||
|     include proxy_params; |     include proxy_params; | ||||||
| } | } | ||||||
|  |  | ||||||
| location /socket/ { | location /socket/ { | ||||||
|     proxy_pass http://127.0.0.1:3030; |     proxy_pass http://127.0.0.1:3030; | ||||||
|     proxy_http_version 1.1; |     proxy_http_version 1.1; | ||||||
| @@ -66,33 +54,24 @@ location /socket/ { | |||||||
|     proxy_set_header Host $host; |     proxy_set_header Host $host; | ||||||
|     proxy_cache_bypass $http_upgrade; |     proxy_cache_bypass $http_upgrade; | ||||||
| } | } | ||||||
|  |  | ||||||
| location /apxwebapp/ { |  | ||||||
|     rewrite /apxwebapp/(.*$) /$1 break; |  | ||||||
|     root /media/phil/usbfarm/apxtowns/apxwebapp; |  | ||||||
|     index index.html index_fr.html index_en.html; |  | ||||||
| } |  | ||||||
| location /apidoc/ { | location /apidoc/ { | ||||||
|     root {{townpath}}/{{tribe}}/objects/wwws/apidoc/; |     root {{{townpath}}}/{{{tribeId}}}/objects/wwws/apidoc/; | ||||||
|     index index.html; |     index index.html; | ||||||
| } | } | ||||||
| location /appbuilder/{ |  | ||||||
|     root {{townpath}}/ndda/objects/wwws/; |  | ||||||
| } |  | ||||||
| location /src/ { | location /src/ { | ||||||
| rewrite /src/(.*$) /$1 break; |     rewrite /src/(.*$) /$1 break; | ||||||
| root {{townpath}}/{{tribe}}/objects/wwws/{{website}}/src/; |     root {{{townpath}}}/{{{tribeId}}}/objects/wwws/{{{website}}}/src/; | ||||||
| index index.html index_fr.html; |     index index.html index_fr.html index_en.html; | ||||||
| } | } | ||||||
| location / { | location / { | ||||||
| root {{townpath}}/{{tribe}}/objects/wwws/{{website}}/dist/; |     root {{{townpath}}}/{{{tribeId}}}/objects/wwws/{{{website}}}/dist/; | ||||||
| index index.html index_fr.html; |     index index.html index_fr.html index_en.html; | ||||||
| } | } | ||||||
| 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 | ||||||
| # | # | ||||||
| error_page 500 502 503 504 /50x.html; | error_page 500 502 503 504 /50x.html; | ||||||
| location = /50x.html { | location = /50x.html { | ||||||
| root /usr/local/nginx/html; |     root /usr/local/nginx/html; | ||||||
| } | } | ||||||
| } | } | ||||||
							
								
								
									
										63
									
								
								apxtri/setup/setup.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										63
									
								
								apxtri/setup/setup.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,63 @@ | |||||||
|  | #!/bin/bash | ||||||
|  | # Installation process from an existing backup to set up a new  | ||||||
|  | # See README.md for full process | ||||||
|  | # | ||||||
|  | # Create in apxtowns a town-nations | ||||||
|  | # wget {any instance url}/setup.sh | ||||||
|  | # chmode +x setup.sh | ||||||
|  | # ./setup.sh mode tribe url | ||||||
|  | # Example: | ||||||
|  | # To set up a new towns with tribe adminapi from the git repo | ||||||
|  | # To be use as a dev plateforme for apxtri | ||||||
|  | # To sync only data in existing install check in /obejcts/rsync.sh  | ||||||
|  | # .setup.sh adminapi https://testwall-ants.ndda.fr https://gitea.ndda.fr/apxtri/adminapi | ||||||
|  | # | ||||||
|  | #  Make a copy (so must manage versioning by running the same command to update | ||||||
|  | #  carefull it erase the data object with the one it gets) | ||||||
|  | #  To be use for production purpose | ||||||
|  | # .setup.sh adminapi https://testwall-ants.ndda.fr | ||||||
|  | # | ||||||
|  | #  Create a new instance of smatchit from an existing production env | ||||||
|  | # .setup.sh smatchit https://testwall-ants.ndda.fr | ||||||
|  | # | ||||||
|  | # Create a dev en from git repo | ||||||
|  | # .setup.sh smatchit https://testwall-ants.ndda.fr https://gitea.ndda.fr/smatchit/smatchit | ||||||
|  |  | ||||||
|  | tribe=$1   # name of the tribe to install | ||||||
|  | url=$2     # url to get the data from | ||||||
|  | gitrepo=$3 # url to get apxtri code from a git repo (empty if must come from a backup or the url) | ||||||
|  |  | ||||||
|  | # get  | ||||||
|  | wget "${url}/${tribe}/setup.objects.tar.gz" | ||||||
|  | if [[ $? -eq 0 ]]; then | ||||||
|  |    echo "Check the url:$url seemas not answer" | ||||||
|  |    urlko=1 | ||||||
|  | fi | ||||||
|  | if [[ "$urlok" -eq 1 || -z "$tribe" ]]; then | ||||||
|  |    echo "Command must be setup.sh adminapi https://testwall-ants.ndda.fr https://gitea.ndda.fr/apxtri/adminapi" | ||||||
|  | else | ||||||
|  |    if [ -z "$gitrepo" ]; then | ||||||
|  |       wget "${url}/${tribe}/setup.apxtri.tar.gz" | ||||||
|  |       tar -xzvf setup.apxtri.tar.gz -C . -p && rm setup.apxtri.tar.gz | ||||||
|  |       wget "${url}/${tribe}/setup.schema.tar.gz" | ||||||
|  |       tar -xzvf setup.schema.tar.gz -C . -p && rm setup.schema.tar.gz | ||||||
|  |       wget "${url}/${tribe}/setup.nginx.tar.gz" | ||||||
|  |       tar -xzvf setup.nginx.tar.gz -C . -p && rm setup.nginx.tar.gz | ||||||
|  |       echo "please change your dns accordingly with ${tribe}/nginx/ conf file" | ||||||
|  |    else | ||||||
|  |       git clone "$gitrepo" | ||||||
|  |    fi | ||||||
|  |    tar -xzvf setup.objects.tar.gz -C . -p && rm setup.objects.tar.gz | ||||||
|  |    mkdir -p "${tribe}/objects/persons" | ||||||
|  |    mkdir -p "${tribe}/objects/persons/itm" | ||||||
|  |    mkdir -p "${tribe}/objects/persons/idx" | ||||||
|  |    mkdir -p "${tribe}/tmp" | ||||||
|  |    mkdir -p "${tribe}/logs" | ||||||
|  |    mkdir -p "${tribe}/logs/nginx" | ||||||
|  |    mkdir -p "${tribe}/backups" | ||||||
|  |    sudo sed -i '/127.0.0.1 adminapx.adminapi/c\127.0.0.1 adminapx.adminapi\n' /etc/hosts | ||||||
|  |    cd "$tribe" | ||||||
|  |    yarn install | ||||||
|  |    cd ../adminapi | ||||||
|  |    yarn dev | ||||||
|  | fi | ||||||
							
								
								
									
										11
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								package.json
									
									
									
									
									
								
							| @@ -11,20 +11,18 @@ | |||||||
|     "type": "git" |     "type": "git" | ||||||
|   }, |   }, | ||||||
|   "scripts": { |   "scripts": { | ||||||
|     "startapx": "pm2 start apxtri.js --log-date-format 'DD-MM HH:mm:ss.SSS'", |     "startapx": "pm2 start ./apxtri/apxtri.js --log-date-format 'DD-MM HH:mm:ss.SSS'", | ||||||
|     "restartapx": "pm2 restart apxtri.js --log-date-format 'DD-MM HH:mm:ss.SSS'", |     "restartapx": "pm2 restart apxtri.js --log-date-format 'DD-MM HH:mm:ss.SSS'", | ||||||
|     "dev": "NODE_MODE=dev node ./apxtri/apxtri.js", |     "dev": "NODE_MODE=dev node ./apxtri/apxtri.js", | ||||||
|     "unittest": "node unittest.js", |     "unittest": "node unittest.js", | ||||||
|     "tar2prod": "rm ../objects/wwws/cdn/share/apxtriV* && tar -czf ../objects/wwws/cdn/share/apxtriV$version.tar --exclude='node_modules' --exclude='.git' ../../adminapi/apxtri ../../adminapi/schema ../../adminapi/objects ../../adminapi/template  ../../adminapi/objects/tribes/itm/adminapi.json", |     "apidoc": "apidoc -c ../$tribe/apxtri/apidoc_$tribe.json -o ../$tribe/objects/wwws/apidoc/", | ||||||
|     "apidoc": "apidoc -c ../../$tribe/apxtri/apidoc_$tribe.json -o ../../$tribe/objects/wwws/apidoc/", |  | ||||||
|     "publishtestwall": "scp -r /media/phil/usbfarm/apxtowns/dev-ants/tribes/$space phil@wall-ants://home/phil/apxtowns/testwall-ants/tribes/$space/..", |     "publishtestwall": "scp -r /media/phil/usbfarm/apxtowns/dev-ants/tribes/$space phil@wall-ants://home/phil/apxtowns/testwall-ants/tribes/$space/..", | ||||||
|     "publishwall": "scp -r /media/phil/usbfarm/apxtowns/dev-ants/tribes/$space phil@wall-ants://home/phil/apxtowns/wall-ants/tribes/$space/..", |     "publishwall": "scp -r /media/phil/usbfarm/apxtowns/dev-ants/tribes/$space phil@wall-ants://home/phil/apxtowns/wall-ants/tribes/$space/..", | ||||||
|     "publishhouse": "scp -r /media/phil/usbfarm/apxtowns/dev-ants/tribes/$space phil@house-ants://home/phil/apxtowns/house-ants/tribes/$space/..", |     "publishhouse": "scp -r /media/phil/usbfarm/apxtowns/dev-ants/tribes/$space phil@house-ants://home/phil/apxtowns/house-ants/tribes/$space/..", | ||||||
|     "src:css": "tailwindcss --watch -c ../../$tribe/objects/wwws/$webapp/tailwind.config.js -i ../../$tribe/objects/wwws/$webapp/src/static/css/twdevstyle.css -o ../../$tribe/objects/wwws/$webapp/src/static/css/twstyle.css", |     "src:css": "tailwindcss --watch -c ../$tribe/objects/wwws/$webapp/tailwind.config.js -i ../$tribe/objects/wwws/$webapp/src/static/css/twdevstyle.css -o ../$tribe/objects/wwws/$webapp/src/static/css/twstyle.css", | ||||||
|     "dist:css": "tailwindcss --minify -i ../../$tribe/objects/wwws/$webapp/src/static/css/twdevstyle.css -o ../../$tribe/objects/wwws/$webapp/dist/static/css/twstyle.css" |     "dist:css": "tailwindcss --minify -i ../$tribe/objects/wwws/$webapp/src/static/css/twdevstyle.css -o ../$tribe/objects/wwws/$webapp/dist/static/css/twstyle.css" | ||||||
|   }, |   }, | ||||||
|   "commentscript": "cf wiki apxtri doc for details: yarn startpm2 -n teswallants, yarn pm2 stop testwallants, yarn pm2 delete testwallants, yarn pm2 logs --lines 200 testwall, yarn pm2 monit -n testwallants, yarn pm2 save tribe=tribeid yarn apidoc to build apidoc  // space=adminapi/www/cdn/apidoc yarn publishtestwall ", |   "commentscript": "cf wiki apxtri doc for details: yarn startpm2 -n teswallants, yarn pm2 stop testwallants, yarn pm2 delete testwallants, yarn pm2 logs --lines 200 testwall, yarn pm2 monit -n testwallants, yarn pm2 save tribe=tribeid yarn apidoc to build apidoc  // space=adminapi/www/cdn/apidoc yarn publishtestwall ", | ||||||
|   "commentinstallprod": "A lancer en yarn 'version=1 yarn run tar2prod' pour  generer un tar d'installation disponible en ligne sur towndns/cdn/share/apxtriV.tar pour install voir le readme qui run in apxtowns mkdir newtown && tar -xf appv1.tar -C newtown", |  | ||||||
|   "maintainers": [ |   "maintainers": [ | ||||||
|     { |     { | ||||||
|       "name": "Filou", |       "name": "Filou", | ||||||
| @@ -67,7 +65,6 @@ | |||||||
|     "formidable": "^2.1.1", |     "formidable": "^2.1.1", | ||||||
|     "fs-extra": "^11.1.0", |     "fs-extra": "^11.1.0", | ||||||
|     "glob": "^7.1.2", |     "glob": "^7.1.2", | ||||||
|     "hosts": "^0.0.1", |  | ||||||
|     "jszip": "^3.7.1", |     "jszip": "^3.7.1", | ||||||
|     "jwt-simple": "^0.5.1", |     "jwt-simple": "^0.5.1", | ||||||
|     "mustache": "^2.3.0", |     "mustache": "^2.3.0", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user