diff --git a/.dockerignore b/.dockerignore index 2d2ecd6..80b070a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,2 @@ .git/ +venv/ diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 9bc149f..a174b78 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,9 +1,9 @@ --- name: Bug report -about: Create a bug report to help improve Whoogle -title: "[BUG] " +about: Create a bug report to help fix an issue with Whoogle +title: "[BUG] " labels: bug -assignees: benbusby +assignees: '' --- @@ -17,11 +17,18 @@ Steps to reproduce the behavior: 3. Scroll down to '....' 4. See error -**Expected behavior** -A clear and concise description of what you expected to happen. +**Deployment Method** +- [ ] Heroku (one-click deploy) +- [ ] Docker +- [ ] `run` executable +- [ ] pip/pipx +- [ ] Other: [describe setup] + +**Version of Whoogle Search** +- [ ] Latest build from [source] (i.e. GitHub, Docker Hub, pip, etc) +- [ ] Version [version number] +- [ ] Not sure -**Screenshots** -If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: [e.g. iOS] diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..24bf2f6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature request +about: Suggest a feature that would improve Whoogle +title: "[FEATURE] " +labels: enhancement +assignees: '' + +--- + +**Describe the feature you'd like to see added** +A short description of the feature, and what it would accomplish. + +**Describe which parts of the project this would modify (front end/back end/configuration/etc)** +A short description of which aspects of Whoogle Search would need modification + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 0000000..a1d9b21 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,10 @@ +--- +name: Question +about: Ask a (simple) question about Whoogle +title: "[QUESTION] " +labels: question +assignees: '' + +--- + +Type out your question here. Please make sure that this is a topic that isn't already covered in the README. diff --git a/.gitignore b/.gitignore index 20747c7..bbffdb4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,12 @@ venv/ __pycache__/ *.pyc *.pem +*.conf config.json test/static +flask_session/ +app/static/config +app/static/custom_config # pip stuff build/ diff --git a/.travis.yml b/.travis.yml index 8695c53..110c0ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,4 +5,11 @@ before_install: install: - pip install -r requirements.txt script: - - ./whoogle-search test + - "./run test" +deploy: + provider: pypi + user: __token__ + password: + secure: WNEH2Gg84MZF/AZEberFDGPPWb4cYyHAeD/XV8En94QRSI9Aznz6qiDKOvV4eVgjMAIEW5uB3TL1LHf6KU+Hrg6SmhF7JquqP1gsBOCDNFPTljO+k2Hc53uDdSnhi/HLgY7cnFNX4lc2nNrbyxZxMHuSA2oNz/tosyNGBEeyU+JA5va7uX0albGsLiNjimO4aeau83fsI0Hn2eN6ag68pewUMXNxzpyTeO2bRcCd5d5iILs07jMVwFoC2j7W11oNqrVuSWAs8CPe4+kwvNvXWxljUGiBGppNZ7RAsKNLwi6U6kGGUTWjQm09rY/2JBpJ2WEGmIWGIrno75iiFRbjnRp3mnXPvtVTyWhh+hQIUd7bJOVKM34i9eHotYTrkMJObgW1gnRzvI9VYldtgL/iP/Isn2Pv2EeMX8V+C9/8pxv0jkQkZMnFhE6gGlzpz37zTl04B2J7xyV5znM35Lx2Pn3zxdcmdCvD3yT8I4MuBbKqq2/v4emYCfPfOmfwnS0BEVSqr9lbx4xfUZV76tcvLcj4n86DJbx77pA2Ch8FRprpOOBcf0WuqTbZp8c3mb8prFp2EupUknXu7+C2VQ6sqrnzNuDeTGm/nyjjRQ81rlvlD4tqkwsEGEDDO44FF2eUTc5D2MvoHs4cnz095FWjy63gn5IxUjhMi31b5tGRz2Q= + on: + tags: true diff --git a/Dockerfile b/Dockerfile index 546eede..61f77b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,28 @@ -FROM python:3 +FROM python:3.8-slim WORKDIR /usr/src/app +RUN apt-get update && apt-get install -y build-essential libcurl4-openssl-dev libssl-dev +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +ARG config_dir=/config +RUN mkdir -p $config_dir +VOLUME $config_dir +ENV CONFIG_VOLUME=$config_dir + +ARG username='' +ENV WHOOGLE_USER=$username +ARG password='' +ENV WHOOGLE_PASS=$password + +ARG use_https='' +ENV HTTPS_ONLY=$use_https + +ARG whoogle_port=5000 +ENV EXPOSE_PORT=$whoogle_port + COPY . . -RUN pip install --no-cache-dir -r requirements.txt -RUN chmod +x ./whoogle-search +EXPOSE $EXPOSE_PORT -CMD ["./whoogle-search"] +CMD ["./run"] diff --git a/MANIFEST.in b/MANIFEST.in index 3c53610..1601bc8 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,4 @@ graft app/static graft app/templates +include requirements.txt global-exclude *.pyc diff --git a/README.md b/README.md index b19ddc4..905cdd4 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Build Status](https://travis-ci.com/benbusby/whoogle-search.svg?branch=master)](https://travis-ci.com/benbusby/whoogle-search) [![codebeat badge](https://codebeat.co/badges/e96cada2-fb6f-4528-8285-7d72abd74e8d)](https://codebeat.co/projects/github-com-benbusby-shoogle-master) +[![Docker Pulls](https://img.shields.io/docker/pulls/benbusby/whoogle-search)](https://hub.docker.com/r/benbusby/whoogle-search) Get Google search results, but without any ads, javascript, AMP links, cookies, or IP address tracking. Easily deployable in one click as a Docker app, and customizable with a single config file. Quick and simple to implement as a primary search engine replacement on both desktop and mobile. @@ -24,7 +25,8 @@ Contents - No AMP links - No URL tracking tags (i.e. utm=%s) - No referrer header -- POST request search queries (when possible) +- Autocomplete/search suggestions +- POST request search and suggestion queries (when possible) - View images at full res without site redirect (currently mobile only) - Dark mode - Randomly generated User Agent @@ -47,7 +49,7 @@ If using Heroku Quick Deploy, **you can skip this section**. There are a few different ways to begin using the app, depending on your preferences: ### A) [Heroku Quick Deploy](https://heroku.com/about) -[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/benbusby/whoogle-search) +[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/benbusby/whoogle-search/tree/heroku-app) *Note: Requires a (free) Heroku account* @@ -57,11 +59,11 @@ Provides: - Downtime after periods of inactivity \([solution](https://github.com/benbusby/whoogle-search#prevent-downtime-heroku-only)\) ### B) [pipx](https://github.com/pipxproject/pipx#install-pipx) -Persistent install: +Persistent install: `pipx install git+https://github.com/benbusby/whoogle-search.git` -Sandboxed temporary instance: +Sandboxed temporary instance: `pipx run git+https://github.com/benbusby/whoogle-search.git whoogle-search` @@ -71,14 +73,16 @@ Sandboxed temporary instance: ```bash $ whoogle-search --help usage: whoogle-search [-h] [--port ] [--host ] [--debug] + [--https-only] Whoogle Search console runner optional arguments: -h, --help show this help message and exit - --port Specifies a port to run on (default 8888) + --port Specifies a port to run on (default 5000) --host Specifies the host address to use (default 127.0.0.1) - --debug Activates debug mode for the Flask server (default False) + --debug Activates debug mode for the server (default False) + --https-only Enforces HTTPS redirects for all requests (default False) ``` ### D) Manual @@ -90,7 +94,34 @@ cd whoogle-search python3 -m venv venv source venv/bin/activate pip install -r requirements.txt -./whoogle-search +./run +``` + +#### systemd Configuration +After building the virtual environment, you can add the following to `/lib/systemd/system/whoogle.service` to set up a Whoogle Search systemd service: + +``` +[Unit] +Description=Whoogle + +[Service] +Type=simple +User=root +WorkingDirectory= +ExecStart=/venv/bin/python3 -um app --host 0.0.0.0 --port 5000 +ExecReload=/bin/kill -HUP $MAINPID +Restart=always +RestartSec=3 +SyslogIdentifier=whoogle + +[Install] +WantedBy=multi-user.target +``` +Then, +``` +sudo systemctl daemon-reload +sudo systemctl enable whoogle +sudo systemctl start whoogle ``` ### E) Manual (Docker) @@ -100,14 +131,30 @@ pip install -r requirements.txt 2. Clone and deploy the docker app using a method below: #### Docker CLI +Through Docker Hub: +```bash +docker pull benbusby/whoogle-search +docker run --publish 5000:5000 --detach --name whoogle-search benbusby/whoogle-search:latest +``` + +or with docker-compose: + ```bash git clone https://github.com/benbusby/whoogle-search.git cd whoogle-search -docker build --tag whooglesearch:1.0 . -docker run --publish 8888:5000 --detach --name whooglesearch whooglesearch:1.0 +docker-compose up ``` -And kill with: `docker rm --force whooglesearch` +or by building yourself: + +```bash +git clone https://github.com/benbusby/whoogle-search.git +cd whoogle-search +docker build --tag whoogle-search:1.0 . +docker run --publish 5000:5000 --detach --name whoogle-search whoogle-search:1.0 +``` + +And kill with: `docker rm --force whoogle-search` #### Using [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) ```bash @@ -139,6 +186,8 @@ To filter by a range of time, append ":past