Code Monkey home page Code Monkey logo

jupyterlabonazure's Introduction

Use case JupyterLabOnAzure: a server with jupyter lab on Azure with terraform

Use case for putting jupyter lab server with git repo support on Azure with terraform/ansible.

Build the image

Prepare credentials/id_rsa.pub public key file to enable ssh connection to VM from your own system (as well as from container via ssh auth socket forwarding, see below).

docker build --file Dockerfile --tag=strokovnjaka/uc1jupyterlab --build-arg TERRAFORM_VERSION=1.0.11 .

Test image

Run container

Prepare credentials/azure.env (e.g. from the template file credentials/azure.env.tmpl).

On MacOSX use the following for correct ssh auth socket forwarding:

docker run -itd --rm -v /run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock -e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" --env-file "credentials/azure.env" --name uc1jupylab strokovnjaka/uc1jupyterlab

On other systems probably something like:

docker run -itd --rm -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK --env-file "credentials/azure.env" --name uc1jupylab strokovnjaka/uc1jupyterlab

Step into container

docker exec -it uc1jupylab /bin/bash

Run terraform in container

Variables that can be passed e.g. via terraform.tfvars (see the vps/terraform.tfvars.tmpl template):

  • port instance's port
  • clients list of allowed IPs
  • gitrepo git repo address, https accessible
  • gituser git repo username
  • gitpass git repo access token (password not recommended)

Then initialize terraform and apply the plan:

terraform init
terraform apply

Outputs are public_ip, port, and token. Go to [public_ip]:[port] in your browser to see results. Use the token for first login. Note that you have to choose File -> Shut Down and wait ~10s for the jupyter server to restart if you choose to use password instead of token.

Push image to Docker Hub

In case you want to push the image to the hub:

docker push strokovnjaka/uc1jupyterlab

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.