Commit Graph

117 Commits

Author SHA1 Message Date
Bonnotte, Nicolas
c6c6819a6e Add /bin to sudo secure_path 2018-01-18 17:51:06 +01:00
Peter Parente
a3cfda28da Verify path prefix in test 2018-01-04 22:51:16 -05:00
Peter Parente
6fa67cc500 Append $CONDA_DIR/bin to sudo secure_path
Retain behavior when su was used instead
2018-01-04 00:09:07 -05:00
Peter Parente
fb01654930 Fix test to use bash for multiple commands 2017-12-29 19:37:07 -05:00
Peter Parente
c560907ea3 Fix missing env vars (inc. PATH) in some cases
* Refactor to use sudo to become jovyna when the
  container starts as root
* Retain all environment variables when becoming
  jovyan
* Handle start.sh without additional commands when
  launching a container as NB_USER too
2017-12-29 19:22:42 -05:00
Troels Schwarz-Linnet
0766b5f005 This is to fix running SUDO as eihter the jovyan user or root.
Please refer to alias, in bottom of commit.

> dbn
Execute the command: jupyter notebook

> dbn bash
jovyan@eedcc93a837d:~$

> dbn start.sh
Execute the command:
exit

> dbnr
Set username to: jovyan
usermod: no changes
Set jovyan GID to: 100
Execute the command: jupyter notebook
Running as root is not recommended. Use --allow-root to bypass.
exit

> dbnr bash
root@893cb78b8c9c:~#

> dbnr start.sh
Set username to: jovyan
usermod: no changes
Set jovyan GID to: 100
Execute the command:
No arguments supplied
HOSTNAME=d45c52e788b7
TERM=xterm
SHELL=/bin/bash
NB_USER=jovyan
LC_ALL=en_US.UTF-8
PATH=/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
_=/usr/bin/env
MINICONDA_VERSION=4.3.30
PWD=/home/jovyan
LANG=en_US.UTF-8
HOME=/home/jovyan
SHLVL=2
LANGUAGE=en_US.UTF-8
no_proxy=*.local, 169.254/16
DEBIAN_FRONTEND=noninteractive
CONDA_DIR=/opt/conda
NB_GID=100
NB_UID=1000
root@d45c52e788b7:~#

> dbnrs
Set username to: jovyan
usermod: no changes
Set jovyan GID to: 100
Granting jovyan sudo access
Execute the command: jupyter notebook
Copy/paste this URL into your browser when you connect for the first time, ....

> dbnrs bash
root@f293dce949db:~#

> dbnrs start.sh
Set username to: jovyan
usermod: no changes
Set jovyan GID to: 100
Granting jovyan sudo access
Execute the command:
No arguments supplied
HOSTNAME=d0cd57ea32e2
SHELL=/bin/bash
TERM=xterm
LC_ALL=en_US.UTF-8
USER=jovyan
SUDO_USER=root
SUDO_UID=0
USERNAME=jovyan
MAIL=/var/mail/jovyan
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
PWD=/home/jovyan
LANG=en_US.UTF-8
SHLVL=1
SUDO_COMMAND=/bin/bash -c env; PATH=$PATH; bash
HOME=/home/jovyan
LANGUAGE=en_US.UTF-8
LOGNAME=jovyan
SUDO_GID=0
_=/usr/bin/env
jovyan@d0cd57ea32e2:~$

> dbns
Container must be run as root to grant sudo permissions
Execute the command: jupyter notebook
Copy/paste this URL in..

> dbns bash
jovyan@ce5c2491fa32:~$

> dbns start.sh
Container must be run as root to grant sudo permissions
Execute the command:
exit

###### Build user setup
docker build -t $USER/base-notebook -f Dockerfile .

# Normal, dbn: docker-base-notebook
alias dbn='docker run -ti --rm -p 8888:8888 -v "$PWD":/home/jovyan/work --name base-notebook $USER/base-notebook'
# Root, dbnr: dbn with root
alias dbnr='docker run -ti --rm -p 8888:8888 --user root -v "$PWD":/home/jovyan/work --name base-notebook $USER/base-notebook'
# Jovyan SUDO, dbnr: dbn with SUDO for jovyan
alias dbnrs='docker run -ti --rm -p 8888:8888 --user root -e GRANT_SUDO=yes -v "$PWD":/home/jovyan/work --name base-notebook $USER/base-notebook'
# Root, fail to sudo for jovyan.
alias dbns='docker run -ti --rm -p 8888:8888 -e GRANT_SUDO=yes -v "$PWD":/home/jovyan/work --name base-notebook $USER/base-notebook'
2017-12-29 11:38:53 -05:00
Troels Schwarz-Linnet
412a17b884 Fix for granting SUDO to jovyan user and run bash commands.
Test image builded with:
> docker build -t $USER/base-notebook -f Dockerfile .

