-
Notifications
You must be signed in to change notification settings - Fork 0
/
prometheus.sh
executable file
·36 lines (28 loc) · 1.57 KB
/
prometheus.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
#export POOL_SIZE=7
#export MEM_LIMIT="512m"
#export OVERPROVISION_FACTOR=2
#export CPU_SHARES=$(( (1024*${OVERPROVISION_FACTOR})/${POOL_SIZE} ))
#export IP=127.0.0.1
sudo service docker start
sudo docker build -t pyrho/minimal .
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8000
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j LOG --log-prefix='[TMPNB] '
export TOKEN=$( head -c 30 /dev/urandom | xxd -p )
# --restart=always # for docker run below
sudo docker run --net=host -d -e CONFIGPROXY_AUTH_TOKEN=$TOKEN --name=proxy \
jupyter/configurable-http-proxy --default-target http://127.0.0.1:9999 \
--port=8000 --api-port=8001
sudo docker run --net=host -d -e CONFIGPROXY_AUTH_TOKEN=$TOKEN --name=tmpnb \
-e CONFIGPROXY_ENDPOINT=http://127.0.0.1:8001 \
-v /var/run/docker.sock:/docker.sock \
jupyter/tmpnb python orchestrate.py --image='pyrho/minimal' \
--redirect-uri="/notebooks/Prometheus.ipynb" \
--command="jupyter notebook --NotebookApp.base_url={base_path} --ip=0.0.0.0 --port {port} --no-browser"
# --command='start-notebook.sh "--NotebookApp.base_url={base_path} --ip=0.0.0.0 --port {port} --no-browser --NotebookApp.trust_xheaders=True"'
# This is a script in https://github.com/jupyter/docker-stacks/blob/master/base-notebook/start-notebook.sh
# --restart=always
# --mem-limit=$MEM_LIMIT \
# --pool-size=$POOL_SIZE \
# --cpu-shares=$CPU_SHARES \
# --cull-timeout=3600