Setting up Ansible on your local machine¶
Add the variables specific to your course¶
Clone or download the
ansible/inventoryin a text editor and replace the
<STUDENT_HUB_DOMAIN>with your Let’s Encrypt compatible domain name for the student Jupyterhub. Also replace
<STUDENT_HUB_IP_ADDRESS>with the IP address for your EC2 instance that will become the student JupyterHub (Reminder this is the value for the IPv4 Public IP address found under the “Description” tab for your EC2 instance on the AWS EC2 Dashboard).
ansible/group_vars/hubs/secrets.ymlin a text editor and replace each of the
<output of: openssl rand -hex 32>with the outputs generated by typing this in the terminal:
openssl rand -hex 32
Note: you need to call
openssl rand -hex 32twice in the terminal so that the values for
ansible/group_vars/hubs/jupyterhub.ymland edit the values for each item listed below:
Note: we have included an example Dockerfiles that could be used for building a Docker image for this course in the
rudauxrepository in the
dockerfiles/dsci-studentdirectory. The base image for this is the
jupyter/docker-stacksrepository. Many of the Dockerfiles in that repository would also be good images (or base images) for a student JupyterHub.
Note: we have included a GitHub Actions workflow in this
.github/workflows/publish_docker_images.ymlwhich is useful for automating the building and versioning of Docker images. Specifically, this workflow is triggered when the Dockerfiles are edited on GitHub, uses Semantics versioning from the commit message to figure out how to bump the version (default is minor if you don’t add specific words to your commit to change this), creates a git tag, and GitHub release based off of the version bump. Then it builds the image and publishes it on DockerHub with the same tag as is in the Git tag and GitHub release.
Add any public IP addresses of folks you need to access the JupyterHubs via ssh (for IT purposes) in
ansible/group_vars/all/ssh-public-keys.yml. The key in there is a fake key that is a placeholder.
Build the JupyterHubs using Ansible¶
To initialize the EC2 instance that will become the student JupyterHub (e.g., update all
yumpackages and reboot the machine) navigate to the
ansibledirectory and run:
make playbook PLAYBOOK=init ENV=prod
To install and configure the student JupyterHub run the following from the
make playbook PLAYBOOK=hub ENV=prod