From 0bc3f5bfaae586f314ae655920be6fbcfef211ce Mon Sep 17 00:00:00 2001 From: Geert van Geest Date: Mon, 20 Nov 2023 13:05:59 +0100 Subject: [PATCH 1/5] sets default workdir to workspace --- run_vscode_server | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/run_vscode_server b/run_vscode_server index dc03045..03020e2 100755 --- a/run_vscode_server +++ b/run_vscode_server @@ -65,7 +65,6 @@ docker volume create group docker run \ -d \ --e SUDO_PASSWORD=$MASTERPW \ -p 7000:8443 \ --name vscode_admin \ -e PASSWORD=$MASTERPW \ @@ -96,8 +95,8 @@ do -e PASSWORD=$password \ -e PUID=1000 \ -e PGID=1000 \ - -e DEFAULT_WORKSPACE=/config/workdir \ - --mount source=$user,target=/config/workdir \ + -e DEFAULT_WORKSPACE=/config/workspace \ + --mount source=$user,target=/config/workspace \ --mount source=data,target=/data,readonly \ --mount source=group,target=/group_work \ $IMAGE From 958de1873f5b64fa3ac0392c77a492599e5dd7b8 Mon Sep 17 00:00:00 2001 From: Geert van Geest Date: Mon, 20 Nov 2023 13:26:03 +0100 Subject: [PATCH 2/5] uses csv instead of tab delimited for utf-8 encoding --- generate_credentials | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generate_credentials b/generate_credentials index 6af0567..05c58c4 100755 --- a/generate_credentials +++ b/generate_credentials @@ -4,7 +4,7 @@ USAGE="Usage: generate_credentials -l [-o ] \n \n This command generates credentials for users\n \n --l tab-delimited list of users, with 2 columns: first name and last name. Required. \n +-l CSV file with users, with 2 columns: first name and last name. Required. \n -o output directory. Default: ./credentials \n -p port start. Generates ports and starts counting from this port. E.g. for Rstudio server count from 9001. Default: 10001\n -a address to use in the link (usually IP address). Required." @@ -75,8 +75,8 @@ cat $LIST | tr -d '\015\040' > $TMPULIST LIST=$TMPULIST -FIRSTL=`cat "$LIST" | cut -f 1 | tr -cd '\11\12\15\40-\176' | tr [:upper:] [:lower:] | cut -c-1` -LASTN=`cat "$LIST" | cut -f 2 | tr -cd '\11\12\15\40-\176' | tr [:upper:] [:lower:]` +FIRSTL=`cat "$LIST" | cut -f 1 -d ',' | tr -cd '\11\12\15\40-\176' | tr [:upper:] [:lower:] | cut -c-1` +LASTN=`cat "$LIST" | cut -f 2 -d ',' | tr -cd '\11\12\15\40-\176' | tr [:upper:] [:lower:]` USERNAMES=$(paste -d '-' <(echo "$FIRSTL") <(echo "$LASTN") | tr -d '-') From 17fa76b3dc5f6081e6c5e246f0e46e9c70141d76 Mon Sep 17 00:00:00 2001 From: Geert van Geest Date: Mon, 20 Nov 2023 14:13:39 +0100 Subject: [PATCH 3/5] support for csv as input --- docs/tutorial.md | 8 ++++---- examples/user_list_credentials.txt | 6 +++--- generate_credentials | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index ee4e9a1..cb395ea 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -57,12 +57,12 @@ Now, clone this repository into your home directory on the instance (`/home/ubun git clone https://github.com/sib-swiss/AWS-docker.git ``` -First, we generate some credentials (link + password). We have prepared a tab delimited file with user information to test inside the repository at `examples/user_list_credentials.txt`. It's just tab-delimited file with first names and last names: +First, we generate some credentials (link + password). We have prepared a comma delimited file with user information to test inside the repository at `examples/user_list_credentials.txt`. It's just comma-delimited file with first names and last names: ``` -Jan de Wandelaar -Piet Kopstoot -Joop Zoetemelk +Jan,de Wandelaar +Piet,Kopstoot +Joop,Zoetemelk ``` Now that we have the user list ready we can generate the credentials with the script `generate_credentials`: diff --git a/examples/user_list_credentials.txt b/examples/user_list_credentials.txt index 43cbe31..7200290 100644 --- a/examples/user_list_credentials.txt +++ b/examples/user_list_credentials.txt @@ -1,3 +1,3 @@ -Jan de Wandelaar -Piet Kopstoot -Joop Zoetemelk +Jan,de Wandelaar +Piet,Kopstoot +Joop,Zoetemelk diff --git a/generate_credentials b/generate_credentials index 05c58c4..2fda190 100755 --- a/generate_credentials +++ b/generate_credentials @@ -80,7 +80,7 @@ LASTN=`cat "$LIST" | cut -f 2 -d ',' | tr -cd '\11\12\15\40-\176' | tr [:upper:] USERNAMES=$(paste -d '-' <(echo "$FIRSTL") <(echo "$LASTN") | tr -d '-') -cat "$LIST" > $TMPTNAMES +cat "$LIST" | tr ',' '\t' > $TMPTNAMES paste $TMPTNAMES <(echo $USERNAMES | tr ' ' '\n') >> $TMPUNAMES @@ -95,7 +95,7 @@ fi for user in $USERNAMES do - openssl rand -base64 14 >> $TMPPASSWD + openssl rand -hex 4 >> $TMPPASSWD done paste $TMPUNAMES $TMPPASSWD > $TMPCOMB From fb33742d033b82288b54c0013c254aafb66a2544 Mon Sep 17 00:00:00 2001 From: Geert van Geest Date: Mon, 20 Nov 2023 14:20:09 +0100 Subject: [PATCH 4/5] changes workspace to project --- run_vscode_server | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run_vscode_server b/run_vscode_server index 03020e2..f9f859e 100755 --- a/run_vscode_server +++ b/run_vscode_server @@ -95,8 +95,8 @@ do -e PASSWORD=$password \ -e PUID=1000 \ -e PGID=1000 \ - -e DEFAULT_WORKSPACE=/config/workspace \ - --mount source=$user,target=/config/workspace \ + -e DEFAULT_WORKSPACE=/config/project \ + --mount source=$user,target=/config/project \ --mount source=data,target=/data,readonly \ --mount source=group,target=/group_work \ $IMAGE From fdf01902ff37b73166c891242180fb7912fd9526 Mon Sep 17 00:00:00 2001 From: Geert van Geest Date: Mon, 20 Nov 2023 14:54:04 +0100 Subject: [PATCH 5/5] adjustst docs for project dir --- docs/index.md | 2 +- docs/usage.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index 7c3a442..d2124d6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -153,7 +153,7 @@ There are three volumes mounted to each container: - The volume `data` is mounted to `/data`. This volume is meant to harbour read-only data (e.g. raw data). - The volume `group_work` is mounted to `/group_work`. The group volume is meant as a shared directory, where everybody can read and write. -- Each user has a personal volume, named after the username (output of `generate_credentials`). This volume is mounted to `/home/rstudio/workdir/` for rstudio, `/home/jovyan/workdir` for jupyter, and `/config/workdir` for vscode. +- Each user has a personal volume, named after the username (output of `generate_credentials`). This volume is mounted to `/home/rstudio/workdir/` for rstudio, `/home/jovyan/workdir` for jupyter, and `/config/project` for vscode. Below you can find an example of the container infrastructure. Blue squares are containers, yellow are volumes. Arrows indicate accessibility. diff --git a/docs/usage.md b/docs/usage.md index 5b4d265..5fe3922 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -11,7 +11,7 @@ In this chapter there is some general information for people (e.g. teachers/cour - In the container, you can find the following shared directories: - `/data`: read only, and shared between all running containers. This directory is used to have a single place to store data - `/group_work`: read and write enabled for all participants, and shared between all containers. This can be used to share data/scripts between students. This directory can be backed up. - - `~/workdir`: read and write enabled, and only shared between containers assigned to the same participant. This directory can be backed up and shared as a tarball at the end of the course. + - `~/project` or `~/workdir`: read and write enabled, and only shared between containers assigned to the same participant. This directory can be backed up and shared as a tarball at the end of the course. - All directories other than the shared directories only exist within the container. ## Jupyter containers