3export SEARX_VERSION=$(su searx -c 'python3 -c "import six; import searx.version; six.print_(searx.version.VERSION_STRING)"')
4printf 'searx version %s\n\n' "${SEARX_VERSION}"
6export UWSGI_SETTINGS_PATH=/etc/searx/uwsgi.ini
7export SEARX_SETTINGS_PATH=/etc/searx/settings.yml
9if [ -z "${BIND_ADDRESS}" ]; then
10 export BIND_ADDRESS=":8080"
16while getopts "fdh" option
26 printf "Command line:\n\n"
27 printf " -h Display this help\n"
28 printf " -d Dry run to update the configuration files.\n"
29 printf " -f Always update on the configuration files (existing files are renamed with the .old suffix)\n"
30 printf " Without this option, new configuration files are copied with the .new suffix\n"
31 printf "\nEnvironment variables:\n\n"
32 printf " INSTANCE_NAME settings.yml : general.instance_name\n"
33 printf " AUTOCOMPLETE settings.yml : search.autocomplete\n"
34 printf " BASE_URL settings.yml : server.base_url\n"
35 printf " MORTY_URL settings.yml : result_proxy.url\n"
36 printf " MORTY_KEY settings.yml : result_proxy.key\n"
37 printf " BIND_ADDRESS where uwsgi will accept HTTP request (format : host:port)\n"
42# helpers to update the configuration files
43patch_uwsgi_settings() {
49patch_searx_settings() {
52 # Make sure that there is trailing slash at the end of BASE_URL
53 # see http://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Parameter-Expansion
54 export BASE_URL="${BASE_URL%/}/"
57 sed -i -e "s|base_url : False|base_url : ${BASE_URL}|g" \
58 -e "s/instance_name : \"searx\"/instance_name : \"${INSTANCE_NAME}\"/g" \
59 -e "s/autocomplete : \"\"/autocomplete : \"${AUTOCOMPLETE}\"/g" \
60 -e "s/ultrasecretkey/$(openssl rand -hex 32)/g" \
64 if [ ! -z "${MORTY_KEY}" -a ! -z "${MORTY_URL}" ]; then
65 sed -i -e "s/image_proxy : False/image_proxy : True/g" \
67 cat >> "${CONF}" <<-EOF
72 key : !!binary "${MORTY_KEY}"
85 if [ -f "${CONF}" ]; then
86 if [ "${REF_CONF}" -nt "${CONF}" ]; then
87 # There is a new version
88 if [ $FORCE_CONF_UPDATE -ne 0 ]; then
89 # Replace the current configuration
90 printf '⚠️ Automaticaly update %s to the new version\n' "${CONF}"
91 if [ ! -f "${OLD_CONF}" ]; then
92 printf 'The previous configuration is saved to %s\n' "${OLD_CONF}"
93 mv "${CONF}" "${OLD_CONF}"
95 cp "${REF_CONF}" "${CONF}"
96 $PATCH_REF_CONF "${CONF}"
98 # Keep the current configuration
99 printf '⚠️ Check new version %s to make sure searx is working properly\n' "${NEW_CONF}"
100 cp "${REF_CONF}" "${NEW_CONF}"
101 $PATCH_REF_CONF "${NEW_CONF}"
104 printf 'Use existing %s\n' "${CONF}"
107 printf 'Create %s\n' "${CONF}"
108 cp "${REF_CONF}" "${CONF}"
109 $PATCH_REF_CONF "${CONF}"
113# make sure there are uwsgi settings
114update_conf ${FORCE_CONF_UPDATE} "${UWSGI_SETTINGS_PATH}" "/usr/local/searx/dockerfiles/uwsgi.ini" "patch_uwsgi_settings"
116# make sure there are searx settings
117update_conf "${FORCE_CONF_UPDATE}" "${SEARX_SETTINGS_PATH}" "/usr/local/searx/searx/settings.yml" "patch_searx_settings"
119# dry run (to update configuration files, then inspect them)
120if [ $DRY_RUN -eq 1 ]; then
126touch /var/run/uwsgi-logrotate
127chown -R searx:searx /var/log/uwsgi /var/run/uwsgi-logrotate
131printf 'Listen on %s\n' "${BIND_ADDRESS}"
132exec su-exec searx:searx uwsgi --master --http-socket "${BIND_ADDRESS}" "${UWSGI_SETTINGS_PATH}"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list