Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix jupyter systemd redirect and conda env #113

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions jupyter/internal/launch-jupyter-kernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,28 @@ set -e

echo "Installing Jupyter service..."

# Create a separate runner file to make it easier to pull in the right
# environment variables, etc,. before launching the notebook.
JUPYTER_LAUNCHER='/usr/local/bin/launch_jupyter.sh'

cat << EOF > ${JUPYTER_LAUNCHER}
#!/bin/bash

source /etc/profile.d/conda.sh
/opt/conda/bin/jupyter notebook --allow-root --no-browser
EOF
chmod 750 ${JUPYTER_LAUNCHER}

INIT_SCRIPT="/usr/lib/systemd/system/jupyter-notebook.service"

cat << EOF > ${INIT_SCRIPT}
[Unit]
Description=Start Jupyter Notebook Server at reboot
Description=Jupyter Notebook Server

[Service]
Type=simple
ExecStart=/opt/conda/bin/jupyter notebook --allow-root --no-browser \
> /var/log/jupyter_notebook.log 2>&1
ExecStart=/bin/bash -c 'exec ${JUPYTER_LAUNCHER} \
&> /var/log/jupyter_notebook.log'

[Install]
WantedBy=multi-user.target
Expand All @@ -24,6 +36,7 @@ echo "Starting Jupyter notebook..."

systemctl daemon-reload
systemctl enable jupyter-notebook
systemctl start jupyter-notebook
systemctl restart jupyter-notebook
systemctl status jupyter-notebook

echo "Jupyter installation succeeded" >&2