Running tests no docker - Documentation
This commit is contained in:
parent
58a3d042ba
commit
cd46524019
26
README.md
Normal file
26
README.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Minimalist Nodejs server for mydraft application (https:/mydraft.cc)
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
**WARNING** :
|
||||||
|
This code is not a fork of "mydraftcc/ui" (https://mydraft.cc), the source code of "mydraftcc/ui" must be available at build time (https://github.com/mydraft-cc/ui).
|
||||||
|
Once the code is retrieved, i apply patches to make the xxx application compatible with the nodejs API server, and (optional) remove the code related to "UserReport".
|
||||||
|
|
||||||
|
### No docker
|
||||||
|
|
||||||
|
```
|
||||||
|
# Required
|
||||||
|
./patch.sh
|
||||||
|
# if you want to remove UserReport from the application :
|
||||||
|
#./patch.sh "optional"
|
||||||
|
cd server && npm install && ./start.sh
|
||||||
|
#You could set environment parameters in server/start.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
## Execute
|
||||||
|
|
||||||
|
## Swagger
|
||||||
|
|
||||||
|
pay **ATTENTION**
|
57
patch.sh
57
patch.sh
@ -1,14 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
##############################################################
|
||||||
###############
|
|
||||||
## D.HENRY (https://www.mytindydc.com)
|
## D.HENRY (https://www.mytindydc.com)
|
||||||
# Patchs are apply to be API nodejs compliant
|
# (required) API nodejs compliant
|
||||||
# UserReport because i don't want third party in the running app
|
# (Optional) : UserReport because i don't want third party in the running app
|
||||||
################################
|
# So default is keeping, to remove from source, execute :
|
||||||
|
# ./patch.sh "optional"
|
||||||
|
##############################################################
|
||||||
|
|
||||||
echo "[INFO]Starting applying patchs..."
|
echo "[INFO]Starting applying patches..."
|
||||||
|
|
||||||
## Usefull for nodejs-server
|
## required for nodejs-server
|
||||||
match="(const API_URL.*)(https:\/\/api.mydraft.cc)(.*)$"
|
match="(const API_URL.*)(https:\/\/api.mydraft.cc)(.*)$"
|
||||||
file="ui/src/wireframes/model/actions/loading.ts"
|
file="ui/src/wireframes/model/actions/loading.ts"
|
||||||
echo "[Patching]$match-$file"
|
echo "[Patching]$match-$file"
|
||||||
@ -16,34 +17,40 @@ echo "[Patching]$match-$file"
|
|||||||
sed -i -E "s,$match,\1\3," "$file"
|
sed -i -E "s,$match,\1\3," "$file"
|
||||||
echo " [INFO]done"
|
echo " [INFO]done"
|
||||||
|
|
||||||
## Usefull for nodejs-server
|
## required for nodejs-server
|
||||||
echo "[Patching]Replacing load route / with /get"
|
echo "[Patching]Replacing load route / with /get"
|
||||||
sed -i 's,${API_URL}/${args.tokenToRead},${API_URL}/get/${args.tokenToRead},' "$file"
|
sed -i 's,${API_URL}/${args.tokenToRead},${API_URL}/get/${args.tokenToRead},' "$file"
|
||||||
if [ "$?" != "0" ];then exit 1;fi
|
if [ "$?" != "0" ];then exit 1;fi
|
||||||
|
|
||||||
echo " [INFO]done"
|
echo " [INFO]done"
|
||||||
|
|
||||||
## Usefull for nodejs-server
|
## required for nodejs-server
|
||||||
## ContentType ERR Content-Type and application/json (needed for express body-parser)
|
## ContentType ERR Content-Type and application/json (needed for express body-parser)
|
||||||
echo "[Patching]ContentType-application/json"
|
echo "[Patching]ContentType-application/json"
|
||||||
sed -i -E "s,ContentType.*text\/json(.*)$,'Content-Type': 'application\/json\1," "$file"
|
sed -i -E "s,ContentType.*text\/json(.*)$,'Content-Type': 'application\/json\1," "$file"
|
||||||
if [ "$?" != "0" ];then exit 1;fi
|
if [ "$?" != "0" ];then exit 1;fi
|
||||||
echo " [INFO]done"
|
echo " [INFO]done"
|
||||||
|
|
||||||
## Usefull for ... me :)
|
|
||||||
echo "[Patching]Removing UserReport from application"
|
|
||||||
## Remove UserReport support
|
|
||||||
if [ -f "ui/src/core/react/UserReport.tsx" ];then
|
|
||||||
rm -r ui/src/core/react/UserReport.tsx
|
|
||||||
if [ "$?" != "0" ];then exit 1;fi
|
|
||||||
fi
|
|
||||||
## Patch tsx
|
|
||||||
files=$(grep -r "UserReport" ui/src | awk -F ":" '{print $1}' |uniq |xargs)
|
|
||||||
for f in $files
|
|
||||||
do
|
|
||||||
echo " [INFO]Patching UserReport in $f"
|
|
||||||
sed -i -E 's/.*UserReport.*//' "$f"
|
|
||||||
if [ "$?" != "0" ];then exit 1;fi
|
|
||||||
done
|
|
||||||
echo " [INFO]done"
|
|
||||||
|
|
||||||
|
##########Optional - execute with parameter "optional"
|
||||||
|
if [ "$1" == "optional" ];then
|
||||||
|
## Usefull for ... me :)
|
||||||
|
echo "[Patching]Removing UserReport from application"
|
||||||
|
## Remove UserReport support
|
||||||
|
if [ -f "ui/src/core/react/UserReport.tsx" ];then
|
||||||
|
rm -r ui/src/core/react/UserReport.tsx
|
||||||
|
if [ "$?" != "0" ];then exit 1;fi
|
||||||
|
fi
|
||||||
|
## Patch tsx
|
||||||
|
files=$(grep -r "UserReport" ui/src | awk -F ":" '{print $1}' |uniq |xargs)
|
||||||
|
for f in $files
|
||||||
|
do
|
||||||
|
echo " [INFO]Patching UserReport in $f"
|
||||||
|
sed -i -E 's/.*UserReport.*//' "$f"
|
||||||
|
if [ "$?" != "0" ];then exit 1;fi
|
||||||
|
done
|
||||||
|
echo " [INFO]done"
|
||||||
|
else
|
||||||
|
echo "[Patching]UserReport was kept, to remove it, restart : ./patch.sh \"optional\""
|
||||||
|
fi
|
||||||
|
##############################
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
# minimalist Nodejs server for mydraft application (https:/mydraft.cc)
|
|
||||||
|
|
||||||
## Swagger
|
|
||||||
|
|
||||||
## Installation (Docker)
|
|
||||||
|
|
||||||
## Execute
|
|
||||||
|
|
||||||
pay **ATTENTION**
|
|
0
server/build/.gitkeep
Normal file
0
server/build/.gitkeep
Normal file
20
server/start.sh
Executable file
20
server/start.sh
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
## those dirs are needed
|
||||||
|
pwd
|
||||||
|
for dir in "data logs"
|
||||||
|
do
|
||||||
|
if [ -d "$dir" ];then mkdir "$dir";fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Where is node or nodejs (alpine <> debian)
|
||||||
|
NODEJS="/usr/bin/nodejs"
|
||||||
|
if [ ! -f "$NODEJS" ];then
|
||||||
|
NODEJS="/usr/bin/node"
|
||||||
|
fi
|
||||||
|
## Start application
|
||||||
|
# Parameters
|
||||||
|
# listening ip address
|
||||||
|
# listening port
|
||||||
|
# Storage: maximum size of the drawing file
|
||||||
|
# (2Mo : 2 * 1024 * 1024) = 2097152
|
||||||
|
IPADDRESS=0.0.0.0 PORT=4000 JSONMAXSIZE=2097152 $NODEJS app.js
|
Reference in New Issue
Block a user