Last active
February 4, 2020 15:50
-
-
Save psychemedia/d72b396c491fe1348bc1d9badfdcce81 to your computer and use it in GitHub Desktop.
Simple docker-compose script for running OpenRefine, Jupyter notebook and postgres
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
auth_basic Protected...; | |
auth_basic_user_file /etc/nginx/.htpasswd; | |
location / { | |
root /var/www/html ; | |
index index.html; | |
auth_basic off; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
auth_basic Protected...; | |
auth_basic_user_file /etc/nginx/.htpasswd; | |
location / { | |
root /var/www/html ; | |
index index.html; | |
auth_basic off; | |
} | |
location /openrefine/ { | |
proxy_pass http://127.0.0.1:3333/; | |
} | |
#https://nathan.vertile.com/blog/2017/12/07/run-jupyter-notebook-behind-a-nginx-reverse-proxy-subpath/ | |
#Also requires a tweak to nginx.conf via /etc/nginx/conf.d and jupyter_notebook_confiig.py | |
location = /notebook { | |
rewrite ^/(.*)$ $1/ permanent; | |
} | |
location /notebook { | |
error_page 403 = @proxy_notebook; | |
deny 127.0.0.1; | |
allow all; | |
# set a webroot, if there is one | |
root /some-webroot; | |
try_files $uri @proxy_notebook; | |
} | |
location @proxy_notebook { | |
#rewrite /notebook(.*) $1 break; | |
proxy_read_timeout 300s; | |
proxy_pass http://upstream_notebook; | |
# pass some extra stuff to the backend | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-Ip $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
location ~ /notebook/api/kernels/ { | |
proxy_pass http://upstream_notebook; | |
proxy_set_header Host $host; | |
# websocket support | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade "websocket"; | |
proxy_set_header Connection "Upgrade"; | |
proxy_read_timeout 86400; | |
} | |
location ~ /notebook/terminals/ { | |
proxy_pass http://upstream_notebook; | |
proxy_set_header Host $host; | |
# websocket support | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade "websocket"; | |
proxy_set_header Connection "Upgrade"; | |
proxy_read_timeout 86400; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GIST=d72b396c491fe1348bc1d9badfdcce81 | |
git clone https://gist.github.com/$GIST.git | |
cd $GIST | |
source run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Based on: https://github.com/khezen/compose-postgres | |
version: '3.5' | |
services: | |
refine: | |
container_name: refine_container | |
image: psychemedia/openrefinedemo | |
ports: | |
- "3333:3333" | |
networks: | |
- refinet | |
restart: unless-stopped | |
jupyter: | |
container_name: refine_jupyter_notebook_container | |
image: jupyter/minimal-notebook | |
environment: | |
JUPYTER_TOKEN: 'letmein' | |
# --NotebookApp.token='' --NotebookApp.password='' | |
ports: | |
- "8888:8888" | |
volumes: | |
- ${PWD}/jupyter_notebook_config.py:/home/jovyan/.jupyter/jupyter_notebook_config.py | |
networks: | |
- refinet | |
restart: unless-stopped | |
networks: | |
refinet: | |
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<meta http-equiv="refresh" content="5" > | |
<head><title>Workbenche Online</title></head> | |
<body> | |
<h1>Workbenches Online</h1> | |
<p>Waiting for services to arrive...</p> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head><title>Workbenches Online</title></head> | |
<body> | |
<h1>BYOS Workbenches Online</h1> | |
<div>THe following servers are available (single auth to access them all): | |
<ul> | |
<li><a href="./openrefine">OpenRefine server</a> </li> | |
<li><a href="./notebook">Jupyter notebook server</a></li> | |
</ul> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Disable auth - rely on the nginx proxy | |
c.NotebookApp.token='' | |
c.NotebookApp.password='' | |
#For nginx proxy | |
c.NotebookApp.allow_origin = '*' | |
c.NotebookApp.base_url = '/notebook' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/etc/nginx/conf.d/nginx_notebook.conf | |
upstream upstream_notebook { | |
server localhost:8888; | |
keepalive 32; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USER_NAME=${USER_NAME:-test} | |
USER_PWD=${USER_PWD:-$USER_NAME} | |
apt-get update && apt-get install -y nginx apache2-utils | |
htpasswd -b -c /etc/nginx/.htpasswd $USER_NAME $USER_PWD | |
sudo ufw allow 'Nginx Full' | |
#Create a simple homepage | |
mkdir -p /var/www/html | |
mv index-load.html /var/www/html/index.html | |
mv default-base /etc/nginx/sites-available/default | |
#Get a minimal wev server running | |
nginx -s reload | |
#Install the docker containers | |
docker-compose up -d | |
#Copy over nginx settings for container services | |
mv nginx_notebook.conf /etc/nginx/conf.d/nginx_notebook.conf | |
mv default-full /etc/nginx/sites-available/default | |
#Refresh web page | |
mv index.html /var/www/html | |
#Reload nginx server | |
nginx -s reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment