Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
feat: Add a postgres service for labs (#75)
Browse files Browse the repository at this point in the history
* Adds a second Postgres service for lab/assignment environments
netoisc authored May 23, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 9824855 commit b733c0b
Showing 6 changed files with 59 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -115,7 +115,7 @@ By default, this setup uses the `FirstUseAuthenticator` and as such accepts any

* **Data Directories**: This repo uses `docker-compose` to start all services and data volumes for JupyterHub, notebook directories, databases, and the `nbgrader exchange` directory using mounts from the host's file system.
* **Databases**: This setup relies on a standard `Postgres` database running in its own container.
* **Databases**: This setup relies on a standard `postgres` database running in its own container for the JupyterHub application and another separate and optional Postgres database for lab environments (useful to connect from user notebooks).
* **Network**: An external bridge network named `jupyter-network` is used by default. The grader service and the user notebooks are attached to this network.
2 changes: 2 additions & 0 deletions ansible/group_vars/all.yml
Original file line number Diff line number Diff line change
@@ -52,3 +52,5 @@ lti11_consumer_key: "{{ lti11_consumer_key_result }}"
lti11_shared_secret: "{{ lti11_shared_secret_result }}"

lti11_enabled: "{{ lti11_enabled_param | default('false')}}"
# Postgres for notebooks labs
postgres_labs_enabled: "{{ postgres_labs_enabled_param | default('false') }}"
36 changes: 36 additions & 0 deletions ansible/hosts.hddata
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
all:
hosts:
illumidesk:
## Required settings
#-------------------
ansible_host: 18.236.148.33
ansible_port: 22
ansible_user: ubuntu
ansible_ssh_private_key_file: ~/Documents/3blades/illumidesk/aws/ubuntu-lab-12-19.pem

# add a password only if your remote instance uses userid/password for SSH authentication
ansible_password:

## Optional settings
#-------------------
# organization name, also used for the sub-domain, such as acme
org_name: hddata

# top level domain, such as example.com
tld: illumidesk.com

# course label, such as finance101
course_id: course101

# lti 1.1 consumer key, by default this is set dynamically. add
# own value to override setting. we recommend using the openssl
# command to create secure strings: openssl rand -hex 16
lti11_consumer_key: hddata_consumer_key

# lti 1.1 shared secret, by default set dynamically. set to at
# least 32 random bytes: openssl rand -hex 32
lti11_shared_secret: hddata_shared_secret

# set to yes to use LTI 1.1
lti11_enabled: true
mnt_root: /mnt/efs/fs1
4 changes: 4 additions & 0 deletions ansible/roles/jupyterhub/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -3,6 +3,10 @@
docker_volume:
name: db-data

- name: create external postgres data volume for notebooks labs
docker_volume:
name: db-labs-data

- name: create external jupyterhub and setup-course data volume
docker_volume:
name: jupyterhub-data
15 changes: 15 additions & 0 deletions ansible/roles/jupyterhub/templates/docker-compose.yml.j2
Original file line number Diff line number Diff line change
@@ -65,6 +65,18 @@ services:
- {{mnt_root}}:{{mnt_root}}
- data:/srv/jupyterhub
- {{ working_dir }}:{{ working_dir }}
{% if postgres_labs_enabled is sameas true %}
postgres-labs:
image: postgres:11.6-alpine
container_name: postgres-labs
restart: always
environment:
- POSTGRES_DB=labs
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
volumes:
- db-labs:/var/lib/postgresql/data
{% endif %}

volumes:
data:
@@ -73,6 +85,9 @@ volumes:
db:
external:
name: db-data
db-labs:
external:
name: db-labs-data

networks:
default:
1 change: 1 addition & 0 deletions ansible/roles/notebooks/files/requirements.txt
Original file line number Diff line number Diff line change
@@ -9,5 +9,6 @@ jupyter-contrib-nbextensions==0.5
plotly==4.7.1
plotly-charts==0.5
plotly-geo==1.0
psycopg2-binary==2.8.5
yellowbrick==1.1
widgetsnbextension

0 comments on commit b733c0b

Please sign in to comment.