<commit_before>#!/bin/sh

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

export TOKEN=$( head -c 30 /dev/urandom | xxd -p )
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_demo.ipynb" \
           --command="jupyter notebook --NotebookApp.base_url={base_path} --ip=0.0.0.0 --port {port} --no-browser"

# docker run --restart=always
# --mem-limit=512m
# --pool-size=4
# --cpu-shares
# --cull-timeout=3600<commit_msg>Add some variables for future use, add prefix to logs and tweak whitespace<commit_after>#!/bin/sh

export POOL_SIZE=7
export MEM_LIMIT="512m"
export OVERPROVISION_FACTOR=2
export CPU_SHARES=$(( (1024*${OVERPROVISION_FACTOR})/${POOL_SIZE} ))

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_demo.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
{'fraction_non_alphanumeric': 0.15580408792903971, 'fraction_numerical': 0.041264944080215964, 'mean_word_length': 2.684659090909091, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 7, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '709783', 'n_tokens_mistral': 1026, 'n_tokens_neox': 935, 'n_words': 201}