Skip to content

Commit

Permalink
Bugfix to resolve the path issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nxtautomation committed May 29, 2020
1 parent 4b154bb commit 45a4a9d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
16 changes: 8 additions & 8 deletions shared/web/interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$output = "";


// $file = "config.json";

$arr = array ();
$data = json_decode(file_get_contents("php://input"), TRUE);
$apiRequest = "";
Expand Down Expand Up @@ -125,17 +125,17 @@ function status(){
// Run Gateway
function runGateway(){
global $startScript;
global $file;
global $file, $moduleBase;
logMessage("Interface called to run Gateway ");
logEnvironment() ;

$output = shell_exec("/bin/bash $startScript 2>&1 ");
$output = shell_exec("/bin/bash $startScript $moduleBase 2>&1 ");

return status();
}

// Stop Gateway
function stopGateway() {}{
function stopGateway() {
global $stopScript;
global $file;
// Excute shell script for stoping gateway process
Expand All @@ -148,8 +148,8 @@ function stopGateway() {}{
return status();
}

// Stop Gateway
function restartGateway() {}{
// Restart Gateway
function restartGateway() {
global $stopScript;
global $startScript;
global $file;
Expand All @@ -167,7 +167,7 @@ function restartGateway() {}{
function configureGateway($port,$satellite,$apiKey,$passphrase){
global $file;
global $output;
global $configureScript;
global $configureScript, $moduleBase;
$jsonString = file_get_contents($file);
$data = json_decode($jsonString, true);

Expand All @@ -179,7 +179,7 @@ function configureGateway($port,$satellite,$apiKey,$passphrase){
file_put_contents($file, $newJsonString);

logMessage("Interface called to save parameters and configure Gateway ");
$output = shell_exec("/bin/bash $configureScript $port $satellite $apiKey $passphrase 2>&1 ");
$output = shell_exec("/bin/bash $configureScript $port $satellite $apiKey $passphrase $moduleBase 2>&1 ");



Expand Down
4 changes: 2 additions & 2 deletions shared/web/scripts/gatewayconfigure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ LOG="/var/log/$PKGNAME"
echo `date` "Gateway is getting configured" >> $LOG

export PATH=$PATH:/share/CACHEDEV1_DATA/.qpkg/container-station/bin
CONTAINER_NAME=storjlabsgateway
CONTAINER_NAME=storjlabsgatewayconfig
docker run --rm -v $(pwd)/gateway:/root/.local/share/storj/gateway --entrypoint /bin/rm storjlabs/gateway:ca666a0-v1.1.1-go1.13.8 -f /root/.local/share/storj/gateway/config.yaml

echo `date` " Saving Configuration of ${CONTAINER_NAME} ---> " >> $LOG
docker ps -a >> $LOG
cmd="docker run --rm --name ${CONTAINER_NAME} -p ${1} -v $(pwd)/gateway:/root/.local/share/storj/gateway storjlabs/gateway:ca666a0-v1.1.1-go1.13.8 setup --satellite-address ${2} --api-key ${3} --passphrase ${4} --non-interactive"
cmd="docker run --rm --name ${CONTAINER_NAME} -p ${1} -v ${5}/gateway:/root/.local/share/storj/gateway storjlabs/gateway:ca666a0-v1.1.1-go1.13.8 setup --satellite-address ${2} --api-key ${3} --passphrase ${4} --non-interactive"

echo "RUNNING ----------- $cmd ------------- " >> $LOG
output=`$cmd 2>&1 `
Expand Down
6 changes: 4 additions & 2 deletions shared/web/scripts/gatewayrun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ LOG="/var/log/$PKGNAME"
echo `date` "GATEWAY is being run" >> $LOG

export PATH=$PATH:/share/CACHEDEV1_DATA/.qpkg/container-station/bin
CONTAINER_NAME=storjlabsgateway
CONTAINER_NAME=storjlabsgatewayrun
#IMAGE_NAME=storjlabs/gateway:ca666a0-v1.1.1-go1.13.8

moduleBase=$1

echo `date` " Starting Tardigrade Gateway ${CONTAINER_NAME} ---> " >> $LOG
docker ps -a >> $LOG
cmd="docker run -d --name ${CONTAINER_NAME} -v $(pwd)/gateway:/root/.local/share/storj/gateway storjlabs/gateway:ca666a0-v1.1.1-go1.13.8 run"
cmd="docker run -d --name ${CONTAINER_NAME} -v ${moduleBase}/gateway:/root/.local/share/storj/gateway storjlabs/gateway:ca666a0-v1.1.1-go1.13.8 run"

echo "$cmd" >> $LOG
output=`$cmd >> $LOG 2>&1 `
Expand Down
2 changes: 1 addition & 1 deletion shared/web/scripts/gatewaystop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LOG="/var/log/$PKGNAME"
echo `date` "GATEWAY is being stopped " >> $LOG

export PATH=$PATH:/share/CACHEDEV1_DATA/.qpkg/container-station/bin
CONTAINER_NAME=storjlabsgateway
CONTAINER_NAME=storjlabsgatewayrun

echo `date` " Stopping ${CONTAINER_NAME} ---> " >> $LOG
docker ps -a >> $LOG
Expand Down
2 changes: 1 addition & 1 deletion shared/web/scripts/isRunning.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This script checks the running of gateway container
PKGNAME="GATEWAY"
LOG="/var/log/$PKGNAME"
CONTAINER_NAME=storjlabsgateway
CONTAINER_NAME=storjlabsgatewayrun
if [[ $# -gt 0 ]]
then
CONTAINER_NAME=$1
Expand Down

0 comments on commit 45a4a9d

Please sign in to comment.