> docker run -ti --rm -p 8888:8888 -e GRANT_SUDO=yes --user root jupyter/base-notebook:033056e6d164 bash
root@84db8819258d:~#

docker run -ti --rm -p 8888:8888 -e GRANT_SUDO=yes --user root $USER/base-notebook bash
> root@c23f1fd7d279:~#

> docker run -ti --rm -p 8888:8888 -e GRANT_SUDO=yes --user root jupyter/base-notebook:033056e6d164 start.sh
Set username to: jovyan
usermod: no changes
Set jovyan GID to: 100
Granting jovyan sudo access
Execute the command:
HOSTNAME=a231202e6d1a
TERM=xterm
SHELL=/bin/bash
NB_USER=jovyan
LC_ALL=en_US.UTF-8
USER=jovyan
MAIL=/var/mail/jovyan
PATH=/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MINICONDA_VERSION=4.3.30
PWD=/home/jovyan
LANG=en_US.UTF-8
GRANT_SUDO=yes
HOME=/home/jovyan
SHLVL=1
LANGUAGE=en_US.UTF-8
no_proxy=*.local, 169.254/16
LOGNAME=jovyan
DEBIAN_FRONTEND=noninteractive
CONDA_DIR=/opt/conda
NB_GID=100
NB_UID=1000
_=/usr/bin/env
tlinnet@linmac:base-notebook$

> docker run -ti --rm -p 8888:8888 -e GRANT_SUDO=yes --user root $USER/base-notebook start.sh
Set username to: jovyan
usermod: no changes
Set jovyan GID to: 100
Granting jovyan sudo access
Execute the command:
No arguments supplied
HOSTNAME=364e5fc77224
SHELL=/bin/bash
TERM=xterm
LC_ALL=en_US.UTF-8
USER=jovyan
SUDO_USER=root
SUDO_UID=0
USERNAME=jovyan
MAIL=/var/mail/jovyan
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
PWD=/home/jovyan
LANG=en_US.UTF-8
SHLVL=1
SUDO_COMMAND=/bin/bash -c env; PATH=$PATH; bash
HOME=/home/jovyan
LANGUAGE=en_US.UTF-8
LOGNAME=jovyan
SUDO_GID=0
_=/usr/bin/env
jovyan@364e5fc77224:~$

> docker run -ti --rm -p 8888:8888 -e GRANT_SUDO=yes --user root jupyter/base-notebook:033056e6d164 start.sh echo hello
tlinnet@linmac:base-notebook$ docker run -ti --rm -p 8888:8888 -e GRANT_SUDO=yes --user root jupyter/base-notebook:033056e6d164 start.sh echo hello
Set username to: jovyan
usermod: no changes
Set jovyan GID to: 100
Granting jovyan sudo access
Execute the command: echo hello
hello
tlinnet@linmac:base-notebook$

> docker run -ti --rm -p 8888:8888 -e GRANT_SUDO=yes --user root $USER/base-notebook start.sh echo hello
Set username to: jovyan
usermod: no changes
Set jovyan GID to: 100
Granting jovyan sudo access
Execute the command: echo hello
hello
tlinnet@linmac:base-notebook$
2017-12-29 11:38:53 -05:00
Peter Parente
706194f7c0 Update jupyterlab hub ext to 0.7.0 2017-12-17 12:03:58 -05:00
Peter Parente
b45fe72323 Updating jupyterlab to 0.30.* 2017-12-17 11:41:19 -05:00
Peter Parente
240285841a Remove mount permissions test
Not really testing a docker-stacks feature, only
that docker host permissions work
2017-12-16 23:03:26 -05:00
Peter Parente
167a0cb0c4 Fix mount test on CI 2017-12-02 22:03:44 -05:00
Peter Parente
803dc0c75b Fix bogus assert, add mount test 2017-12-01 22:52:00 -05:00
Peter Parente
463490fb26 MNT: Clean npm packages and JupyterLab artifacts
Spotted while writing tests
2017-11-30 00:16:09 -05:00
Peter Parente
b9139131da Tests for NB_UID, NB_GID, GRANT_SUDO options
* Improve test container teardown
* Fix needless groupmod when NB_GID is unchanged
2017-11-30 00:15:17 -05:00
Peter Parente
8a59d74813 Refactor to share fixtures with option tests 2017-11-28 23:57:05 -05:00
Peter Parente
6ba0d59446 Add placeholder tests for base-notebook 2017-11-27 23:28:11 -05:00
Min RK
3ede1c190d Merge pull request #498 from minrk/bump-lab
bump jupyterlab and install jupyter-labhub extension
2017-11-14 14:05:38 +01:00
Min RK
3e07de95cb bump jupyterlab and install jupyter-labhub extension 2017-11-14 12:00:37 +01:00
Min RK
65e5f24aa6 bump miniconda version 2017-11-10 12:55:15 +01:00
cglewis
d91d4a8c48 MAINTAINER is deprecated, using LABEL now 2017-10-31 20:17:06 -07:00
Peter Parente
da2c5a4d00 Merge pull request #485 from tylere/master
Update jupyterlab to 0.28
2017-10-22 17:30:51 -04:00
Tyler Erickson
50b0831c8e Update jupyterlab to 0.28
Update jupyterlab from 0.27.* to 0.28.*. This allows the current
version of ipywidgets (7.0.2) to be installed.
2017-10-19 10:00:22 -07:00
Grant Nestor
40a2791b73 Upgrade to notebook 5.2.0 2017-10-13 10:26:00 -07:00
Bas Nijholt
2404602e57 jupyterhub to version 0.8 2017-10-06 13:41:18 +02:00
Grant Nestor
01c9e6c66b Upgrade to notebook 5.1 2017-09-26 11:03:38 -07:00
Min RK
38710f5819 homedir fixes
- don't relocate home if home exists (e.g. mounted volume)
- respect workdir, only cd to new home if we were in /home/jovyan/
2017-09-07 21:34:42 +02:00
Peter Parente
c138070427 Fix working directory problems with custom NB_USER
Improve start.sh logging along the way
2017-09-04 21:10:15 -04:00
Min RK
b69f43e098 remove user-facing start-singleuser.sh docs
it’s handled internally
2017-08-26 09:54:58 -04:00
Min RK
80359f314a leftover mentions of user-writable group
use `users` instead
2017-08-26 09:51:58 -04:00
Min RK
2df9c49a74 set setuid/setgid bits in fix-permissions
ensures files have the right owner:group

