2021-02-26 15:49:40 +00:00
|
|
|
FROM python:3.8-slim as builder
|
2020-04-08 20:05:28 +00:00
|
|
|
|
Add tor and http/socks proxy support (#137)
* Add tor and http/socks proxy support
Allows users to enable/disable tor from the config menu, which will
forward all requests through Tor.
Also adds support for setting environment variables for alternative
proxy support. Setting the following variables will forward requests
through the proxy:
- WHOOGLE_PROXY_USER (optional)
- WHOOGLE_PROXY_PASS (optional)
- WHOOGLE_PROXY_TYPE (required)
- Can be "http", "socks4", or "socks5"
- WHOOGLE_PROXY_LOC (required)
- Format: "<ip address>:<port>"
See #30
* Refactor acquire_tor_conn -> acquire_tor_identity
Also updated travis CI to set up tor
* Add check for Tor socket on init, improve Tor error handling
Initializing the app sends a heartbeat request to Tor to check for
availability, and updates the home page config options accordingly. This
heartbeat is sent on every request, to ensure Tor support can be
reconfigured without restarting the entire app.
If Tor support is enabled, and a subsequent request fails, then a new
TorError exception is raised, and the Tor feature is disabled until a
valid connection is restored.
The max attempts has been updated to 10, since 5 seemed a bit too low
for how quickly the attempts go by.
* Change send_tor_signal arg type, update function doc
send_tor_signal now accepts a stem.Signal arg (a bit cleaner tbh). Also
added the doc string for the "disable" attribute in TorError.
* Fix tor identity logic in Request.send
* Update proxy init, change proxyloc var name
Proxy is now only initialized if both type and location are specified,
as neither have a default fallback and both are required. I suppose the
type could fall back to http, but seems safer this way.
Also refactored proxyurl -> proxyloc for the runtime args in order to
match the Dockerfile args.
* Add tor/proxy support for Docker builds, fix opensearch/init
The Dockerfile is now updated to include support for Tor configuration,
with a working torrc file included in the repo.
An issue with opensearch was fixed as well, which was uncovered during
testing and was simple enough to fix here. Likewise, DDG bang gen was
updated to only ever happen if the file didn't exist previously, as
testing with the file being regenerated every time was tedious.
* Add missing "@" for socks proxy requests
2020-10-29 00:47:42 +00:00
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
build-essential \
|
2021-01-05 22:53:58 +00:00
|
|
|
libxml2-dev \
|
|
|
|
libxslt-dev \
|
2021-02-26 17:04:06 +00:00
|
|
|
libssl-dev \
|
2021-02-26 15:49:40 +00:00
|
|
|
libffi-dev
|
Add tor and http/socks proxy support (#137)
* Add tor and http/socks proxy support
Allows users to enable/disable tor from the config menu, which will
forward all requests through Tor.
Also adds support for setting environment variables for alternative
proxy support. Setting the following variables will forward requests
through the proxy:
- WHOOGLE_PROXY_USER (optional)
- WHOOGLE_PROXY_PASS (optional)
- WHOOGLE_PROXY_TYPE (required)
- Can be "http", "socks4", or "socks5"
- WHOOGLE_PROXY_LOC (required)
- Format: "<ip address>:<port>"
See #30
* Refactor acquire_tor_conn -> acquire_tor_identity
Also updated travis CI to set up tor
* Add check for Tor socket on init, improve Tor error handling
Initializing the app sends a heartbeat request to Tor to check for
availability, and updates the home page config options accordingly. This
heartbeat is sent on every request, to ensure Tor support can be
reconfigured without restarting the entire app.
If Tor support is enabled, and a subsequent request fails, then a new
TorError exception is raised, and the Tor feature is disabled until a
valid connection is restored.
The max attempts has been updated to 10, since 5 seemed a bit too low
for how quickly the attempts go by.
* Change send_tor_signal arg type, update function doc
send_tor_signal now accepts a stem.Signal arg (a bit cleaner tbh). Also
added the doc string for the "disable" attribute in TorError.
* Fix tor identity logic in Request.send
* Update proxy init, change proxyloc var name
Proxy is now only initialized if both type and location are specified,
as neither have a default fallback and both are required. I suppose the
type could fall back to http, but seems safer this way.
Also refactored proxyurl -> proxyloc for the runtime args in order to
match the Dockerfile args.
* Add tor/proxy support for Docker builds, fix opensearch/init
The Dockerfile is now updated to include support for Tor configuration,
with a working torrc file included in the repo.
An issue with opensearch was fixed as well, which was uncovered during
testing and was simple enough to fix here. Likewise, DDG bang gen was
updated to only ever happen if the file didn't exist previously, as
testing with the file being regenerated every time was tedious.
* Add missing "@" for socks proxy requests
2020-10-29 00:47:42 +00:00
|
|
|
|
2020-05-10 12:00:22 +00:00
|
|
|
COPY requirements.txt .
|
2021-02-26 15:49:40 +00:00
|
|
|
|
|
|
|
RUN pip install --prefix /install --no-warn-script-location --no-cache-dir -r requirements.txt
|
|
|
|
|
|
|
|
FROM python:3.8-slim
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
libcurl4-openssl-dev \
|
|
|
|
tor \
|
2021-04-05 16:03:17 +00:00
|
|
|
wget \
|
2021-02-26 15:49:40 +00:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2020-05-10 12:00:22 +00:00
|
|
|
|
2020-05-14 00:27:04 +00:00
|
|
|
ARG config_dir=/config
|
2020-05-16 15:11:00 +00:00
|
|
|
RUN mkdir -p $config_dir
|
2020-05-14 00:27:04 +00:00
|
|
|
VOLUME $config_dir
|
|
|
|
ENV CONFIG_VOLUME=$config_dir
|
|
|
|
|
2020-05-18 16:30:32 +00:00
|
|
|
ARG username=''
|
|
|
|
ENV WHOOGLE_USER=$username
|
|
|
|
ARG password=''
|
|
|
|
ENV WHOOGLE_PASS=$password
|
|
|
|
|
Add tor and http/socks proxy support (#137)
* Add tor and http/socks proxy support
Allows users to enable/disable tor from the config menu, which will
forward all requests through Tor.
Also adds support for setting environment variables for alternative
proxy support. Setting the following variables will forward requests
through the proxy:
- WHOOGLE_PROXY_USER (optional)
- WHOOGLE_PROXY_PASS (optional)
- WHOOGLE_PROXY_TYPE (required)
- Can be "http", "socks4", or "socks5"
- WHOOGLE_PROXY_LOC (required)
- Format: "<ip address>:<port>"
See #30
* Refactor acquire_tor_conn -> acquire_tor_identity
Also updated travis CI to set up tor
* Add check for Tor socket on init, improve Tor error handling
Initializing the app sends a heartbeat request to Tor to check for
availability, and updates the home page config options accordingly. This
heartbeat is sent on every request, to ensure Tor support can be
reconfigured without restarting the entire app.
If Tor support is enabled, and a subsequent request fails, then a new
TorError exception is raised, and the Tor feature is disabled until a
valid connection is restored.
The max attempts has been updated to 10, since 5 seemed a bit too low
for how quickly the attempts go by.
* Change send_tor_signal arg type, update function doc
send_tor_signal now accepts a stem.Signal arg (a bit cleaner tbh). Also
added the doc string for the "disable" attribute in TorError.
* Fix tor identity logic in Request.send
* Update proxy init, change proxyloc var name
Proxy is now only initialized if both type and location are specified,
as neither have a default fallback and both are required. I suppose the
type could fall back to http, but seems safer this way.
Also refactored proxyurl -> proxyloc for the runtime args in order to
match the Dockerfile args.
* Add tor/proxy support for Docker builds, fix opensearch/init
The Dockerfile is now updated to include support for Tor configuration,
with a working torrc file included in the repo.
An issue with opensearch was fixed as well, which was uncovered during
testing and was simple enough to fix here. Likewise, DDG bang gen was
updated to only ever happen if the file didn't exist previously, as
testing with the file being regenerated every time was tedious.
* Add missing "@" for socks proxy requests
2020-10-29 00:47:42 +00:00
|
|
|
ARG proxyuser=''
|
|
|
|
ENV WHOOGLE_PROXY_USER=$proxyuser
|
|
|
|
ARG proxypass=''
|
|
|
|
ENV WHOOGLE_PROXY_PASS=$proxypass
|
|
|
|
ARG proxytype=''
|
|
|
|
ENV WHOOGLE_PROXY_TYPE=$proxytype
|
|
|
|
ARG proxyloc=''
|
|
|
|
ENV WHOOGLE_PROXY_LOC=$proxyloc
|
|
|
|
|
2021-03-28 17:27:08 +00:00
|
|
|
ARG whoogle_dotenv=''
|
|
|
|
ENV WHOOGLE_DOTENV=$whoogle_dotenv
|
|
|
|
|
2020-05-15 21:44:50 +00:00
|
|
|
ARG use_https=''
|
|
|
|
ENV HTTPS_ONLY=$use_https
|
|
|
|
|
|
|
|
ARG whoogle_port=5000
|
|
|
|
ENV EXPOSE_PORT=$whoogle_port
|
|
|
|
|
2021-01-11 19:00:15 +00:00
|
|
|
ARG twitter_alt='nitter.net'
|
2020-12-05 22:01:21 +00:00
|
|
|
ENV WHOOGLE_ALT_TW=$twitter_alt
|
2021-01-11 19:00:15 +00:00
|
|
|
ARG youtube_alt='invidious.snopyta.org'
|
2020-12-05 22:01:21 +00:00
|
|
|
ENV WHOOGLE_ALT_YT=$youtube_alt
|
2021-01-11 19:00:15 +00:00
|
|
|
ARG instagram_alt='bibliogram.art/u'
|
2021-03-22 14:16:24 +00:00
|
|
|
ENV WHOOGLE_ALT_IG=$instagram_alt
|
2021-01-23 22:43:53 +00:00
|
|
|
ARG reddit_alt='libredd.it'
|
|
|
|
ENV WHOOGLE_ALT_RD=$reddit_alt
|
2020-12-05 22:01:21 +00:00
|
|
|
|
2021-02-26 15:49:40 +00:00
|
|
|
WORKDIR /whoogle
|
|
|
|
|
|
|
|
COPY --from=builder /install /usr/local
|
2021-03-17 16:27:08 +00:00
|
|
|
COPY misc/tor/torrc /etc/tor/torrc
|
|
|
|
COPY misc/tor/start-tor.sh misc/tor/start-tor.sh
|
2021-02-26 15:49:40 +00:00
|
|
|
COPY app/ app/
|
|
|
|
COPY run .
|
2021-03-28 17:27:08 +00:00
|
|
|
COPY whoogle.env .
|
2020-04-08 20:05:28 +00:00
|
|
|
|
2020-05-15 21:44:50 +00:00
|
|
|
EXPOSE $EXPOSE_PORT
|
2020-05-10 12:00:22 +00:00
|
|
|
|
2021-03-08 17:38:40 +00:00
|
|
|
HEALTHCHECK --interval=5m --timeout=5s \
|
|
|
|
CMD wget --no-verbose --tries=1 http://localhost:${EXPOSE_PORT}/ || exit 1
|
|
|
|
|
2021-03-17 16:27:08 +00:00
|
|
|
CMD misc/tor/start-tor.sh & ./run
|