Day four (part 1): jupyterhub playbook. This blocks public unsecured access on port 8000 but doesn't configure the reverse proxy yet. (SSH tunnel or similar required to access the service)
This commit is contained in:
parent
197ac5d0ef
commit
0ca44cc623
3 changed files with 1473 additions and 0 deletions
11
jupyterhub.service
Normal file
11
jupyterhub.service
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Jupyterhub
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=jupyterhub -f /etc/jupyterhub/jupyterhub_config.py
|
||||||
|
Restart=on-failure
|
||||||
|
PIDFile=/var/run/jupyterhub.pid
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
1385
jupyterhub_config.py
Normal file
1385
jupyterhub_config.py
Normal file
File diff suppressed because it is too large
Load diff
77
jupyterhubsrv.yml
Normal file
77
jupyterhubsrv.yml
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
---
|
||||||
|
- name: Install Jupyterhub
|
||||||
|
hosts: UpskillChallengeNode
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Create NodeJS directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /opt/nodesource
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: Create Jupyterhub config directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /etc/jupyterhub
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: Download NodeJS apt configuration
|
||||||
|
ansible.builtin.get_url:
|
||||||
|
url: "https://deb.nodesource.com/setup_14.x"
|
||||||
|
dest: /opt/nodesource
|
||||||
|
checksum: "sha512:a0451fa9a2d679fb43a1e703eb1ae0e0ad62da3eac73ff5a25abc71cbe908eb463ee478c1f2f7687532b56106956634afb72129572db347334bd1b7fbf99dcdc"
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: run NodeJS configuration script
|
||||||
|
ansible.builtin.shell: setup_14.x
|
||||||
|
args:
|
||||||
|
chdir: /opt/nodesource
|
||||||
|
creates: /etc/apt/sources.list.d/nodesource.list
|
||||||
|
|
||||||
|
- name: update and upgrade packages
|
||||||
|
ansible.builtin.apt:
|
||||||
|
update_cache: yes
|
||||||
|
|
||||||
|
- name: install prerequisites [apt]
|
||||||
|
ansible.builtin.apt:
|
||||||
|
package:
|
||||||
|
- sudo
|
||||||
|
- python3
|
||||||
|
- python3-pip
|
||||||
|
- gcc
|
||||||
|
- g++
|
||||||
|
- make
|
||||||
|
- build-essential
|
||||||
|
- nodejs
|
||||||
|
- nginx
|
||||||
|
- certbot
|
||||||
|
- python3-certbot-nginx
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: install prerequisites [pip]
|
||||||
|
ansible.builtin.pip:
|
||||||
|
name:
|
||||||
|
- jupyterhub
|
||||||
|
- notebook
|
||||||
|
- virtualenv
|
||||||
|
|
||||||
|
- name: install prerequisites [npm]
|
||||||
|
community.general.npm:
|
||||||
|
global: yes
|
||||||
|
name: configurable-http-proxy
|
||||||
|
|
||||||
|
- name: copy Jupyterhub service file
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: jupyterhub.service
|
||||||
|
dest: /etc/systemd/system/
|
||||||
|
|
||||||
|
- name: copy Jupyterhub config file
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: jupyterhub_config.py
|
||||||
|
dest: /etc/jupyterhub
|
||||||
|
|
||||||
|
- name: daemon-reload
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: jupyterhub
|
||||||
|
state: restarted
|
||||||
|
daemon_reload: yes
|
||||||
Reference in a new issue