Compare commits

...

9 commits

Author SHA1 Message Date
Rafael Caricio 2edb8d8e15
Predictable memory usage
Signed-off-by: Rafael Caricio <rafael@caricio.com>
2022-07-08 19:04:48 +02:00
Rafael Caricio 15d4435d80
Updated dockerfile with metadata
Signed-off-by: Rafael Caricio <rafael@caricio.com>
2022-07-08 18:40:49 +02:00
Rafael Caricio 9a822af310
Enable redis addon
Signed-off-by: Rafael Caricio <rafael@caricio.com>
2022-07-08 18:21:11 +02:00
Rafael Caricio 7c7a55c078
Initial usable version
Signed-off-by: Rafael Caricio <rafael@caricio.com>
2022-07-08 18:07:39 +02:00
Girish Ramakrishnan b7b5a688a7 Version 1.6.1 2022-01-23 11:00:04 -08:00
Girish Ramakrishnan 73e3ad3341 Make tests async 2022-01-23 10:50:53 -08:00
Girish Ramakrishnan be87dfccc4 Update base image to 3.2.0 2022-01-23 10:45:00 -08:00
Johannes Zellner 98dd94bd4a Update test deps 2021-03-28 11:12:32 +02:00
Johannes Zellner 10b6dc9962 Bump version for 1.0.0 2021-03-28 11:11:31 +02:00
10 changed files with 1955 additions and 508 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
test/node_modules/
tmp/*

View file

@ -38,3 +38,11 @@
[1.5.0]
* Update base image to v3
[1.6.0]
* Update Searx to 1.0.0
* The searx maintainer team, would like to say a huge thank you for everybody who had been involved in the development of searx or supported us in the past 7 years - making our first stable release available. Special thanks to NLNet for sponsoring multiple features of this release.
* [Full changelog](https://github.com/searx/searx/releases/tag/1.0.0)
[1.6.1]
* Update base image to 3.2.0

View file

@ -1,18 +1,20 @@
{
"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.5.0",
"version": "1.0.0",
"memoryLimit": 589719142400,
"healthCheckPath": "/",
"httpPort": 8888,
"addons": {
"localstorage": {}
"localstorage": {},
"redis": {}
},
"manifestVersion": 2,
"website": "https://asciimoo.github.io/searx/",
"website": "https://docs.searxng.org",
"contactEmail": "support@cloudron.io",
"icon": "file://logo.png",
"tags": [
@ -24,6 +26,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"
}

View file

@ -1,4 +1,4 @@
This app packages searx version <upstream>0.18.0</upstream>.
This app packages searx version <upstream>1.0.0</upstream>.
### About

View file

@ -1,19 +1,37 @@
FROM cloudron/base:3.0.0@sha256:455c70428723e3a823198c57472785437eb6eab082e79b3ff04ea584faf46e92
FROM cloudron/base:3.2.0@sha256:ba1d566164a67c266782545ea9809dc611c4152e27686fd14060332dd88263ea
ARG VERSION=0.18.0
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
RUN echo "VERSION_STRING=\"m${VERSION}\";VERSION_TAG=\"m${VERSION}\";GIT_URL=\"https://git.caric.io/mirrors/searxng\";GIT_BRANCH=\"m${VERSION}\"" \
> /app/code/searx/version_frozen.py
RUN chown -R www-data.www-data /app/code
# Fix python UnicodeDecodeError

View file

@ -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.

View file

@ -2,15 +2,29 @@
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/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"
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/url: .*redis\.sock.*/url: \"redis:\/\/:${CLOUDRON_REDIS_PASSWORD}@${CLOUDRON_REDIS_HOST}:${CLOUDRON_REDIS_PORT}\/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"

2263
test/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -10,9 +10,9 @@
"license": "ISC",
"dependencies": {
"expect.js": "^0.3.1",
"mocha": "^8.2.1",
"mocha": "^9.1.4",
"selenium-server-standalone-jar": "^3.141.59",
"selenium-webdriver": "^3.6.0",
"chromedriver": "^87.0.4"
"selenium-webdriver": "^4.1.1",
"chromedriver": "^97.0.0"
}
}

View file

