Skip to content
This repository has been archived by the owner on Jan 24, 2018. It is now read-only.

Run HTTP-Proxy on Port 80? #253

Closed
rwmajor2 opened this issue Nov 30, 2016 · 8 comments
Closed

Run HTTP-Proxy on Port 80? #253

rwmajor2 opened this issue Nov 30, 2016 · 8 comments

Comments

@rwmajor2
Copy link

I am pretty new to some of this. What is the quickest way to spin up the proxy on Port 80 vs. the default 8000?

Thanks.

@minrk
Copy link
Member

minrk commented Nov 30, 2016

The quickest way is probably:

python orchestrate.py --port=80

@rwmajor2
Copy link
Author

Thanks @minrk. Bare with me, as I am new to this project. So far, I have basically done the basics on an Ubuntu 14 host in AWS.

docker pull jupyter/minimal-notebook
export TOKEN=$( head -c 30 /dev/urandom | xxd -p )
docker run --net=host -d -e CONFIGPROXY_AUTH_TOKEN=$TOKEN --name=proxy jupyter/configurable-http-proxy --default-target http://127.0.0.1:9999
docker run --net=host -d -e CONFIGPROXY_AUTH_TOKEN=$TOKEN --name=tmpnb -v /var/run/docker.sock:/docker.sock jupyter/tmpnb

This gets me up and running easy on port 8000.

When you say to run python orchestrate.py --port=80, I am not sure where I run that from. If you could provide a little more guidance, I would greatly appreciate it.

@rgbkrk
Copy link
Member

rgbkrk commented Nov 30, 2016

The proxy is run separately with tmpnb, you'll need to set the port there:

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 80

However, to do that you'd need to change options on tmpnb itself which I don't think are exposed... It would look something like:

docker run --net=host -d -e CONFIGPROXY_AUTH_TOKEN=$TOKEN \
  --name=tmpnb \
  -v /var/run/docker.sock:/docker.sock jupyter/tmpnb \
  python orchestrate.py --proxy-port 80

@rwmajor2
Copy link
Author

rwmajor2 commented Dec 1, 2016

When I attempt:

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 80

it throws an error and the container doesn't start:

13:19:34.157 - info: [ConfigProxy] Proxying http://*:80 to http://127.0.0.1:9999
13:19:34.161 - info: [ConfigProxy] Proxy API at http://localhost:81/api/routes
events.js:154
      throw er; // Unhandled 'error' event
      ^

Error: listen EACCES 0.0.0.0:80
    at Object.exports._errnoException (util.js:890:11)
    at exports._exceptionWithHostPort (util.js:913:20)
    at Server._listen2 (net.js:1221:19)
    at listen (net.js:1270:10)
    at Server.listen (net.js:1366:5)
    at Object. (/usr/local/lib/node_modules/configurable-http-proxy/bin/configurable-http-proxy:191:20)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)

@minrk
Copy link
Member

minrk commented Jan 5, 2017

You need root permissions to listen on port 80, normally, and CHP isn't run as root. You could run the proxy without --net=host and use docker to expose port 80: docker run -p 80:8000 .... You would need to use docker networks, as covered in #258 in order for everything to talk to each other:

docker network create tmpnb
docker run --network=tmpnb -p 80:8000 -d \
    -e CONFIGPROXY_AUTH_TOKEN=$TOKEN  \
    --name=proxy \
    jupyter/configurable-http-proxy \
        --default-target http://tmpnb:9999 \
        --api-ip=0.0.0.0
docker run --network=tmpnb -d \
    -e CONFIGPROXY_AUTH_TOKEN=$TOKEN \
    -e CONFIGPROXY_ENDPOINT=http://proxy:8001 \
    --name tmpnb \
    jupyter/tmpnb python orchestrate.py \
		--docker_network=tmpnb

Alternately, you could run the proxy outside docker.

@eldos-dl
Copy link

docker network create tmpnb

docker run --network=tmpnb -p 80:8000 -d -e CONFIGPROXY_AUTH_TOKEN=$TOKEN --name=proxy jupyter/configurable-http-proxy --default-target http://tmpnb:9999 --api-ip=0.0.0.0

docker run --network=tmpnb -d -e CONFIGPROXY_AUTH_TOKEN=$TOKEN -e CONFIGPROXY_ENDPOINT=http://proxy:8001 -v /var/run/docker.sock:/docker.sock --name tmpnb jupyter/tmpnb python orchestrate.py --docker_network=tmpnb --container-user=jovyan --command='jupyter notebook --no-browser --port {port} --ip=0.0.0.0 --NotebookApp.base_url=/{base_path} --NotebookApp.port_retries=0 --NotebookApp.token="" --NotebookApp.disable_check_xsrf=True'

@tanmaybaranwal
Copy link

docker network create tmpnb

export TOKEN=$( head -c 30 /dev/urandom | xxd -p )

docker run --network=tmpnb -p 80:8000 -d -e CONFIGPROXY_AUTH_TOKEN=$TOKEN --name=proxy jupyter/configurable-http-proxy --default-target http://tmpnb:9999 --api-ip=0.0.0.0

docker run --network=tmpnb -d -e CONFIGPROXY_AUTH_TOKEN=$TOKEN -e CONFIGPROXY_ENDPOINT=http://proxy:8001 -v /var/run/docker.sock:/docker.sock --name tmpnb jupyter/tmpnb python orchestrate.py --docker_network=tmpnb --container-user=jovyan --command='jupyter notebook --no-browser --port {port} --ip=0.0.0.0 --NotebookApp.base_url=/{base_path} --NotebookApp.port_retries=0 --NotebookApp.token="" --NotebookApp.disable_check_xsrf=True'

@rwmajor2
Copy link
Author

Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants