Skip to content

Commit

Permalink
TAG
Browse files Browse the repository at this point in the history
  • Loading branch information
dacoffey committed May 9, 2021
1 parent 3042131 commit 9ad89e4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
5 changes: 3 additions & 2 deletions bin/evalxtnode
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ xtnodecmd () {
RUN_EP=$1; shift;
RUN_NAME=${RUN_NAME:-"XTNODE_`date +%s`"};
RUN_TYPE=${RUN_TYPE:-'--rm'};
MAPAPP=${MAPAPP:-$PWD};
HOST=${HOST:-'127.0.0.1'};
PORT=${PORT:-'80'};
LOGLEVEL=${LOGLEVEL:-'debug'};
docker run -it --init $RUN_TYPE --name $RUN_NAME -v $PWD:/app --env LOGLEVEL=$LOGLEVEL --env HOST=0.0.0.0 --env PORT=9 -p $HOST:$PORT:9 --entrypoint $RUN_EP cogsmith/xtnode $@;
docker run -it --init $RUN_TYPE --name $RUN_NAME -v $MAPAPP:/app --env LOGLEVEL=$LOGLEVEL --env HOST=0.0.0.0 --env PORT=9 -p $HOST:$PORT:9 --entrypoint $RUN_EP cogsmith/xtnode $@;
unset RUN_EP RUN_NAME;
};

Expand All @@ -23,4 +24,4 @@ alias xtnodeuninstall='docker update --restart no';
alias xtnodedebug='echo ; echo XTNODE=`xtnode version` ; echo HOST=$HOST ; echo PORT=$PORT ; echo ; LOGLEVEL=debug ; xtnode';
alias xtnodetrace='echo ; echo XTNODE=`xtnode version` ; echo HOST=$HOST ; echo PORT=$PORT ; echo ; LOGLEVEL=trace ; xtnode';
alias xtnodeversion='docker run --rm cogsmith/xtnode version';
alias xtnodegit='xtnodecmd xtnodegit';
alias xtnodegit='mkdir /tmp/null 2>/dev/null ; MAPAPP=/tmp/null ; xtnodecmd xtnodegit';
12 changes: 11 additions & 1 deletion bin/xtnode.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,22 @@ console.log({ NODEBIN: nodebin, NODEAPP: nodeapp, ARGS: args });
if (false) { }
else if (args[0] == 'version' || args[1] == 'version') {
console.log(XT.Meta.Version);
return;
}
else if (args[0] == 'evalxtnode' || args[1] == 'evalxtnode') {
let evalxtnode = fs.readFileSync('/bin/evalxtnode').toString();
console.log(evalxtnode);
return;
}
else if (fs.existsSync('/app/app.js')) {
else if (args[0] == 'xtnodegit' || args[1] == 'xtnodegit') {
let gitrepo = args[1]; if (args[1] == 'xtnodegit') { gitrepo = args[2]; }
let cmd = 'cd / ; git clone ' + gitrepo + ' /app';
let cmdout = XT.EXECA.commandSync(cmd, { shell: true }).stdout;
console.log(cmd);
console.log(cmdout);
}

if (fs.existsSync('/app/app.js')) {
let cmd = 'node /app/app.js ' + args.join(' ');
XT.EXECA.command(cmd).stdout.pipe(process.stdout);
}
Expand Down
6 changes: 6 additions & 0 deletions bin/xtnodegit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
cd /app
echo "$@"
echo $0
echo $1
git clone "$@" .

0 comments on commit 9ad89e4

Please sign in to comment.