@ -11,14 +11,11 @@
require('chromedriver');
var execSync = require('child_process').execSync,
const execSync = require('child_process').execSync,
expect = require('expect.js'),
path = require('path');
var by = require('selenium-webdriver').By,
until = require('selenium-webdriver').until,
Key = require('selenium-webdriver').Key,
Builder = require('selenium-webdriver').Builder;
path = require('path'),
{ Builder, By, Key, until } = require('selenium-webdriver'),
{ Options } = require('selenium-webdriver/chrome');
if (!process.env.USERNAME || !process.env.PASSWORD || !process.env.EMAIL) {
console.log('USERNAME, PASSWORD and EMAIL env vars need to be set');
@ -28,112 +25,89 @@ if (!process.env.USERNAME || !process.env.PASSWORD || !process.env.EMAIL) {
describe('Application life cycle test', function () {
this.timeout(0);
var server, browser = new Builder().forBrowser('chrome').build();
let browser, app;
const LOCATION = 'test';
const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
before(function (done) {
var seleniumJar= require('selenium-server-standalone-jar');
var SeleniumServer = require('selenium-webdriver/remote').SeleniumServer;
server = new SeleniumServer(seleniumJar.path, { port: 4444 });
server.start();
done();
before(function () {
browser = new Builder().forBrowser('chrome').setChromeOptions(new Options().windowSize({ width: 1280, height: 1024 })).build();
});
after(function (done) {
after(function () {
browser.quit();
server.stop();
done();
});
function search(done) {
browser.get(`https://${app.fqdn}`).then(function () {
return browser.wait(until.elementLocated(by.id('q')), 5000);
}).then(function () {
return browser.findElement(by.id('q')).sendKeys('cloudron');
}).then(function () {
return browser.findElement(by.id('q')).sendKeys(Key.RETURN);
}).then(function () {
return browser.wait(until.elementLocated(by.xpath('//span[text()="Cloudron"]')), 5000);
}).then(function () {
return done();
});
async function search() {
await browser.get(`https://${app.fqdn}`);
await browser.wait(until.elementLocated(By.id('q')), 5000);
await browser.findElement(By.id('q')).sendKeys('cloudron');
await browser.findElement(By.id('q')).sendKeys(Key.RETURN);
await browser.wait(until.elementLocated(By.xpath('//span[text()="Cloudron"]')), 5000);
}
var LOCATION = 'test';
var app;
function getAppInfo() {
const inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location.startsWith(LOCATION); })[0];
expect(app).to.be.an('object');
}
xit('build app', function () {
execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
execSync('cloudron build', EXEC_ARGS);
});
it('install app', function () {
execSync('cloudron install --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
execSync('cloudron install --location ' + LOCATION, EXEC_ARGS);
});
it('can get app information', function () {
var inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location === LOCATION; })[0];
expect(app).to.be.an('object');
});
it('can get app information', getAppInfo);
it('can search', search);
it('backup app', function () {
execSync('cloudron backup create --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
execSync('cloudron backup create --app ' + app.id, EXEC_ARGS);
});
it('restore app', function () {
const backups = JSON.parse(execSync('cloudron backup list --raw'));
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
execSync('cloudron install --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
var inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location === LOCATION; })[0];
execSync(`cloudron restore --backup ${backups[0].id} --app ${app.id}`, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
execSync('cloudron install --location ' + LOCATION, EXEC_ARGS);
getAppInfo();
execSync(`cloudron restore --backup ${backups[0].id} --app ${app.id}`, EXEC_ARGS);
});
it('can search', search);
it('can restart app', function (done) {
it('can restart app', function () {
execSync('cloudron restart --app ' + app.id);
done();
});
it('can search', search);
it('move to different location', function (done) {
execSync('cloudron configure --location ' + LOCATION + '2 --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
var inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location === LOCATION + '2'; })[0];
expect(app).to.be.an('object');
done();
it('move to different location', function () {
execSync('cloudron configure --location ' + LOCATION + '2 --app ' + app.id, EXEC_ARGS);
getAppInfo();
});
it('can search', search);
it('uninstall app', function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
});
// test update
it('can install from appstore', function () {
execSync(`cloudron install --appstore-id ${app.manifest.id} --location ${LOCATION}`, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
var inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location === LOCATION; })[0];
expect(app).to.be.an('object');
execSync(`cloudron install --appstore-id ${app.manifest.id} --location ${LOCATION}`, EXEC_ARGS);
getAppInfo();
});
it('can update', function () {
execSync('cloudron update --app ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
let inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location === LOCATION; })[0];
execSync('cloudron update --app ' + LOCATION, EXEC_ARGS);
getAppInfo();
});
it('can search', search);
it('uninstall app', function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
});
});