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.
This commit is contained in:
Ben Busby 2020-10-26 17:56:01 -04:00
parent 0573484405
commit 66a98c6659
6 changed files with 13 additions and 13 deletions

View File

@ -1,9 +1,13 @@
FROM python:3.8-slim
WORKDIR /usr/src/app
RUN apt-get update && apt-get install -y build-essential libcurl4-openssl-dev libssl-dev tor
RUN cat rc/torrc > /etc/tor/torrc
RUN service tor start
RUN apt-get update && apt-get install -y \
build-essential \
libcurl4-openssl-dev \
libssl-dev \
tor
COPY rc/torrc /etc/tor/torrc
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
@ -36,4 +40,4 @@ COPY . .
EXPOSE $EXPOSE_PORT
CMD ["./run"]
CMD service tor start && ./run

View File

@ -25,6 +25,7 @@ Contents
- No AMP links
- No URL tracking tags (i.e. utm=%s)
- No referrer header
- Tor and HTTP/SOCKS proxy support
- Autocomplete/search suggestions
- POST request search and suggestion queries (when possible)
- View images at full res without site redirect (currently mobile only)
@ -35,7 +36,7 @@ Contents
- Optional location-based searching (i.e. results near \<city\>)
- Optional NoJS mode to disable all Javascript in results
<sup>*If deployed to a remote server</sup>
<sup>*If deployed to a remote server, or configured to send requests through a VPN, Tor, proxy, etc.</sup>
## Dependencies
If using Heroku Quick Deploy, **you can skip this section**.

View File

@ -30,6 +30,7 @@ if not os.path.exists(app.config['SESSION_FILE_DIR']):
# Generate DDG bang filter, and create path if it doesn't exist yet
if not os.path.exists(app.config['BANG_PATH']):
os.makedirs(app.config['BANG_PATH'])
if not os.path.exists(app.config['BANG_FILE']):
gen_bangs_json(app.config['BANG_FILE'])
Session(app)

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,3 @@
User tor
DataDirectory /var/lib/tor
ControlPort 9051
CookieAuthentication 1

View File

@ -25,7 +25,6 @@ PySocks==1.7.1
pytest==5.4.1
python-dateutil==2.8.1
requests==2.23.0
six==1.14.0
soupsieve==1.9.5
stem==1.8.0
urllib3==1.25.9