Skip to content

Commit

Permalink
Merge pull request #8 from sib-swiss/improve-vscode
Browse files Browse the repository at this point in the history
Improve vscode
  • Loading branch information
GeertvanGeest authored Nov 20, 2023
2 parents 7931a1a + fdf0190 commit 312a1f9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
8 changes: 4 additions & 4 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions examples/user_list_credentials.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Jan de Wandelaar
Piet Kopstoot
Joop Zoetemelk
Jan,de Wandelaar
Piet,Kopstoot
Joop,Zoetemelk
10 changes: 5 additions & 5 deletions generate_credentials
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ USAGE="Usage: generate_credentials -l <user list> [-o <outdir>] \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."
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
5 changes: 2 additions & 3 deletions run_vscode_server
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ docker volume create group

docker run \
-d \
-e SUDO_PASSWORD=$MASTERPW \
-p 7000:8443 \
--name vscode_admin \
-e PASSWORD=$MASTERPW \
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 312a1f9

Please sign in to comment.