searxng-app/start.sh

31 lines
1.1 KiB
Bash
Raw Permalink Normal View History

2017-03-09 11:29:33 +00:00
#!/bin/bash
2019-07-16 19:30:21 +00:00
set -eu
2017-03-09 11:29:33 +00:00
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"
2017-03-09 11:29:33 +00:00
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" \
2019-07-16 19:39:16 +00:00
-e "s/ultrasecretkey/`openssl rand -hex 16`/g" \
-i /app/data/settings.yml
2017-03-09 11:29:33 +00:00
fi
2017-03-11 03:32:08 +00:00
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"