Whoogle Docker Deployment

A self-hosted, ad-free, privacy-respecting metasearch engine

Whoogle Docker Deployment

0. Background

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.
https://github.com/benbusby/whoogle-search

1. Pre Steps

Install docker

$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh

Install docker-compose (check latest version)

$ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose

Build Customized Whoogle Docker Image

Get resource

git clone https://github.com/benbusby/whoogle-search.git

Edit index.html to remove configuration on client

nano /home/ubuntu/whoogle-search/app/templates/index.html

Remove the “if not config_disabled” block

{% if not config_disabled %}
        <br/>
        <button id="config-collapsible" class="collapsible">{{ translation['config'] }}</button>
        <div class="content">
            …
            …
            …
            </div>
        </div>
    {% endif %}

(Optional) Customize footer.html

nano /home/ubuntu/whoogle-search/app/templates/footer.html

Below is a footer.html sample:

<footer>
    <p class="footer">
        Powered by Trapnest ||
        <a class="link" href="https://henrywithu.com">Visit Trapnest</a>
        {% if has_update %}
             || <span class="update_available">Update Available</span>
        {% endif %}
    </p>
</footer>

Build image

cd /home/ubuntu/whoogle-search
docker build --tag whoogle-search:6.66 .

Note: 6.66 above is your own version tag of Whoogle.
Check customized Whoogle image

docker images

There should be an image called whoogle-search with tag 6.66

2. Edit docker-compose file and env file

Here’s a sample of docker-compose.yml

nano /home/ubuntu/whoogle-search/docker-compose.yml
# can't use mem_limit in a 3.x docker-compose file in non swarm mode
# see https://github.com/docker/compose/issues/4513
version: "2.4"

services:
  whoogle-search:
    image: whoogle-search:6.66
    container_name: whoogle-search
    restart: unless-stopped
    pids_limit: 50
    mem_limit: 256mb
    memswap_limit: 256mb
    # user debian-tor from tor package
    user: whoogle
    security_opt:
      - no-new-privileges
    cap_drop:
      - ALL
    tmpfs:
      - /config/:size=10M,uid=927,gid=927,mode=1700
      - /var/lib/tor/:size=15M,uid=927,gid=927,mode=1700
      - /run/tor/:size=1M,uid=927,gid=927,mode=1700
    environment: # Uncomment to configure environment variables
      # Basic auth configuration, uncomment to enable
      #- WHOOGLE_USER=<auth username>
      #- WHOOGLE_PASS=<auth password>
      # Proxy configuration, uncomment to enable
      #- WHOOGLE_PROXY_USER=<proxy username>
      #- WHOOGLE_PROXY_PASS=<proxy password>
      #- WHOOGLE_PROXY_TYPE=<proxy type (http|https|socks4|socks5)
      #- WHOOGLE_PROXY_LOC=<proxy host/ip>
      # Site alternative configurations, uncomment to enable
      # Note: If not set, the feature will still be available
      # with default values.
      #- WHOOGLE_ALT_TW=farside.link/nitter
      #- WHOOGLE_ALT_YT=farside.link/invidious
      #- WHOOGLE_ALT_IG=farside.link/bibliogram/u
      #- WHOOGLE_ALT_RD=farside.link/libreddit
      #- WHOOGLE_ALT_MD=farside.link/scribe
      #- WHOOGLE_ALT_TL=farside.link/lingva
      #- WHOOGLE_ALT_IMG=farside.link/rimgo
      #- WHOOGLE_ALT_WIKI=farside.link/wikiless
    #env_file: # Alternatively, load variables from whoogle.env
      - whoogle.env
    ports:
      - 127.0.0.1:3002:5000

Note: It’s recommended to use whoogle.env file instead of setup in docker-compose.yml
Edit whoogle.env

cp whoogle.template.env whoogle.env
nano whoogle.env

Here’s a sample of whoogle.env

# ----------------------------------
# Rename to "whoogle.env" before use
# ----------------------------------
# You can set Whoogle environment variables here, but must
# modify your deployment to enable these values:
#  - Local: Set WHOOGLE_DOTENV=1
#  - docker-compose: Uncomment the env_file option
#  - docker: Add "--env-file ./whoogle.env" to your build command

