diff --git a/.gitignore b/.gitignore index 562d512..ab2429f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ test/node_modules/ +tmp/* diff --git a/CloudronManifest.json b/CloudronManifest.json index 5371029..0555486 100644 --- a/CloudronManifest.json +++ b/CloudronManifest.json @@ -1,18 +1,18 @@ { - "id": "io.github.ascimoo.searx", - "title": "searx", - "author": "searx authors", + "id": "io.github.searxng.searxng", + "title": "searxng", + "author": "searxng authors", "description": "file://DESCRIPTION.md", "changelog": "file://CHANGELOG", "tagline": "Privacy-respecting metasearch engine", - "version": "1.6.1", + "version": "1.0.0", "healthCheckPath": "/", "httpPort": 8888, "addons": { "localstorage": {} }, "manifestVersion": 2, - "website": "https://asciimoo.github.io/searx/", + "website": "https://docs.searxng.org", "contactEmail": "support@cloudron.io", "icon": "file://logo.png", "tags": [ @@ -24,6 +24,5 @@ "https://screenshots.cloudron.io/io.github.ascimoo.searx/3.png" ], "minBoxVersion": "5.3.0", - "documentationUrl": "https://docs.cloudron.io/apps/searx/", - "forumUrl": "https://forum.cloudron.io/category/47/searx" + "documentationUrl": "https://git.caric.io/cloudron-apps/searxng-app" } diff --git a/Dockerfile b/Dockerfile index 5114431..9caf331 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,12 +4,27 @@ ARG VERSION=1.0.0 RUN mkdir -p /app/code /app/pkg WORKDIR /app/code -RUN apt update && \ - apt install -y python3 build-essential libxslt-dev python3-dev python3-virtualenv python3-setuptools zlib1g-dev libffi-dev libssl-dev python3-pip && \ - rm -rf /var/cache/apt /var/lib/apt/lists +# download the source code +RUN curl -L https://git.caric.io/mirrors/searxng/archive/m${VERSION}.tar.gz | tar -xz --strip-components 1 -f - -RUN curl -L https://github.com/asciimoo/searx/archive/v${VERSION}.tar.gz | tar -xz --strip-components 1 -f - -RUN pip3 install --no-cache -r /app/code/requirements.txt +# install dependencies, including app dependencies from `requirements.txt` +RUN apt update && \ + apt install -y python3 build-essential libxslt-dev python3-dev python3-virtualenv python3-setuptools zlib1g-dev libffi-dev libssl-dev python3-pip git tar ca-certificates libxml2 libxslt1-dev brotli && \ + rm -rf /var/cache/apt /var/lib/apt/lists && \ + pip3 install --upgrade pip wheel setuptools uwsgi && \ + pip3 install --no-cache -r /app/code/requirements.txt + +# compile code and compress static files +RUN /usr/bin/python3 -m compileall -q searx +# RUN find /app/code/searx/static -a \( -name '*.html' -o -name '*.css' -o -name '*.js' -o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) -type f -exec gzip -9 -k {} \+ -exec brotli --best {} \+ + +ENV INSTANCE_NAME=searxng \ + AUTOCOMPLETE= \ + BASE_URL= \ + MORTY_KEY= \ + MORTY_URL= \ + SEARXNG_SETTINGS_PATH=/app/data/settings.yml \ + UWSGI_SETTINGS_PATH=/app/data/uwsgi.ini RUN mv /app/code/searx/settings.yml /app/code/searx/settings.yml.orig && \ ln -sf /app/data/settings.yml /app/code/searx/settings.yml diff --git a/README.md b/README.md index 88d271a..4ef1880 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Searx for Cloudron +# SearXNG for Cloudron A privacy-respecting, hackable metasearch engine -- developped by : [Adam Tauber](https://github.com/asciimoo/searx/) -- forked from : [Joey / Searx-app](https://git.cloudron.io/joey/searx-app/) +- developed at : [SearXNG official repo](https://github.com/searxng/searxng) +- forked from : [Cloudron / Searx-app](https://git.cloudron.io/cloudron/searx-app) ## History The success of this app belong to [Joey](https://git.cloudron.io/joey/searx-app/) who, pretty much, build it. I added few pieces on the puzzle and maintain it. diff --git a/start.sh b/start.sh index ce57e32..8c944ce 100755 --- a/start.sh +++ b/start.sh @@ -2,15 +2,27 @@ set -eu -if [[ -z "$(ls -A /app/data)" ]]; then - echo "=> Detected first run" +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' \ + 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 searx" -exec gosu www-data python3 /app/code/searx/webapp.py +echo "==> Starting searXNG" +exec gosu www-data uwsgi --master --ini /app/data/uwsgi.ini --http-socket "0.0.0.0:8888"