| Rationale | Alternatives | Benefits | Drawbacks | Quickstart | Requirements | Personal Laptops | Nomenclature |
Depending on the Python-ecosystem used in a course, it can be tricky and time-consuming to set up individually all computers to be used by the participants. The client-server setup presented here requires from the clients, usually the machines in a computer-lab and/or personal laptops, no setup that isn't included in most standard modern operating systems. The IPython-interpreters and -Notebooks (one for each client) are run from one virtual environment (virtualenv) on a central server. The setup exploits the web-based nature of the IPython Notebook in that the participants only interact with a browser.
More fancy solutions to the problem would likely involve Docker, jupyterhub and/or tmpnb.
-
Little set-up time required.
-
The server-setup can be kept for the next course.
-
Additional modules for a course are installed once and become immediately accessible to all participants.
-
All participants work in exactly the same environment.
-
Apart from a system Python, and a Python virtual environment in a user account, no additional software needs to be installed on the server.
-
Client computers don't need Python/IPython Notebook installed at all.
-
Scales well to large numbers of clients.
-
Participants don't necessarily leave with a Python installation on their laptops that would allow them to continue programming after the course. This could be remedied by offering an after-course installation event.
-
Not tested (yet) whether that works with Windows clients.
-
Check that your computing infrastructure fulfils the Requirements.
-
Create one account on each computer-lab client, exclusively to be used for the course. The usernames should be different on each machine and will correspond to one (or a team of two) participants. These accounts need passwords.
-
Log into an administration account on the server.
-
Clone the repository on github, e.g.:
git clone https://github.com/C2SM/ipython-workshop-setup.git ./setupor click the "Download ZIP" - button on the GitHub page and uncompress.
-
Modify the file
clients-template.txtand save it asclients.txt. The format of the file is:- The first line contains
instructor_un@server, where "instructor_un" is a username for a special ("instructor") account on the server, and "server" stands for its FQDN, e.g., "climserv.dept.university.ch". - From the second line on, the first row contains
participantX@clientX, where "participantX" stands for a participant's username and "clientX" stands for the corresponding client-machine, e.g. "part05@client05.mylab.mydomain.tld". - The second row contains the corresponding passwords (of the client accounts).
- The third row contains "
participantX@server", indicating the accounts on the server, which correspond to the client accounts. These accounts will be generated automatically!. - Include participants who bring their own laptop by writing personal_laptop in the first column, an arbitrary dummy_password in the second one (not used) and an ordinary client account descriptor in the third column.
- Fields (columns) are separated by exactly one space!
- You can include a line that associates the instructor-account on the server with a client-machine account. This way you (as instructor) will have a setup identical to the participants. Do this by adding the appropriate line anywhere below the first line.
- The first line contains
-
Run
mk_server_accounts.sh. This will create the instructor- and participant-accounts on the server, install a virtualenv in the instructor-account, and install the necessary packages in this virtualenv ("necessary packages" as defined inrequirements.txt). -
Run
cpkeys.sh. This will create ssh key pairs on the clients, and copy the public key to.ssh/authorized_keysin the respective accounts on server. -
Run
clientprep.sh. This will customize thestartup_template.txtand copy it asstartup.shinto each client's $HOME. -
Copy your course Notebooks into the home-directories of the server-accounts.
-
Test the installation: Log into a client-account and run
./startup.sh. this should start an Ipython-Notebook instance in the virtualenv but on the corresponding server-participant-account, do the ssh-forwarding thing, and - after some seconds - start Firefox pointed at the Notebook. Try simultaneously with different client accounts.
-
The clients need only basic networking capabilities (ssh), a browser, a POSIX CLI (e.g. bash), and some standard POSIX utilities (sed, grep, cut, netstat). All OS X, Linux, FreeBSD, etc. systems should work out-of-the box. Windows clients would probably work with Cygwin installed, but this is not (yet) tested. Let me know in case you find something out!
-
The (computer-lab) clients need to be reachable via
sshfrom the server -
You need administrative powers on the (computer-lab) clients to be able to set up accounts.
-
The server needs a modern system-Python (it needs to match the versions of the modules you use in the course and the IPython-Notebook version).
We assume that the path to the interpreter is/usr/bin/python2.7. If that is not the case, please edit inmk_server_accounts.shthe line:virtualenv -p /usr/bin/python2.7 -
You need administrator rights on that server. You need to have an account that lets you do passwordless
sudo. -
The server must be reachable via
sshby the clients.
There should have been created server-accounts for the laptop users.
(see the keyword personal_laptop in clients.txt).
-
Collect ssh public keys from the laptop-users. If necessary have them create a key-pair using
ssh-keygen. -
Move each public key to the file
$HOME/.ssh/authorized_keysin the$HOMEof respective server-account. -
Copy
startup_template.txttostartup.shon each laptop client and replace "__user__" with the respective server-account (e.g. "part08@cimserv.dept.university.tld"), and replace "__instructor_home__" with the home directory of the instructor account on the server (e.g./home/instructor).
A helper script to set up participants' personal laptops in a more automated fashion is in the works.
client-machine: A machine used by one or
two participants. Might be a computer-lab machine or a personal
laptop. Identified by FQDN, e.g., client05.mylab.mydomain.tld.
administration account: An account that
lets you sudo to root-privileges non-interactively.
server: A machine on which the Python interpreter, Ipython, Notebook, and a virtual environment responding to the necessities of the teaching material are installed. All Notebook instances are run on this machine.
