#!/bin/bash set -eu if [[ ! -f /app/data/uwsgi.ini ]]; then echo "==> Copying uwsgi template on first run" cp /app/code/dockerfiles/uwsgi.ini /app/data/uwsgi.ini sed -e "s/pythonpath = .*/pythonpath = \/app\/code/g" \ -e "s/chdir = .*/chdir = \/app\/code\/searx/g" \ -e "s/uid = .*/uid = www-data/g" \ -e "s/gid = .*/gid = www-data/g" \ -e "s/workers = .*/workers = 4/g" \ -e "s/static-map = \/static=.*/static-map = \/static=\/app\/code\/searx\/static/g" \ -i /app/data/uwsgi.ini fi if [[ ! -f /app/data/settings.yml ]]; then echo "=> Copying settings from template on first run" cp /app/code/searx/settings.yml.orig /app/data/settings.yml sed -e 's/bind_address: "127.0.0.1"/bind_address: "0.0.0.0"/g' \ -e "s/url: .*redis\.sock.*/url: \"redis:\/\/:${CLOUDRON_REDIS_PASSWORD}@${CLOUDRON_REDIS_HOST}:${CLOUDRON_REDIS_PORT}\/0\"/g" \ -e "s/ultrasecretkey/`openssl rand -hex 16`/g" \ -i /app/data/settings.yml fi chown -R www-data.www-data /app/data echo "==> Starting searXNG" exec gosu www-data uwsgi --master --ini /app/data/uwsgi.ini --http-socket "0.0.0.0:8888"