unfortunately, not enough to get group-writable permissions (need acl or umask for that),
so we still need to run it after each install
2017-08-26 09:50:58 -04:00
Min RK
c6c1ce4cb0 use groups for managing write-access to files
- any files the user should be able to write should have group `user-permissions` with `g+rwX`
- remove `chown` from start.sh because it is no longer needed
- add `fix-permissions` script for setting the user-writable permissions on a path
- user-permissions group as GID 10000 (is there a reason for it to have a different value?)
- containers can set group with `--group-add user-writable` if they want to run with a different uid/gid
  (without -u root -e NB_UID -e NB_GID, which make this unnecessary)
2017-08-26 09:50:56 -04:00
Min RK
93b880cb80 Merge pull request #446 from parente/doc-ports-for-lab
[ci skip] Documentation improvements
2017-08-26 09:42:44 -04:00
Peter Parente
a802e4b84d [ci skip] Copy/paste is evil 2017-08-26 09:13:22 -04:00
Peter Parente
04107c39b2 Update jupyterlab to 0.27.* 2017-08-24 14:33:13 -04:00
Peter Parente
5131f0df81 [ci skip] Doc host mount permission requirements 2017-08-22 15:46:25 -04:00
Peter Parente
09c9a4fd9c [ci skip] Add a jupyter lab example with ports 2017-08-22 14:28:23 -04:00
Peter Parente
d9716fd822 Update jupyterlab to 0.26.* 2017-08-22 14:10:33 -04:00
fouding
75742278ce fix condition-testing syntax bugs 2017-08-16 17:17:09 +08:00
Min RK
5ded1de072 Merge pull request #431 from minrk/docker-args
make jupyterhub env->cli args optional
2017-08-11 11:35:22 +02:00
Min RK
3146037b6f quote NOTEBOOK_DIR 2017-08-11 10:27:16 +02:00
Min RK
32b3d2bec2 Remove Python 2
Only Python 3 from now on
2017-08-10 16:08:30 +02:00
Min RK
695a97e4a0 make jupyterhub env->cli args optional
DockerSpawner will stop passing these args,
so make them optional.
2017-08-10 15:40:35 +02:00
Min RK
82b978b3ce Merge pull request #428 from minrk/ubu
proposal: base image on ubuntu:16.04 (LTS)
2017-08-10 14:53:35 +02:00
Peter Parente
0c68990e93 Merge pull request #425 from minrk/warn-ignored-config
warn about unused config
2017-08-09 16:39:44 -04:00
Min RK
0351f0c3b7 base image on ubuntu:16.04 2017-08-09 11:07:29 +02:00
Min RK
e91827d358 keep accepting 'yes' for GRANT_SUDO 2017-08-09 10:23:01 +02:00
Min RK
489bc324e2 warn about unused config
if some env vars are set that aren't used,
complain about it so behaviour is a bit less surprising
2017-08-07 16:07:53 +02:00
Anton Akhmerov
599bb5a3e3 update home folder and username on startup
closes #414
2017-08-03 18:08:35 +07:00
Min RK
9e6b4a5345 start.sh: fix check for if we are root
UID env is not set when launching as root, use `id -u` check instead
2017-07-21 14:33:44 +02:00
Peter Parente
e1e3f24b5d Docker Cloud build phase hooks
Must be located in the root of each docker build context
i.e., every stack folder
2017-07-09 15:59:19 -04:00