Running jupyterhub as a system service & Google OAuth

609 views
Skip to first unread message

Andy Van Becelaere

unread,
Jan 6, 2017, 5:13:53 PM1/6/17
to Project Jupyter
I am running Ubuntu 16.04 server on an ec2 instance.

Jupyterhub is installed and running properly before applying the following changes:

1.  Jupyterhub is started at boot as a system service following these instructions - https://github.com/jupyterhub/jupyterhub/wiki/Run-jupyterhub-as-a-system-service
2.  Google OAuthentication configuration applied following these instructions - https://github.com/jupyterhub/oauthenticator

Before making changes to /etc/jupyterhub/jupyterhub_config.py for oauthentication, system service starts, ports are assigned and everything works correctly. 
After making changes for oauthentication, the google authentication works properly.  Jupyterhub system service doesn't throw any errors, but when I run netstat -plnt, ports 8081 and 443 are not shown.  If I then start jupyterhub manually (with the same config file), no errors are thrown and the ports become active.  If I comment out the oauthentication lines and reboot, everything works properly again.

I hope this is clear.  Any help would be appreciated because I'm stumped!

Thanks in advance,

Andy

MinRK

unread,
Jan 9, 2017, 6:38:59 AM1/9/17
to Project Jupyter
Can you show the log output of JupyterHub?

-Min
 

Thanks in advance,

Andy

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/8b7903dc-3373-4937-85b9-59edbd6060e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andy Van Becelaere

unread,
Jan 9, 2017, 11:32:15 AM1/9/17
to Project Jupyter
Min,

In my jupyterhub_config.py file, I have /var/log/jupyterhub.log set for logs.  The file gets written to when I start the hub manually (see below).  If I start the hub through systemd by restarting the server or 'service juypterhub start', nothing is written to the jupyterhub.log file.  Is there another location I can pull logs for this?

When I run journalctl -u jupyterhub all I get is:
Starting LSB:  Start jupyterhub...
Started LSB:  Start jupyterhub...


Contents of jupyterhub.log when service started manually:

