summaryrefslogtreecommitdiffstats
path: root/run
diff options
context:
space:
mode:
Diffstat (limited to 'run')
-rw-r--r--run/config.sh8
-rw-r--r--run/devel.sh8
-rw-r--r--run/run-devel.sh5
-rw-r--r--run/run-jupyter.sh13
-rw-r--r--run/run-ssh.sh10
-rw-r--r--run/run.sh5
-rw-r--r--run/update-from-devel.sh8
7 files changed, 38 insertions, 19 deletions
diff --git a/run/config.sh b/run/config.sh
new file mode 100644
index 0000000..048ecfb
--- /dev/null
+++ b/run/config.sh
@@ -0,0 +1,8 @@
+port="$(($(id -u)%100 + 100))"
+ssh_port="${port}22"
+web_port="${port}80"
+
+image="$1"
+[ -n "$image" ] || image="tomo-remote" # tomo-remote:latest tomo-remote:devel (also ccpi, ufo, tomo)
+
+echo "Image: $image, Ports: $ssh_port, $web_port"
diff --git a/run/devel.sh b/run/devel.sh
index ad8fa15..a15f203 100644
--- a/run/devel.sh
+++ b/run/devel.sh
@@ -2,10 +2,10 @@
set -o errexit
+. config.sh
+
if [ ! -d ../repos ]; then
- buildah unshare bash ../build/extract.sh
+ buildah unshare bash ../build/extract.sh ${image}
fi
-port="$(($(id -u) - 900))22"
-
-podman run --name "ccpi-devel" -it --rm --hooks-dir /usr/share/containers/oci/hooks.d/ -p $port:2222/tcp -v ~/ccpi/data:/ccpi/data -v ~/ccpi/repos:/ccpi/repos localhost/ccpi bash -c "bash /root/setup/provision.sh; bash"
+podman run --name "ccpi-devel" -it --rm --hooks-dir /usr/share/containers/oci/hooks.d/ -p $ssh_port:2222/tcp -v ~/ccpi/data:/ccpi/data -v ~/ccpi/repos:/ccpi/repos localhost/${image} bash -c "bash /root/setup/provision.sh; bash"
diff --git a/run/run-devel.sh b/run/run-devel.sh
deleted file mode 100644
index 2adb95c..0000000
--- a/run/run-devel.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#! /bin/bash
-
-set -o errexit
-
-podman run --name "ccpi-run" -it --rm --hooks-dir /usr/share/containers/oci/hooks.d/ -v ~/ccpi/data:/ccpi/data localhost/ccpi:devel bash
diff --git a/run/run-jupyter.sh b/run/run-jupyter.sh
new file mode 100644
index 0000000..f596a2b
--- /dev/null
+++ b/run/run-jupyter.sh
@@ -0,0 +1,13 @@
+#! /bin/bash
+
+set -o errexit
+
+. config.sh
+
+echo "Running jupyter on the port $web_port"
+echo "Create ssh tunnel and use browser to connect http://localhost:$web_port"
+echo " ssh -L $web_port:localhost:$web_port $(hostname)"
+echo "Generate password file '/ccpi/data/.jupyter/jupyter_notebook_config.json' with running in the container the following command"
+echo " jupyter notebook password"
+
+podman run --name "ccpi-run" -it --rm --hooks-dir /usr/share/containers/oci/hooks.d/ -p ${web_port}:8888/tcp -v ~/ccpi/data:/ccpi/data localhost/${image} jupyter notebook --allow-root --no-browser --ip 0.0.0.0 --port=8888 --notebook-dir=/ccpi/data/ --debug \ No newline at end of file
diff --git a/run/run-ssh.sh b/run/run-ssh.sh
index 950024a..c467334 100644
--- a/run/run-ssh.sh
+++ b/run/run-ssh.sh
@@ -2,12 +2,12 @@
set -o errexit
-port="$(($(id -u) - 900))22"
+. config.sh
-echo "Running on the port $port"
+echo "Running ssh on the port $ssh_port"
echo "Create ssh tunnel and connect:"
-echo " ssh -L $port:localhost:$port $(hostname)"
+echo " ssh -L $ssh_port:localhost:$ssh_port $(hostname)"
echo " and connect locally "
-echo " ssh -p $port localhost"
+echo " ssh -p $ssh_port localhost"
-podman run --name "ccpi-run" -it --rm --hooks-dir /usr/share/containers/oci/hooks.d/ -p ${port}:2222/tcp -v ~/ccpi/data:/ccpi/data localhost/ccpi /usr/sbin/sshd -D -p 2222
+podman run --name "ccpi-run" -it --rm --hooks-dir /usr/share/containers/oci/hooks.d/ -p ${ssh_port}:2222/tcp -v ~/ccpi/data:/ccpi/data localhost/${image} /usr/sbin/sshd -D -p 2222
diff --git a/run/run.sh b/run/run.sh
index 0010e1d..bdfade3 100644
--- a/run/run.sh
+++ b/run/run.sh
@@ -2,5 +2,6 @@
set -o errexit
-port="$(($(id -u) - 900))22"
-podman run --name "ccpi-run" -it --rm --hooks-dir /usr/share/containers/oci/hooks.d/ -p $port:2222/tcp -v ~/ccpi/data:/ccpi/data localhost/ccpi bash
+. config.sh
+
+podman run --name "ccpi-run" -it --rm --hooks-dir /usr/share/containers/oci/hooks.d/ -p ${web_port}:8888/tcp -p $ssh_port:2222/tcp -v ~/ccpi/data:/ccpi/data localhost/${image} bash
diff --git a/run/update-from-devel.sh b/run/update-from-devel.sh
index 19aee6b..b2a8b25 100644
--- a/run/update-from-devel.sh
+++ b/run/update-from-devel.sh
@@ -2,11 +2,13 @@
set -o errexit
+. config.sh
+
if [ ! -d ../repos ]; then
- buildah unshare bash ../build/extract.sh
+ buildah unshare bash ../build/extract.sh ${image}
fi
-podman run --name "ccpi-devel" -it --hooks-dir /usr/share/containers/oci/hooks.d/ -v ~/ccpi/data:/ccpi/data -v ~/ccpi/repos:/ccpi/repos localhost/ccpi bash /root/setup/provision.sh
+podman run --name "ccpi-devel" -it --hooks-dir /usr/share/containers/oci/hooks.d/ -v ~/ccpi/data:/ccpi/data -v ~/ccpi/repos:/ccpi/repos localhost/${image} bash /root/setup/provision.sh
podman container cp ../repos/ ccpi-devel:/ccpi/
-podman container commit ccpi-devel ccpi:devel
+podman container commit ccpi-devel ${image}:devel
podman rm ccpi-devel