searxng-app/start.sh
Rafael Caricio 7c7a55c078
Initial usable version
Signed-off-by: Rafael Caricio <rafael@caricio.com>
2022-07-08 18:07:39 +02:00

29 lines
988 B
Bash
Executable file

#!/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/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/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"