Skip to content

Commit

Permalink
Add run-docker.sh helper script
Browse files Browse the repository at this point in the history
  • Loading branch information
gdoubleyew committed Sep 20, 2019
1 parent ed11155 commit d917161
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 9 deletions.
14 changes: 10 additions & 4 deletions docs/run-in-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,24 @@ Add a new group with GID 5454 which matches the user and group ID used in the rt
This will create a self-signed SSL certificate called **rtcloud.crt** to allow encrypted communication with the projectInterface. You will need to install the rtcloud.crt certificate in your browser for trusted communication. The certificate will be created in location:<br> /var/lib/docker/volumes/certs/\_data/rtcloud.crt

IP=`curl https://ifconfig.co/`
docker run --rm -v certs:/rt-cloud/certs brainiak/rtcloud:1.0 bash scripts/make-sslcert.sh -ip $IP

docker run --rm -v certs:/rt-cloud/certs brainiak/rtcloud:1.0 scripts/make-sslcert.sh -ip $IP

**Add user for web interface**<br>
The web connection to projectInterface requires a user/password to authenticate. You can create a username and password with this command.

docker run -it --rm -v certs:/rt-cloud/certs grantwallace/rtcloud:1.0 bash -cl "conda activate rtcloud; bash scripts/add-user.sh -u <username>"
docker run -it --rm -v certs:/rt-cloud/certs brainiak/rtcloud:1.0 scripts/add-user.sh -u <username>

## Run rtcloud projectInterface
Once the above installation only needs to be run once, then the projectInterface can be started whenever needed with these commands.

IP=`curl https://ifconfig.co/`
PROJS_DIR=<full_path_to_projects_dir>

docker run -it --rm -v certs:/rt-cloud/certs -v $PROJS_DIR:/rt-cloud/projects -p 8888:8888 brainiak/rtcloud:1.0 bash scripts/run-projectInterface.sh -p sample -c projects/sample/conf/sample.toml -ip $IP
docker run -it --rm -v certs:/rt-cloud/certs -v $PROJS_DIR:/rt-cloud/projects -p 8888:8888 brainiak/rtcloud:1.0 scripts/run-projectInterface.sh -p sample -c projects/sample/conf/sample.toml -ip $IP

#### Alternate simpler calls using the run-docker.sh script
The rt-cloud githup repo has a run-docker.sh script that encapsulates the docker specific call parameters in the above calls. This can make it simpler to call the functions you want within the docker image. The following show the previous commands using the run-docker.sh helper script.

scripts/run-docker.sh scripts/make-sslcert.sh -ip $IP
scripts/run-docker.sh scripts/add-user.sh -u <username>
scripts/run-docker.sh scripts/run-projectInterface.sh -p sample -c projects/sample/conf/sample.toml -ip $IP
6 changes: 6 additions & 0 deletions scripts/add-user.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ if [ ! -z $PASSWORD ]; then
PASSWD_PARAM="-p $PASSWORD"
fi

# activate rtcloud conda env if needed
if [ -z $CONDA_DEFAULT_ENV ] || [ $CONDA_DEFAULT_ENV != "rtcloud" ]; then
source ~/.bashrc
conda activate rtcloud
fi

python rtCommon/addLogin.py $USER_PARAM $PASSWD_PARAM
Empty file modified scripts/install-on-linux.sh
100644 → 100755
Empty file.
Empty file modified scripts/make-sslcert.sh
100644 → 100755
Empty file.
13 changes: 13 additions & 0 deletions scripts/run-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

if [ -z $PROJS_DIR ]; then
if [ -d projects ]; then
PROJS_DIR=$PWD/projects
else
echo "Must set PROJS_DIR env variable or run from directory where projects is a sub-directory"
exit -1
fi
fi

echo "docker run -it --rm -v certs:/rt-cloud/certs -v $PROJS_DIR:/rt-cloud/projects -p 8888:8888 brainiak/rtcloud:1.0" "$@"
docker run -it --rm -v certs:/rt-cloud/certs -v $PROJS_DIR:/rt-cloud/projects -p 8888:8888 brainiak/rtcloud:1.0 "$@"
Empty file modified scripts/run-fileserver.sh
100644 → 100755
Empty file.
10 changes: 5 additions & 5 deletions scripts/run-projectInterface.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ pushd web
npm run build
popd

# activate conda python env
source ~/.bashrc
conda deactivate
conda activate rtcloud

if [ -z $IP ]; then
echo "Warning: no ip address supplied, credentials won't be updated"
else
bash scripts/make-sslcert.sh -ip $IP
fi

# activate rtcloud conda env if needed
if [ -z $CONDA_DEFAULT_ENV ] || [ $CONDA_DEFAULT_ENV != "rtcloud" ]; then
source ~/.bashrc
conda activate rtcloud
fi

python projects/$PROJECT/projectMain.py $R_PARAM $CFG_PARAM $TEST_PARAM
Empty file modified scripts/run-tests.sh
100644 → 100755
Empty file.

0 comments on commit d917161

Please sign in to comment.