4 printf "Command line:\n\n"
5 printf " -h Display this help\n"
6 printf " -d Dry run to update the configuration files.\n"
7 printf " -f Always update on the configuration files (existing files are renamed with the .old suffix)\n"
8 printf " Without this option, the new configuration files are copied with the .new suffix\n"
9 printf "\nEnvironment variables:\n\n"
10 printf " INSTANCE_NAME settings.yml : general.instance_name\n"
11 printf " AUTOCOMPLETE settings.yml : search.autocomplete\n"
12 printf " BASE_URL settings.yml : server.base_url\n"
13 printf " MORTY_URL settings.yml : result_proxy.url\n"
14 printf " MORTY_KEY settings.yml : result_proxy.key\n"
15 printf " BIND_ADDRESS uwsgi bind to the specified TCP socket using HTTP protocol. Default value: \"${DEFAULT_BIND_ADDRESS}\"\n"
16 printf "\nVolume:\n\n"
17 printf " /etc/searx the docker entry point copies settings.yml and uwsgi.ini in this directory (see the -f command line option)\n"
22export DEFAULT_BIND_ADDRESS="0.0.0.0:8080"
23if [ -z "${BIND_ADDRESS}" ]; then
24 export BIND_ADDRESS="${DEFAULT_BIND_ADDRESS}"
27# Parse special command line
28# see docs/admin/installation-docker.rst
29# display the help message without the version
30if [ "$1" = "help" ]; then
35export SEARX_VERSION=$(su searx -c 'python3 -c "import six; import searx.version; six.print_(searx.version.VERSION_STRING)"' 2>/dev/null)
36printf 'searx version %s\n\n' "${SEARX_VERSION}"
41while getopts "fdh" option
55# helpers to update the configuration files
56patch_uwsgi_settings() {
62patch_searx_settings() {
65 # Make sure that there is trailing slash at the end of BASE_URL
66 # see https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Parameter-Expansion
67 export BASE_URL="${BASE_URL%/}/"
70 sed -i -e "s|base_url : False|base_url : ${BASE_URL}|g" \
71 -e "s/instance_name : \"searx\"/instance_name : \"${INSTANCE_NAME}\"/g" \
72 -e "s/autocomplete : \"\"/autocomplete : \"${AUTOCOMPLETE}\"/g" \
73 -e "s/ultrasecretkey/$(openssl rand -hex 32)/g" \
77 if [ ! -z "${MORTY_KEY}" -a ! -z "${MORTY_URL}" ]; then
78 sed -i -e "s/image_proxy : False/image_proxy : True/g" \
80 cat >> "${CONF}" <<-EOF
85 key : !!binary "${MORTY_KEY}"
98 if [ -f "${CONF}" ]; then
99 if [ "${REF_CONF}" -nt "${CONF}" ]; then
100 # There is a new version
101 if [ $FORCE_CONF_UPDATE -ne 0 ]; then
102 # Replace the current configuration
103 printf '⚠️ Automaticaly update %s to the new version\n' "${CONF}"
104 if [ ! -f "${OLD_CONF}" ]; then
105 printf 'The previous configuration is saved to %s\n' "${OLD_CONF}"
106 mv "${CONF}" "${OLD_CONF}"
108 cp "${REF_CONF}" "${CONF}"
109 $PATCH_REF_CONF "${CONF}"
111 # Keep the current configuration
112 printf '⚠️ Check new version %s to make sure searx is working properly\n' "${NEW_CONF}"
113 cp "${REF_CONF}" "${NEW_CONF}"
114 $PATCH_REF_CONF "${NEW_CONF}"
117 printf 'Use existing %s\n' "${CONF}"
120 printf 'Create %s\n' "${CONF}"
121 cp "${REF_CONF}" "${CONF}"
122 $PATCH_REF_CONF "${CONF}"
126# make sure there are uwsgi settings
127update_conf ${FORCE_CONF_UPDATE} "${UWSGI_SETTINGS_PATH}" "/usr/local/searx/dockerfiles/uwsgi.ini" "patch_uwsgi_settings"
129# make sure there are searx settings
130update_conf "${FORCE_CONF_UPDATE}" "${SEARX_SETTINGS_PATH}" "/usr/local/searx/searx/settings.yml" "patch_searx_settings"
132# dry run (to update configuration files, then inspect them)
133if [ $DRY_RUN -eq 1 ]; then
139touch /var/run/uwsgi-logrotate
140chown -R searx:searx /var/log/uwsgi /var/run/uwsgi-logrotate
144printf 'Listen on %s\n' "${BIND_ADDRESS}"
145exec 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