You should have recieved a invitation to a eWatercycle collaborative organization, please follow instructions in email.
The username you should use to login can be found on on SRC dashboard profile page
- To login to the Explorer or Jupyter environment, you should setup TOTP on SRC dashboard profile page, this is your password on the server.
- Optionally to login into machine with
ssh
, your SSH public key on your laptop/workstation must be added to https://sbs.sram.surf.nl/profile
The Jupyter notebooks that you write should be saved outside the Jupyter server. Code like notebooks can be saved git repositories on GitHub.
- 1. Create GitHub account
- 2. Create GitHub repository
- 3. Setup authenication on server
- 4. Clone repository
- 5. Add & commit & push notebooks on server to GitHub
- 6. Pull changes from GitHub to server
To store notebooks in a repository on GitHub you need an account. Goto https://github.com/signup to create an account.
-
Goto https://github.com/new to create a repository.
-
Fill the form
- For .gitignore select the
Python
template, it will prevent you from commiting auto generated files - Make sure to pick a license like Apache-2.0 so others know what they can do with code in the repository
- For .gitignore select the
To clone private repositories or push changes to public repositories you need to setup authentication against GitHub. You can do this by creating a SSH key pair on the server and register the public key on GitHub.
-
On the server open a terminal.
-
Create a SSH key pair with following command
ssh-keygen -t ed25519 -C "[email protected]" -N "" -f ~/.ssh/id_ed25519
Replace
[email protected]
with the email adress you used for your GitHub account. -
Copy the content of
~/.ssh/id_ed25519.pub
to clipboard.In a Jupyter terminal run
cat ~/.ssh/id_ed25519.pub
, select the content, use SHIFT-right click to get context menu and then selectcopy
) -
Register the public key on GitHub by going to https://github.com/settings/ssh/new
- For title use name of server where you generated SSH key pair.
- Paste contents of clipboard in key text area.
- Press green button to add the key
You are now ready to clone a repository.
For brevity and easyness only SSH key pair without passphrase is explained, see GitHub docs for alternatives and more secure methods.
On the GitHub repository page there is a green Code
button, open it to get the SSH git URL of the repository.
It should look something like [email protected]:<user name>/<repository>.git
-
On the server open a terminal
-
Run the following command to clone a repo
git clone [email protected]:<user name>/<repository>.git
Replace
<user name>
and<repository>
with your username and repository name respectivly.- For the first time it will prompt if you want to connect to github.com, enter
yes
followed by enter.
- For the first time it will prompt if you want to connect to github.com, enter
You will now have a local copy of the repository.
Following commands should be run in a terminal on the server inside the repository directory.
To add a file to git staging use
git add <filename>
To commit the file to git you first need tell git who you are with
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
(Replace [email protected]
with the email adress you used for your GitHub account and fill in your full name)
To commit use
git commit -m "some message"
Replace some message
text that describes changes that where made since last commit.
Now your changes have been saved locally, to push them to GitHub use
git push
If files on GitHub and you want to pull those changes to the server then in terimal use
git pull
The git commands can also be done using the Git tab in the Jupyter Lab environment.
The default Jupyter kernel is read-only and has the eWaterCycle Python package and friends installed. To install additional Python or Conda packages you need to create your own conda environment with a Jupyter kernel.
- Install eWaterCycle Python package dependencies with user chosen Conda environment name.
- Get the eWaterCycle
environment.yml
file:
wget https://raw.githubusercontent.com/eWaterCycle/ewatercycle/main/environment.yml
- Create your own conda environment e.g.
testewatercycle
:
mamba env create --file environment.yml --name testewatercycle
- Install eWaterCycle Python package
- Activate your own conda environment e.g.
testewatercycle
:
conda activate testewatercycle
- Install eWaterCycle Python package:
pip install ewatercycle
or
pip install -e .[dev]
to be in development mode if you have the source code.
- Install Jupyter kernel
- Install
ipykernel
:
mamba install -c conda-forge ipykernel
- Get the path to python in our own conda environment:
which python
that returns
/home/usr/.conda/envs/testewatercycle/bin/python
- Add it to Jupyter:
/home/usr/.conda/envs/testewatercycle/bin/python -m ipykernel install --user --name 'testewatercycle'
that returns
Installed kernelspec testewatercycle in /home/usr/.local/share/jupyter/kernels/testewatercycle
-
Restart your own Jupyter server from tab
File > Hub Control Panel
-
Open a notebook and pick the new kernel that is
testewatercycle
-
Install additional software