#WHOOGLE_ALT_TW=farside.link/nitter
#WHOOGLE_ALT_YT=farside.link/invidious
#WHOOGLE_ALT_IG=farside.link/bibliogram/u
#WHOOGLE_ALT_RD=farside.link/libreddit
#WHOOGLE_ALT_MD=farside.link/scribe
#WHOOGLE_ALT_TL=farside.link/lingva
#WHOOGLE_ALT_IMG=farside.link/rimgo
#WHOOGLE_ALT_WIKI=farside.link/wikiless
#WHOOGLE_USER=""
#WHOOGLE_PASS=""
#WHOOGLE_PROXY_USER=""
#WHOOGLE_PROXY_PASS=""
#WHOOGLE_PROXY_TYPE=""
#WHOOGLE_PROXY_LOC=""
#WHOOGLE_CSP=1
HTTPS_ONLY=1

# The URL prefix to use for the whoogle instance (i.e. "/whoogle")
#WHOOGLE_URL_PREFIX=""

# Restrict results to only those near a particular city
#WHOOGLE_CONFIG_NEAR=denver

# See app/static/settings/countries.json for values
WHOOGLE_CONFIG_COUNTRY=US

# See app/static/settings/languages.json for values
WHOOGLE_CONFIG_LANGUAGE=lang_en

# See app/static/settings/languages.json for values
WHOOGLE_CONFIG_SEARCH_LANGUAGE=lang_en

# Disable changing of config from client
WHOOGLE_CONFIG_DISABLE=1

# Block websites from search results (comma-separated list)
#WHOOGLE_CONFIG_BLOCK=pinterest.com,whitehouse.gov

# Theme (light, dark, or system)
#WHOOGLE_CONFIG_THEME=system

# Safe search mode
#WHOOGLE_CONFIG_SAFE=1

# Use social media site alternatives (nitter, bibliogram, etc)
#WHOOGLE_CONFIG_ALTS=1

# Use Tor if available
#WHOOGLE_CONFIG_TOR=1

# Open results in new tab
#WHOOGLE_CONFIG_NEW_TAB=1

# Enable View Image option
#WHOOGLE_CONFIG_VIEW_IMAGE=1

# Search using GET requests only (exposes query in logs)
#WHOOGLE_CONFIG_GET_ONLY=1

# Remove everything except basic result cards from all search queries
#WHOOGLE_MINIMAL=0

# Set the number of results per page
#WHOOGLE_RESULTS_PER_PAGE=10

# Controls visibility of autocomplete/search suggestions
#WHOOGLE_AUTOCOMPLETE=1

# The port where Whoogle will be exposed
#EXPOSE_PORT=5000

# Set instance URL
WHOOGLE_CONFIG_URL=https://your.site.com/

# Set custom CSS styling/theming
#WHOOGLE_CONFIG_STYLE=":root { /* LIGHT THEME COLORS */ --whoogle-background: #d8dee9; --whoogle-accent: #2e3440; --whoogle-text: #3B4252; --whoogle-contrast-text: #eceff4; --whoogle-secondary-text: #70757a; --whoogle-result-bg: #fff; --whoogle-result-title: #4c566a; --whoogle-result-url: #81a1c1; --whoogle-result-visited: #a3be8c; /* DARK THEME COLORS */ --whoogle-dark-background: #222; --whoogle-dark-accent: #685e79; --whoogle-dark-text: #fff; --whoogle-dark-contrast-text: #000; --whoogle-dark-secondary-text: #bbb; --whoogle-dark-result-bg: #000; --whoogle-dark-result-title: #1967d2; --whoogle-dark-result-url: #4b11a8; --whoogle-dark-result-visited: #bbbbff; }"

Up the container

docker-compose up -d

3. Setup Nginx

nano /etc/nginx/conf.d/whoogle.conf
server {
        server_name your.site.com;
        if ($host = your.site.com) {
                return 301 https://$host$request_uri;
        }
        return 404;
}

server {
  listen 443 ssl http2;

  ssl_certificate       /your/cert/fullchain.pem;
  ssl_certificate_key   /your/cert/privkey.pem;
  ssl_session_timeout 1d;
  ssl_session_cache shared:MozSSL:10m;
  ssl_session_tickets off;

  client_max_body_size 10G;

  ssl_protocols         TLSv1.2 TLSv1.3;
  ssl_ciphers           ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
  ssl_prefer_server_ciphers off;

  server_name           your.site.com;
    add_header Content-Security-Policy upgrade-insecure-requests;
  location / {
    proxy_redirect off;
    proxy_pass http://127.0.0.1:3002;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_next_upstream off;
  }
}

Check Nginx syntax

nginx -t

Restart Nginx

systemctl restart nginx

4. Whoogle it

If you have any question or suggestion, don’t hesitate to contact me [email protected]


Copyright statement: Unless otherwise stated, all articles on this blog adopt the CC BY-NC-SA 4.0 license agreement. For non-commercial reprints and citations, please indicate the author: Henry, and original article URL. For commercial reprints, please contact the author for authorization.