home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

10 rows where issue = 1058815557 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 1

  • simonw 10

issue 1

  • Docker configuration for exercising Datasette behind Apache mod_proxy · 10 ✖

author_association 1

  • OWNER 10
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions issue performed_via_github_app
974433520 https://github.com/simonw/datasette/issues/1521#issuecomment-974433520 https://api.github.com/repos/simonw/datasette/issues/1521 IC_kwDOBm6k_c46FKzw simonw 9599 2021-11-19T20:32:29Z 2021-11-19T20:32:29Z OWNER

This configuration works great.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Docker configuration for exercising Datasette behind Apache mod_proxy 1058815557  
974388295 https://github.com/simonw/datasette/issues/1521#issuecomment-974388295 https://api.github.com/repos/simonw/datasette/issues/1521 IC_kwDOBm6k_c46E_xH simonw 9599 2021-11-19T20:00:06Z 2021-11-19T20:00:06Z OWNER

And this is the version that proxies to a base_url of /foo/bar/:

```Dockerfile FROM python:3-alpine

RUN apk add --no-cache \ apache2 \ apache2-proxy \ bash

RUN pip install datasette

ENV TINI_VERSION v0.18.0 ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /tini RUN chmod +x /tini

Append this to the end of the default httpd.conf file

RUN echo $'ServerName localhost\n\ \n\ <Proxy *>\n\ Order deny,allow\n\ Allow from all\n\ </Proxy>\n\ \n\ ProxyPass /foo/bar/ http://localhost:9000/\n\ Header add X-Proxied-By "Apache2"' >> /etc/apache2/httpd.conf

RUN echo $'Datasette' > /var/www/localhost/htdocs/index.html

WORKDIR /app

ADD https://latest.datasette.io/fixtures.db /app/fixtures.db

RUN echo $'#!/usr/bin/env bash\n\ set -e\n\ \n\ httpd -D FOREGROUND &\n\ datasette fixtures.db --setting base_url "/foo/bar/" -p 9000 &\n\ \n\ wait -n' > /app/start.sh

RUN chmod +x /app/start.sh

EXPOSE 80 ENTRYPOINT ["/tini", "--", "/app/start.sh"] ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Docker configuration for exercising Datasette behind Apache mod_proxy 1058815557  
974380798 https://github.com/simonw/datasette/issues/1521#issuecomment-974380798 https://api.github.com/repos/simonw/datasette/issues/1521 IC_kwDOBm6k_c46E97- simonw 9599 2021-11-19T19:54:26Z 2021-11-19T19:54:26Z OWNER

Got it working! Here's a Dockerfile which runs completely stand-alone (thanks to using the echo $' trick to write out the config files it needs) and successfully serves Datasette behind Apache and mod_proxy:

```Dockerfile FROM python:3-alpine

RUN apk add --no-cache \ apache2 \ apache2-proxy \ bash

RUN pip install datasette

ENV TINI_VERSION v0.18.0 ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static /tini RUN chmod +x /tini

Append this to the end of the default httpd.conf file

RUN echo $'ServerName localhost\n\ \n\ <Proxy *>\n\ Order deny,allow\n\ Allow from all\n\ </Proxy>\n\ \n\ ProxyPass / http://localhost:9000/\n\ ProxyPassReverse / http://localhost:9000/\n\ Header add X-Proxied-By "Apache2"' >> /etc/apache2/httpd.conf

WORKDIR /app

RUN echo $'#!/usr/bin/env bash\n\ set -e\n\ \n\ httpd -D FOREGROUND &\n\ datasette -p 9000 &\n\ \n\ wait -n' > /app/start.sh

RUN chmod +x /app/start.sh

EXPOSE 80 ENTRYPOINT ["/tini", "--", "/app/start.sh"] ```

Run it like this:

docker build -t datasette-apache2-proxy . docker run -p 5000:80 --rm datasette-apache2-proxy Then run this to confirm: ``` ~ % curl -i 'http://localhost:5000/-/versions.json' HTTP/1.1 200 OK Date: Fri, 19 Nov 2021 19:54:05 GMT Server: uvicorn content-type: application/json; charset=utf-8 X-Proxied-By: Apache2 Transfer-Encoding: chunked

