2022-02-23 16:33:46 +00:00
|
|
|
FROM python:3.11.0a5-alpine as builder
|
2020-04-08 20:05:28 +00:00
|
|
|
|
2021-12-19 18:59:06 +00:00
|
|
|
RUN apk --update add \
|
|
|
|
build-base \
|
2021-01-05 22:53:58 +00:00
|
|
|
libxml2-dev \
|
|
|
|
libxslt-dev \
|
2021-12-19 18:59:06 +00:00
|
|
|
openssl-dev \
|
2021-02-26 15:49:40 +00:00
|
|
|
libffi-dev
|
2021-12-21 21:26:01 +00:00
|
|
|
|
2020-05-10 12:00:22 +00:00
|
|
|
COPY requirements.txt .
|
2021-02-26 15:49:40 +00:00
|
|
|
|
2021-12-21 21:26:01 +00:00
|
|
|
RUN pip install --upgrade pip
|
2021-02-26 15:49:40 +00:00
|
|
|
RUN pip install --prefix /install --no-warn-script-location --no-cache-dir -r requirements.txt
|
|
|
|
|
2022-02-23 16:33:46 +00:00
|
|
|
FROM python:3.11.0a5-alpine
|
2021-02-26 15:49:40 +00:00
|
|
|
|
2022-01-25 20:07:21 +00:00
|
|
|
RUN apk add --update --no-cache tor curl openrc
|
2021-12-21 21:26:01 +00:00
|
|
|
# libcurl4-openssl-dev
|
2020-05-10 12:00:22 +00:00
|
|
|
|
2022-01-25 20:07:21 +00:00
|
|
|
RUN apk -U upgrade
|
|
|
|
|
2022-01-21 20:51:51 +00:00
|
|
|
ARG DOCKER_USER=whoogle
|
|
|
|
ARG DOCKER_USERID=927
|
2020-05-14 00:27:04 +00:00
|
|
|
ARG config_dir=/config
|
2022-02-21 16:33:30 +00:00
|
|
|
RUN mkdir -p $config_dir
|
|
|
|
RUN chmod a+w $config_dir
|
2020-05-14 00:27:04 +00:00
|
|
|
VOLUME $config_dir
|
|
|
|
|
2020-05-18 16:30:32 +00:00
|
|
|
ARG username=''
|
|
|
|
ARG 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=''
|
|
|
|
ARG proxypass=''
|
|
|
|
ARG proxytype=''
|
|
|
|
ARG proxyloc=''
|
2021-03-28 17:27:08 +00:00
|
|
|
ARG whoogle_dotenv=''
|
2020-05-15 21:44:50 +00:00
|
|
|
ARG use_https=''
|
|
|
|
ARG whoogle_port=5000
|
Use farside.link for frontend alternatives in results (#560)
* Integrate Farside into Whoogle
When instances are ratelimited (when a captcha is returned instead of
the user's search results) the user can now hop to a new instance via
Farside, a new backend service that redirects users to working instances
of a particular frontend. In this case, it presents a user with a
Farside link to a new Whoogle (or Searx) instance instead, so that the
user can resume their search.
For the generated Farside->Whoogle link, the generated link includes the
user's current Whoogle configuration settings as URL params, to ensure a
more seamless transition between instances. This doesn't translate to
the Farside->Searx link, but potentially could with some changes.
* Expand conversion of config<->url params
Config settings can now be translated to and from URL params using a
predetermined set of "safe" keys (i.e. config settings that easily
translate to URL params).
* Allow jumping instances via Farside when ratelimited
When instances are ratelimited (when a captcha is returned instead of
the user's search results) the user can now hop to a new instance via
Farside, a new backend service that redirects users to working instances
of a particular frontend. In this case, it presents a user with a
Farside link to a new Whoogle (or Searx) instance instead, so that the
user can resume their search.
For the generated Farside->Whoogle link, the generated link includes the
user's current Whoogle configuration settings as URL params, to ensure a
more seamless transition between instances. This doesn't translate to
the Farside->Searx link, but potentially could with some changes.
Closes #554
Closes #559
2021-12-09 00:27:33 +00:00
|
|
|
ARG twitter_alt='farside.link/nitter'
|
|
|
|
ARG youtube_alt='farside.link/invidious'
|
2022-03-28 16:18:54 +00:00
|
|
|
ARG instagram_alt='farside.link/bibliogram/u'
|
Use farside.link for frontend alternatives in results (#560)
* Integrate Farside into Whoogle
When instances are ratelimited (when a captcha is returned instead of
the user's search results) the user can now hop to a new instance via
Farside, a new backend service that redirects users to working instances
of a particular frontend. In this case, it presents a user with a
Farside link to a new Whoogle (or Searx) instance instead, so that the
user can resume their search.
For the generated Farside->Whoogle link, the generated link includes the
user's current Whoogle configuration settings as URL params, to ensure a
more seamless transition between instances. This doesn't translate to
the Farside->Searx link, but potentially could with some changes.
* Expand conversion of config<->url params
Config settings can now be translated to and from URL params using a
predetermined set of "safe" keys (i.e. config settings that easily
translate to URL params).
* Allow jumping instances via Farside when ratelimited
When instances are ratelimited (when a captcha is returned instead of
the user's search results) the user can now hop to a new instance via
Farside, a new backend service that redirects users to working instances
of a particular frontend. In this case, it presents a user with a
Farside link to a new Whoogle (or Searx) instance instead, so that the
user can resume their search.
For the generated Farside->Whoogle link, the generated link includes the
user's current Whoogle configuration settings as URL params, to ensure a
more seamless transition between instances. This doesn't translate to
the Farside->Searx link, but potentially could with some changes.
Closes #554
Closes #559
2021-12-09 00:27:33 +00:00
|
|
|
ARG reddit_alt='farside.link/libreddit'
|
|
|
|
ARG medium_alt='farside.link/scribe'
|
2022-03-21 16:08:52 +00:00
|
|
|
ARG translate_alt='farside.link/lingva'
|
|
|
|
ARG imgur_alt='farside.link/rimgo'
|
|
|
|
ARG wikipedia_alt='farside.link/wikiless'
|
2021-12-19 18:59:06 +00:00
|
|
|
|
|
|
|
ENV CONFIG_VOLUME=$config_dir \
|
|
|
|
WHOOGLE_USER=$username \
|
|
|
|
WHOOGLE_PASS=$password \
|
|
|
|
WHOOGLE_PROXY_USER=$proxyuser \
|
|
|
|
WHOOGLE_PROXY_PASS=$proxypass \
|
|
|
|
WHOOGLE_PROXY_TYPE=$proxytype \
|
|
|
|
WHOOGLE_PROXY_LOC=$proxyloc \
|
|
|
|
WHOOGLE_DOTENV=$whoogle_dotenv \
|
|
|
|
HTTPS_ONLY=$use_https \
|
|
|
|
EXPOSE_PORT=$whoogle_port \
|
|
|
|
WHOOGLE_ALT_TW=$twitter_alt \
|
|
|
|
WHOOGLE_ALT_YT=$youtube_alt \
|
|
|
|
WHOOGLE_ALT_IG=$instagram_alt \
|
|
|
|
WHOOGLE_ALT_RD=$reddit_alt \
|
|
|
|
WHOOGLE_ALT_MD=$medium_alt \
|
2022-01-14 17:05:24 +00:00
|
|
|
WHOOGLE_ALT_TL=$translate_alt \
|
|
|
|
WHOOGLE_ALT_IMG=$imgur_alt \
|
2022-01-14 16:59:03 +00:00
|
|
|
WHOOGLE_ALT_WIKI=$wikipedia_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/
|
2021-10-19 18:44:44 +00:00
|
|
|
COPY run .
|
|
|
|
#COPY whoogle.env .
|
2020-04-08 20:05:28 +00:00
|
|
|
|
2022-01-21 20:51:51 +00:00
|
|
|
# Create user/group to run as
|
2022-01-25 20:07:21 +00:00
|
|
|
RUN adduser -D -g $DOCKER_USERID -u $DOCKER_USERID $DOCKER_USER
|
|
|
|
|
2022-01-21 20:51:51 +00:00
|
|
|
# Fix ownership / permissions
|
2022-02-21 16:33:30 +00:00
|
|
|
RUN chown -R ${DOCKER_USER}:${DOCKER_USER} /whoogle /var/lib/tor
|
2022-01-21 20:51:51 +00:00
|
|
|
|
2022-01-25 20:07:21 +00:00
|
|
|
# Allow writing symlinks to build dir
|
|
|
|
RUN chown $DOCKER_USERID:$DOCKER_USERID app/static/build
|
|
|
|
|
2022-01-21 20:51:51 +00:00
|
|
|
USER $DOCKER_USER:$DOCKER_USER
|
|
|
|
|
2020-05-15 21:44:50 +00:00
|
|
|
EXPOSE $EXPOSE_PORT
|
2020-05-10 12:00:22 +00:00
|
|
|
|
2022-01-25 20:07:21 +00:00
|
|
|
HEALTHCHECK --interval=30s --timeout=5s \
|
2021-05-18 15:48:15 +00:00
|
|
|
CMD curl -f http://localhost:${EXPOSE_PORT}/healthz || exit 1
|
2021-03-08 17:38:40 +00:00
|
|
|
|
2021-03-17 16:27:08 +00:00
|
|
|
CMD misc/tor/start-tor.sh & ./run
|