diff --git a/docs/index.md b/docs/index.md index 7c3a442..464eddf 100644 --- a/docs/index.md +++ b/docs/index.md @@ -37,12 +37,12 @@ git clone https://github.com/GeertvanGeest/AWS-docker.git ## Generate credentials -You can generate credentials from a tab-delimited list of users, with two columns: first name and last name. Do not use column names. Here's an example: +You can generate credentials from a comma separated list of users, with two columns: first name and last name. Do not use column names. Here's an example: ``` -Jan de Wandelaar -Piet Kopstoot -Joop Zoetemelk +Jan,de Wandelaar +Piet,Kopstoot +Joop,Zoetemelk ``` Run the script `generate_credentials.sh` like this (use `-l` to specify the user list): @@ -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/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/docs/usage.md b/docs/usage.md index 17661f4..0638607 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. - Some firewalls do not support http connections. In that case, use port forwarding instead of using the public IP address. This would require an extra user to set up the port forwarding: - Create a new user on the EC2 instance with public and private keys 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 6af0567..2fda190 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,12 +75,12 @@ 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 '-') -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 diff --git a/run_vscode_server b/run_vscode_server index dc03045..f9f859e 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/project \ + --mount source=$user,target=/config/project \ --mount source=data,target=/data,readonly \ --mount source=group,target=/group_work \ $IMAGE