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 " BASE_URL settings.yml : server.base_url\n"
33 printf " MORTY_URL settings.yml : result_proxy.url\n"
34 printf " MORTY_KEY settings.yml : result_proxy.key\n"
35 printf " BIND_ADDRESS where uwsgi will accept HTTP request (format : host:port)\n"
40# helpers to update the configuration files
41patch_uwsgi_settings() {
47patch_searx_settings() {
50 # Make sure that there is trailing slash at the end of BASE_URL
51 # see http://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Shell-Parameter-Expansion
52 export BASE_URL="${BASE_URL%/}/"
55 sed -i -e "s|base_url : False|base_url : ${BASE_URL}|g" \
56 -e "s/ultrasecretkey/$(openssl rand -hex 32)/g" \
60 if [ ! -z "${MORTY_KEY}" -a ! -z "${MORTY_URL}" ]; then
61 sed -i -e "s/image_proxy : False/image_proxy : True/g" \
63 cat >> "${CONF}" <<-EOF
68 key : !!binary "${MORTY_KEY}"
74 FORCE_CONF_UPDATE="$1"
81 if [ -f "${CONF}" ]; then
82 if [ "${REF_CONF}" -nt "${CONF}" ]; then
83 # There is a new version
84 if [ $FORCE_CONF_UPDATE ]; then
85 # Replace the current configuration
86 printf '⚠️ Automaticaly update %s to the new version\n' "${CONF}"
87 if [ ! -f "${OLD_CONF}" ]; then
88 printf 'The previous configuration is saved to %s\n' "${OLD_CONF}"
89 mv "${CONF}" "${OLD_CONF}"
91 cp "${REF_CONF}" "${CONF}"
92 $PATCH_REF_CONF "${CONF}"
94 # Keep the current configuration
95 printf '⚠️ Check new version %s to make sure searx is working properly\n' "${NEW_CONF}"
96 cp "${REF_CONF}" "${NEW_CONF}"
97 $PATCH_REF_CONF "${NEW_CONF}"
100 printf 'Use existing %s\n' "${CONF}"
103 printf 'Create %s\n' "${CONF}"
104 cp "${REF_CONF}" "${CONF}"
105 $PATCH_REF_CONF "${CONF}"
109# make sure there are uwsgi settings
110update_conf "${FORCE_CONF_UPDATE}" "${UWSGI_SETTINGS_PATH}" "/usr/local/searx/dockerfiles/uwsgi.ini" "patch_uwsgi_settings"
112# make sure there are searx settings
113update_conf "${FORCE_CONF_UPDATE}" "${SEARX_SETTINGS_PATH}" "/usr/local/searx/searx/settings.yml" "patch_searx_settings"
115# dry run (to update configuration files, then inspect them)
116if [ $DRY_RUN -eq 1 ]; then
122touch /var/run/uwsgi-logrotate
123chown -R searx:searx /var/log/uwsgi /var/run/uwsgi-logrotate
127printf 'Listen on %s\n' "${BIND_ADDRESS}"
128exec 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