Skip to content

Commit d917161

Browse files
committed
Add run-docker.sh helper script
1 parent ed11155 commit d917161

File tree

8 files changed

+34
-9
lines changed

8 files changed

+34
-9
lines changed

docs/run-in-docker.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,24 @@ Add a new group with GID 5454 which matches the user and group ID used in the rt
5454
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
5555

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

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

63-
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>"
62+
docker run -it --rm -v certs:/rt-cloud/certs brainiak/rtcloud:1.0 scripts/add-user.sh -u <username>
6463

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

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

71-
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
70+
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
71+
72+
#### Alternate simpler calls using the run-docker.sh script
73+
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.
74+
75+
scripts/run-docker.sh scripts/make-sslcert.sh -ip $IP
76+
scripts/run-docker.sh scripts/add-user.sh -u <username>
77+
scripts/run-docker.sh scripts/run-projectInterface.sh -p sample -c projects/sample/conf/sample.toml -ip $IP

scripts/add-user.sh

100644100755
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,10 @@ if [ ! -z $PASSWORD ]; then
3434
PASSWD_PARAM="-p $PASSWORD"
3535
fi
3636

37+
# activate rtcloud conda env if needed
38+
if [ -z $CONDA_DEFAULT_ENV ] || [ $CONDA_DEFAULT_ENV != "rtcloud" ]; then
39+
source ~/.bashrc
40+
conda activate rtcloud
41+
fi
42+
3743
python rtCommon/addLogin.py $USER_PARAM $PASSWD_PARAM

scripts/install-on-linux.sh

100644100755
File mode changed.

scripts/make-sslcert.sh

100644100755
File mode changed.

scripts/run-docker.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
if [ -z $PROJS_DIR ]; then
4+
if [ -d projects ]; then
5+
PROJS_DIR=$PWD/projects
6+
else
7+
echo "Must set PROJS_DIR env variable or run from directory where projects is a sub-directory"
8+
exit -1
9+
fi
10+
fi
11+
12+
echo "docker run -it --rm -v certs:/rt-cloud/certs -v $PROJS_DIR:/rt-cloud/projects -p 8888:8888 brainiak/rtcloud:1.0" "$@"
13+
docker run -it --rm -v certs:/rt-cloud/certs -v $PROJS_DIR:/rt-cloud/projects -p 8888:8888 brainiak/rtcloud:1.0 "$@"

scripts/run-fileserver.sh

100644100755
File mode changed.

scripts/run-projectInterface.sh

100644100755
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ pushd web
4444
npm run build
4545
popd
4646

47-
# activate conda python env
48-
source ~/.bashrc
49-
conda deactivate
50-
conda activate rtcloud
51-
5247
if [ -z $IP ]; then
5348
echo "Warning: no ip address supplied, credentials won't be updated"
5449
else
5550
bash scripts/make-sslcert.sh -ip $IP
5651
fi
5752

53+
# activate rtcloud conda env if needed
54+
if [ -z $CONDA_DEFAULT_ENV ] || [ $CONDA_DEFAULT_ENV != "rtcloud" ]; then
55+
source ~/.bashrc
56+
conda activate rtcloud
57+
fi
5858

5959
python projects/$PROJECT/projectMain.py $R_PARAM $CFG_PARAM $TEST_PARAM

scripts/run-tests.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)