^[[32m[I 2017-01-09 10:27:01.174 JupyterHub app:724]^[(B^[[m Loading cookie_secret from /etc/jupyterhub/jupyterhub_cookie_secret

^[[34m[D 2017-01-09 10:27:01.175 JupyterHub app:796]^[(B^[[m Connecting to db: sqlite:///jupyterhub.sqlite

^[[33m[W 2017-01-09 10:27:01.219 JupyterHub app:365]^[(B^[[m

    Generating CONFIGPROXY_AUTH_TOKEN. Restarting the Hub will require restarting the proxy.

    Set CONFIGPROXY_AUTH_TOKEN env or JupyterHub.proxy_auth_token config to avoid this message.


^[[32m[I 2017-01-09 10:27:01.231 JupyterHub app:892]^[(B^[[m Not using whitelist. Any authenticated user will be allowed.

^[[34m[D 2017-01-09 10:27:01.241 JupyterHub app:1085]^[(B^[[m Loading state for micdsadmin from db

^[[34m[D 2017-01-09 10:27:01.242 JupyterHub app:1097]^[(B^[[m micdsadmin not running.

^[[34m[D 2017-01-09 10:27:01.250 JupyterHub app:1102]^[(B^[[m Loaded users:

    micdsadmin admin

    

^[[32m[I 2017-01-09 10:27:01.258 JupyterHub app:1453]^[(B^[[m Hub API listening on http://127.0.0.1:8081/hub/

^[[32m[I 2017-01-09 10:27:01.261 JupyterHub app:1176]^[(B^[[m Starting proxy @ http://*:443/

^[[34m[D 2017-01-09 10:27:01.261 JupyterHub app:1177]^[(B^[[m Proxy cmd: ['configurable-http-proxy', '--ip', '', '--port', '443', '--$

^[[34m[D 2017-01-09 10:27:01.465 JupyterHub app:1205]^[(B^[[m Proxy started and appears to be up

^[[32m[I 2017-01-09 10:27:01.466 JupyterHub app:1485]^[(B^[[m JupyterHub is now running at http://127.0.0.1:443/

^[[32m[I 2017-01-09 10:27:11.832 JupyterHub app:1332]^[(B^[[m Cleaning up single-user servers...

^[[32m[I 2017-01-09 10:27:11.858 JupyterHub app:1343]^[(B^[[m Cleaning up proxy[1796]...

^[[32m[I 2017-01-09 10:27:11.859 JupyterHub app:1369]^[(B^[[m ...done



On Monday, January 9, 2017 at 5:38:59 AM UTC-6, Min RK wrote:
On Fri, Jan 6, 2017 at 11:13 PM, Andy Van Becelaere <avanbe...@micds.org> wrote:
I am running Ubuntu 16.04 server on an ec2 instance.

Jupyterhub is installed and running properly before applying the following changes:

1.  Jupyterhub is started at boot as a system service following these instructions - https://github.com/jupyterhub/jupyterhub/wiki/Run-jupyterhub-as-a-system-service
2.  Google OAuthentication configuration applied following these instructions - https://github.com/jupyterhub/oauthenticator

Before making changes to /etc/jupyterhub/jupyterhub_config.py for oauthentication, system service starts, ports are assigned and everything works correctly. 
After making changes for oauthentication, the google authentication works properly.  Jupyterhub system service doesn't throw any errors, but when I run netstat -plnt, ports 8081 and 443 are not shown.  If I then start jupyterhub manually (with the same config file), no errors are thrown and the ports become active.  If I comment out the oauthentication lines and reboot, everything works properly again.

I hope this is clear.  Any help would be appreciated because I'm stumped!

Can you show the log output of JupyterHub?

-Min
 

Thanks in advance,

Andy

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.

Andy Van Becelaere

unread,
Jan 10, 2017, 11:26:50 AM1/10/17
to Project Jupyter
I don't know if this will help or not, but I ran service jupyterhub status for pam authentication vs google authentication.  With google authentication, the service is active, but not running and does not list the same processes or tasks.  Any ideas?

# status with google oauth commented out (PAM authentication enabled by default)

root@ip-x-x-x-x:/home/ubuntu# service jupyterhub status
● jupyterhub.service - LSB: Start jupyterhub
   Loaded: loaded (/etc/init.d/jupyterhub; bad; vendor preset: enabled)
   Active: active (running) since Tue 2017-01-10 10:13:49 CST; 4s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1910 ExecStop=/etc/init.d/jupyterhub stop (code=exited, status=0/SUCCESS)
  Process: 1951 ExecStart=/etc/init.d/jupyterhub start (code=exited, status=0/SUCCESS)
    Tasks: 6
   Memory: 54.1M
      CPU: 595ms
   CGroup: /system.slice/jupyterhub.service
           ├─1960 /usr/bin/python3 /usr/local/bin/jupyterhub --config=/etc/jupyterhub/jupyterhub_
           └─1964 node /usr/local/bin/configurable-http-proxy --ip  --port 443 --api-ip 127.0.0.1

Jan 10 10:13:49 ip-x-x-x-x systemd[1]: Starting LSB: Start jupyterhub...
Jan 10 10:13:49 ip-x-x-x-x systemd[1]: Started LSB: Start jupyterhub.




# status with google oauth enabled

root@ip-x-x-x-x:/home/ubuntu# service jupyterhub status
● jupyterhub.service - LSB: Start jupyterhub
   Loaded: loaded (/etc/init.d/jupyterhub; bad; vendor preset: enabled)
   Active: active (exited) since Tue 2017-01-10 10:18:08 CST; 2s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2010 ExecStop=/etc/init.d/jupyterhub stop (code=exited, status=0/SUCCESS)
  Process: 2056 ExecStart=/etc/init.d/jupyterhub start (code=exited, status=0/SUCCESS)

Jan 10 10:18:08 ip-x-x-x-x systemd[1]: Starting LSB: Start jupyterhub...
Jan 10 10:18:08 ip-x-x-x-x systemd[1]: Started LSB: Start jupyterhub.

Andy Van Becelaere

unread,
Jan 10, 2017, 3:27:28 PM1/10/17
to Project Jupyter
Out of frustration, I spun up another instance and started from scratch.  I was able to get it working this time, without figuring out what is different between the two.  Must be something in a config that I can't track down.  Thanks.
Reply all
Reply to author
Forward
0 new messages