{"python": {"version": "3.10.0", "full": "3.10.0 (default, Nov 13 2021, 03:23:03) [GCC 10.3.1 20210424]"}, "datasette": {"version": "0.59.2"}, "asgi": "3.0", "uvicorn": "0.15.0", "sqlite": {"version": "3.35.5", "fts_versions": ["FTS5", "FTS4", "FTS3"], "extensions": {"json1": null}, "compile_options": ["COMPILER=gcc-10.3.1 20210424", "ENABLE_COLUMN_METADATA", "ENABLE_DBSTAT_VTAB", "ENABLE_FTS3", "ENABLE_FTS3_PARENTHESIS", "ENABLE_FTS4", "ENABLE_FTS5", "ENABLE_GEOPOLY", "ENABLE_JSON1", "ENABLE_MATH_FUNCTIONS", "ENABLE_RTREE", "ENABLE_UNLOCK_NOTIFY", "MAX_VARIABLE_NUMBER=250000", "SECURE_DELETE", "THREADSAFE=1", "USE_URI"]}} ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Docker configuration for exercising Datasette behind Apache mod_proxy 1058815557  
974371116 https://github.com/simonw/datasette/issues/1521#issuecomment-974371116 https://api.github.com/repos/simonw/datasette/issues/1521 IC_kwDOBm6k_c46E7ks simonw 9599 2021-11-19T19:45:47Z 2021-11-19T19:45:47Z OWNER

https://github.com/krallin/tini says:

NOTE: If you are using Docker 1.13 or greater, Tini is included in Docker itself. This includes all versions of Docker CE. To enable Tini, just pass the --init flag to docker run.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Docker configuration for exercising Datasette behind Apache mod_proxy 1058815557  
974336020 https://github.com/simonw/datasette/issues/1521#issuecomment-974336020 https://api.github.com/repos/simonw/datasette/issues/1521 IC_kwDOBm6k_c46EzAU simonw 9599 2021-11-19T19:10:48Z 2021-11-19T19:10:48Z OWNER

There's a promising looking minimal Apache 2 proxy config here: https://stackoverflow.com/questions/26474476/minimal-configuration-for-apache-reverse-proxy-in-docker-container

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Docker configuration for exercising Datasette behind Apache mod_proxy 1058815557  
974334278 https://github.com/simonw/datasette/issues/1521#issuecomment-974334278 https://api.github.com/repos/simonw/datasette/issues/1521 IC_kwDOBm6k_c46EylG simonw 9599 2021-11-19T19:08:09Z 2021-11-19T19:08:09Z OWNER

Stripping comments using this StackOverflow recipe: https://unix.stackexchange.com/a/157619

docker run -it --entrypoint sh alpine-apache2-sh \
  -c "cat /etc/apache2/httpd.conf" | sed '/^[[:blank:]]*#/d;s/#.*//'

Result is here: https://gist.github.com/simonw/0a05090df5fcff8e8b3334621fa17976

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Docker configuration for exercising Datasette behind Apache mod_proxy 1058815557  
974332787 https://github.com/simonw/datasette/issues/1521#issuecomment-974332787 https://api.github.com/repos/simonw/datasette/issues/1521 IC_kwDOBm6k_c46EyNz simonw 9599 2021-11-19T19:05:52Z 2021-11-19T19:05:52Z OWNER

