Make isso HTTPS with TLJH Traefik Proxy
Make Isso HTTPS in TLJH¶
In [ ]:
%%bash
/opt/tljh/hub/bin/traefik version
- https://github.com/jupyterhub/the-littlest-jupyterhub/blob/master/tljh/jupyterhub_config.py
- https://github.com/jupyterhub/traefik-proxy/blob/master/jupyterhub_traefik_proxy/toml.py
- https://jupyterhub-traefik-proxy.readthedocs.io/en/latest/toml.html#traefik-configuration
- https://docs.traefik.io/v1.7/basics/
- https://posativ.org/isso/docs/setup/sub-uri/
for traefik v1.7
In [ ]:
%%bash
cat << EOF | sudo tee -a /opt/tljh/state/rules.toml > /dev/null
[frontends.isso]
backend = "isso"
passHostHeader = true
[frontends.isso.routes.f1]
rule = "PathPrefixStrip:/isso/"
[backends.isso.servers.s1]
url = "http://127.0.0.1:8000"
weight = 1
EOF
In [ ]:
%env http=http:\/\/jhub.name:8000\/
%env https=https:\/\/jhub.name\/isso\/
!sed -i -e "s/$http/$https/g" ~/hexo/themes/freemind/layout/_partial/post/comment.ejs
for traefik v2.10 StripPrefix
In [ ]:
%%bash
cat << EOF | sudo tee /opt/tljh/state/rules/isso.toml > /dev/null
[http.routers.isso]
service = "isso"
rule = "PathPrefix(\`/isso/\`)"
entryPoints = [ "https",]
middlewares = ["isso"]
[http.middlewares]
[http.middlewares.isso.stripPrefix]
prefixes = ["/isso"]
[http.services.isso.loadBalancer]
passHostHeader = true
[[http.services.isso.loadBalancer.servers]]
url = "http://127.0.0.1:8000"
EOF
Change file-watch to directory in TLJH Traefik¶
In [ ]:
%%bash
cat << EOF | sudo tee /opt/tljh/state/dynamic/isso.toml > /dev/null
[frontends.isso]
backend = "isso"
passHostHeader = true
[frontends.isso.routes.f1]
rule = "PathPrefixStrip:/isso/"
[backends.isso.servers.s1]
url = "http://127.0.0.1:8000"
weight = 1
EOF
In [ ]:
!sudo /opt/tljh/hub/bin/python -m tljh.installer
In [ ]:
!sudo cat /opt/tljh/installer.log
In [ ]:
!cd ~ && make restart-isso
Isso SQLite¶
In [ ]:
%%bash
cat << EOF | sudo tee /etc/isso.conf > /dev/null
[general]
dbpath = /var/lib/isso/comments.db
host =
http://seii-saintway.github.io
https://seii-saintway.github.io
http://digitypography.xyz
https://digitypography.xyz
EOF
Open SQLite database¶
sqlite3 /var/lib/isso/comments.db
In [ ]:
import sqlite3
conn = sqlite3.connect('/var/lib/isso/comments.db')
In [ ]:
[(row[6], row[7]) for row in conn.cursor().execute('SELECT * from comments')]
Out[ ]:
In [ ]:
[row for row in conn.cursor().execute('SELECT * from preferences')]
In [ ]:
[row for row in conn.cursor().execute('SELECT * from threads')]
Out[ ]:
In [ ]:
conn.close()