Made myself this Dockerfile to let me explore a bit: ```Dockerfile FROM python:3-alpine

RUN apk add --no-cache \ apache2

CMD ["sh"] Then: % docker run alpine-apache2-sh % docker run -it alpine-apache2-sh / # ls /etc/apache2/httpd.conf /etc/apache2/httpd.conf / # cat /etc/apache2/httpd.conf

This is the main Apache HTTP server configuration file. It contains the

configuration directives that give the server its instructions.

... Copying that into a GIST like so: docker run -it --entrypoint sh alpine-apache2-sh -c "cat /etc/apache2/httpd.conf" | pbcopy ``` Gist here: https://gist.github.com/simonw/5ea0db6049192cb9f761fbd6beb3a84a

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Docker configuration for exercising Datasette behind Apache mod_proxy 1058815557  
974327812 https://github.com/simonw/datasette/issues/1521#issuecomment-974327812 https://api.github.com/repos/simonw/datasette/issues/1521 IC_kwDOBm6k_c46ExAE simonw 9599 2021-11-19T18:58:49Z 2021-11-19T18:59:55Z OWNER

From this example: https://github.com/tigelane/dockerfiles/blob/06cff2ac8cdc920ebd64f50965115eaa3d0afb84/Alpine-Apache2/Dockerfile#L25-L31 it looks like running apk add apache2 installs a config file at /etc/apache2/httpd.conf - so one approach is to then modify that file.

```

APACHE - Alpine

RUN apk --update add apache2 php5-apache2 && \ #apk add openrc --no-cache && \ rm -rf /var/cache/apk/* && \ sed -i 's/#ServerName www.example.com:80/ServerName localhost/' /etc/apache2/httpd.conf && \ mkdir -p /run/apache2/

Upload our files from folder "dist".

COPY dist /var/www/localhost/htdocs

Manually set up the apache environment variables

ENV APACHE_RUN_USER www-data ENV APACHE_RUN_GROUP www-data ENV APACHE_LOG_DIR /var/log/apache2 ENV APACHE_LOCK_DIR /var/lock/apache2 ENV APACHE_PID_FILE /var/run/apache2.pid

Execute apache2 on run

EXPOSE 80 ENTRYPOINT ["httpd"] CMD ["-D", "FOREGROUND"] ```

I think I'll create my own separate copy and modify that.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Docker configuration for exercising Datasette behind Apache mod_proxy 1058815557  
974321391 https://github.com/simonw/datasette/issues/1521#issuecomment-974321391 https://api.github.com/repos/simonw/datasette/issues/1521 IC_kwDOBm6k_c46Evbv simonw 9599 2021-11-19T18:49:15Z 2021-11-19T18:57:18Z OWNER

This pattern looks like it can help: https://ahmet.im/blog/cloud-run-multiple-processes-easy-way/ - see example in https://github.com/ahmetb/multi-process-container-lazy-solution

I got that demo working locally like this:

bash cd /tmp git clone https://github.com/ahmetb/multi-process-container-lazy-solution cd multi-process-container-lazy-solution docker build -t multi-process-container-lazy-solution . docker run -p 5000:8080 --rm multi-process-container-lazy-solution

I want to use apache2 rather than nginx though. I found a few relevant examples of Apache in Alpine:

  • https://github.com/Hacking-Lab/alpine-apache2-reverse-proxy/blob/master/Dockerfile
  • https://www.sentiatechblog.com/running-apache-in-a-docker-container
  • https://github.com/search?l=Dockerfile&q=alpine+apache2&type=code
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Docker configuration for exercising Datasette behind Apache mod_proxy 1058815557  
974322178 https://github.com/simonw/datasette/issues/1521#issuecomment-974322178 https://api.github.com/repos/simonw/datasette/issues/1521 IC_kwDOBm6k_c46EvoC simonw 9599 2021-11-19T18:50:22Z 2021-11-19T18:50:22Z OWNER

I'll get this working on my laptop first, but then I want to get it up and running on Cloud Run - maybe with a GitHub Actions workflow in this repo that re-deploys it on manual execution.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
Docker configuration for exercising Datasette behind Apache mod_proxy 1058815557  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
, [performed_via_github_app] TEXT);
CREATE INDEX [idx_issue_comments_issue]
                ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
                ON [issue_comments] ([user]);
Powered by Datasette · Queries took 21.31ms · About: github-to-sqlite
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows