Compare commits

...

36 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
Girish Ramakrishnan 4c80338eba Version 1.5.0 2021-02-22 18:38:30 -08:00
Girish Ramakrishnan 48776dd2eb fix restore test 2021-02-22 18:37:56 -08:00
Girish Ramakrishnan 0d1b521cd5 Fix ignore files 2021-02-22 16:53:08 -08:00
Girish Ramakrishnan d44dcd27f8 Update base image to v3 2021-02-22 16:52:09 -08:00
Girish Ramakrishnan 838444dc93 Version 1.4.0 2020-12-14 12:41:32 -08:00
Girish Ramakrishnan bd6a356b13 Update modules 2020-12-14 12:34:28 -08:00
Girish Ramakrishnan 3348258e40 update manifest 2020-12-14 12:32:39 -08:00
Girish Ramakrishnan e0bf22252d Update searx to 0.18.0 2020-12-14 12:32:35 -08:00
Johannes Zellner 35858fb399 Update test deps 2020-07-10 11:38:33 +02:00
Johannes Zellner 969b349508 Ensuer we set LANG for python unicode handling 2020-07-10 11:38:27 +02:00
Johannes Zellner 61c976d7e1 Bump version for 0.17.0 2020-07-10 11:02:00 +02:00
Girish Ramakrishnan c695e01e46 Version 1.2.0 2020-05-29 22:24:47 -07:00
Girish Ramakrishnan 5e589b172d Update test packages 2020-05-29 22:24:40 -07:00
Girish Ramakrishnan 5d58feb11e Use latest base image 2020-05-29 22:13:39 -07:00
Girish Ramakrishnan 77e1ba83c5 Version 1.1.0-1 2020-03-04 15:06:14 -08:00
Johannes Zellner 79ea1fc16e Update logo 2020-03-04 12:53:32 -08:00
Girish Ramakrishnan c066df0cb9 Version 1.1.0 2020-03-04 12:45:42 -08:00
Girish Ramakrishnan f492615de7 add search test 2020-03-04 12:40:48 -08:00
Girish Ramakrishnan a04afb5411 More python3 fixes 2020-03-04 12:30:01 -08:00
Girish Ramakrishnan 2397fd0d8b add tests 2020-03-04 12:15:42 -08:00
Girish Ramakrishnan c32be4977e Use python3-pip 2020-03-04 12:14:34 -08:00
Girish Ramakrishnan c3b2545c04 Merge branch 'patch-1' into 'master'
Updating dockerfile with pip3 install command instead of pip which was calling pip2.7 (deprecated).

See merge request cloudron/searx-app!1
2020-03-04 20:11:07 +00:00
SUMAC Initiative 12bca09526 Missed two references to python2.7 updated to python3 2020-03-04 14:52:32 +00:00
SUMAC Initiative 5ebdc58448 Updating dockerfile with pip3 install command instead of pip which was calling pip2.7 (deprecated). 2020-03-04 14:44:11 +00:00
Girish Ramakrishnan b8a3874692 Version 1.0.0 2020-02-18 19:24:00 -08:00
Girish Ramakrishnan 2c9c0044d8 Fix import error in 0.16.0 2020-02-18 19:21:07 -08:00
Girish Ramakrishnan 1eb19681c0 Update searx to version 0.16.0 2020-02-18 19:19:52 -08:00
13 changed files with 3110 additions and 38 deletions

View file

@ -2,4 +2,6 @@
.gitignore .gitignore
.dockerignore .dockerignore
node_modules node_modules
screenshots
test

3
.gitignore vendored
View file

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

View file

@ -11,3 +11,38 @@
[0.3.0] [0.3.0]
* Update screenshots * Update screenshots
[1.0.0]
* Update Searx to 0.16.0
[1.1.0]
* Use python3 as python2 support is deprecated
[1.2.0]
* Use latest base image 2.0.0
[1.3.0]
* Update Searx to 0.17.0
* Add new search engines
* [Full changelog](https://github.com/asciimoo/searx/releases/tag/v0.17.0)
[1.4.0]
* Update Searx to 0.18.0
* [Full changelog](https://github.com/asciimoo/searx/releases/tag/v0.18.0)
* separate index and search routes ( #1681 ). warning add & remove your searx instance(s) from your browser.
* add external_bang ( #2027 #2043 #2059 )
* add external plugins supports ( #2074 )
* add plugin converting strings into hash digests ( #1246 )
* new category: Onions ( #565 )
* allow searx query parts anywhere in the query ( aa3c18d 2aef38c )
[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,28 +1,30 @@
{ {
"id": "io.github.ascimoo.searx", "id": "io.github.searxng.searxng",
"title": "searx", "title": "searxng",
"author": "searx authors", "author": "searxng authors",
"description": "file://DESCRIPTION.md", "description": "file://DESCRIPTION.md",
"changelog": "file://CHANGELOG", "changelog": "file://CHANGELOG",
"tagline": "Privacy-respecting metasearch engine", "tagline": "Privacy-respecting metasearch engine",
"version": "0.3.0", "version": "1.0.0",
"memoryLimit": 589719142400,
"healthCheckPath": "/", "healthCheckPath": "/",
"httpPort": 8888, "httpPort": 8888,
"addons": { "addons": {
"localstorage": {} "localstorage": {},
"redis": {}
}, },
"manifestVersion": 2, "manifestVersion": 2,
"website": "https://asciimoo.github.io/searx/", "website": "https://docs.searxng.org",
"contactEmail": "support@cloudron.io", "contactEmail": "support@cloudron.io",
"icon": "file://logo.png", "icon": "file://logo.png",
"tags": [ "tags": [
"search", "metasearch" "search", "metasearch", "bing", "google", "duckduckgo", "privacy"
], ],
"mediaLinks": [ "mediaLinks": [
"https://cloudron-app-screenshots.s3.amazonaws.com/io.github.ascimoo.searx/9456666ef5a9d278b2282a888a53aa7f676c305c/1.png", "https://screenshots.cloudron.io/io.github.ascimoo.searx/1.png",
"https://cloudron-app-screenshots.s3.amazonaws.com/io.github.ascimoo.searx/9456666ef5a9d278b2282a888a53aa7f676c305c/2.png", "https://screenshots.cloudron.io/io.github.ascimoo.searx/2.png",
"https://cloudron-app-screenshots.s3.amazonaws.com/io.github.ascimoo.searx/9456666ef5a9d278b2282a888a53aa7f676c305c/3.png" "https://screenshots.cloudron.io/io.github.ascimoo.searx/3.png"
], ],
"minBoxVersion": "4.1.5", "minBoxVersion": "5.3.0",
"documentationUrl": "https://cloudron.io/documentation/apps/searx/" "documentationUrl": "https://git.caric.io/cloudron-apps/searxng-app"
} }

View file

@ -1,8 +1,10 @@
This app packages searx version <upstream>1.0.0</upstream>.
### About
Searx is a [metasearch engine](https://en.wikipedia.org/wiki/Metasearch_engine), aggregating the results of other [search engines]({{ url_for('preferences') }}) while not storing information about its users. Searx is a [metasearch engine](https://en.wikipedia.org/wiki/Metasearch_engine), aggregating the results of other [search engines]({{ url_for('preferences') }}) while not storing information about its users.
This app packages searx version <upstream>ddee4861cee8d5b</upstream>. ### Why use searx?
## Why use searx?
* searx may not offer you as personalised results as Google, but it doesn't generate a profile about you * searx may not offer you as personalised results as Google, but it doesn't generate a profile about you
* searx doesn't care about what you search for, never shares anything with a third party, and it can't be used to compromise you * searx doesn't care about what you search for, never shares anything with a third party, and it can't be used to compromise you
@ -10,19 +12,19 @@ This app packages searx version <upstream>ddee4861cee8d5b</upstream>.
If you do care about privacy, want to be a conscious user, or otherwise believe in digital freedom, make searx your default search engine or run it on your own server If you do care about privacy, want to be a conscious user, or otherwise believe in digital freedom, make searx your default search engine or run it on your own server
## Technical details - How does it work? ### Technical details - How does it work?
Searx is a [metasearch engine](https://en.wikipedia.org/wiki/Metasearch_engine), inspired by the [seeks project](https://beniz.github.io/seeks/). Searx is a [metasearch engine](https://en.wikipedia.org/wiki/Metasearch_engine), inspired by the [seeks project](https://beniz.github.io/seeks/).
It provides basic privacy by mixing your queries with searches on other platforms without storing search data. Queries are made using a POST request on every browser (except chrome*). Therefore they show up in neither our logs, nor your url history. In case of Chrome* users there is an exception, searx uses the search bar to perform GET requests. It provides basic privacy by mixing your queries with searches on other platforms without storing search data. Queries are made using a POST request on every browser (except chrome*). Therefore they show up in neither our logs, nor your url history. In case of Chrome* users there is an exception, searx uses the search bar to perform GET requests.
Searx can be added to your browser's search bar; moreover, it can be set as the default search engine. Searx can be added to your browser's search bar; moreover, it can be set as the default search engine.
## How can I make it my own? ### How can I make it my own?
Searx appreciates your concern regarding logs, so take the [code](https://github.com/asciimoo/searx) and run it yourself! Searx appreciates your concern regarding logs, so take the [code](https://github.com/asciimoo/searx) and run it yourself!
Add your Searx to this [list](https://github.com/asciimoo/searx/wiki/Searx-instances) to help other people reclaim their privacy and make the Internet freer! Add your Searx to this [list](https://github.com/asciimoo/searx/wiki/Searx-instances) to help other people reclaim their privacy and make the Internet freer!
The more decentralized the Internet is, the more freedom we have! The more decentralized the Internet is, the more freedom we have!
## More about searx ### More about searx
* [github](https://github.com/asciimoo/searx) * [github](https://github.com/asciimoo/searx)
* [ohloh](https://www.ohloh.net/p/searx/) * [ohloh](https://www.ohloh.net/p/searx/)

View file

@ -1,21 +1,41 @@
FROM cloudron/base:1.0.0@sha256:147a648a068a2e746644746bbfb42eb7a50d682437cead3c67c933c546357617 FROM cloudron/base:3.2.0@sha256:ba1d566164a67c266782545ea9809dc611c4152e27686fd14060332dd88263ea
ARG VERSION=1.0.0
RUN mkdir -p /app/code /app/pkg RUN mkdir -p /app/code /app/pkg
WORKDIR /app/code WORKDIR /app/code
RUN apt update && \ # download the source code
apt install -y python build-essential libxslt-dev python-dev python-virtualenv zlib1g-dev libffi-dev libssl-dev python-pip && \ RUN curl -L https://git.caric.io/mirrors/searxng/archive/m${VERSION}.tar.gz | tar -xz --strip-components 1 -f -
rm -rf /var/cache/apt /var/lib/apt/lists
RUN curl -L https://github.com/asciimoo/searx/archive/ddee4861cee8d5b08e9219d4e727acc35fc3ca32.tar.gz | tar -xz --strip-components 1 -f - # install dependencies, including app dependencies from `requirements.txt`
RUN pip install --no-cache -r /app/code/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 && \ RUN mv /app/code/searx/settings.yml /app/code/searx/settings.yml.orig && \
ln -sf /app/data/settings.yml /app/code/searx/settings.yml 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 RUN chown -R www-data.www-data /app/code
EXPOSE 8888 # Fix python UnicodeDecodeError
ENV LANG C.UTF-8
COPY start.sh /app/pkg/start.sh COPY start.sh /app/pkg/start.sh

View file

@ -1,8 +1,8 @@
# Searx for Cloudron # SearXNG for Cloudron
A privacy-respecting, hackable metasearch engine A privacy-respecting, hackable metasearch engine
- developped by : [Adam Tauber](https://github.com/asciimoo/searx/) - developed at : [SearXNG official repo](https://github.com/searxng/searxng)
- forked from : [Joey / Searx-app](https://git.cloudron.io/joey/searx-app/) - forked from : [Cloudron / Searx-app](https://git.cloudron.io/cloudron/searx-app)
## History ## 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. 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.

BIN
logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 34 KiB

185
logo.svg Normal file
View file

@ -0,0 +1,185 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="512"
height="512"
id="svg2"
version="1.1"
inkscape:version="0.92.4 5da689c313, 2019-01-14"
sodipodi:docname="logo.svg"
inkscape:export-filename="/home/nebulon/projects/yellowtent/apps/searx-app/logo.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<defs
id="defs4">
<linearGradient
inkscape:collect="always"
id="linearGradient3857">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop3859" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop3861" />
</linearGradient>
<linearGradient
id="linearGradient3790">
<stop
style="stop-color:#a9a9a9;stop-opacity:1;"
offset="0"
id="stop3792" />
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="1"
id="stop3794" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3790"
id="radialGradient3798"
cx="294.45947"
cy="208.37973"
fx="294.45947"
fy="208.37973"
r="107.58125"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3857"
id="linearGradient3865"
x1="120.68947"
y1="239.61774"
x2="120.68947"
y2="602.17517"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3790"
id="linearGradient3912"
x1="186.74416"
y1="354.42426"
x2="255.84358"
y2="254.35953"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2227304,0,0,0.89945099,-289.31433,113.40259)" />
<filter
inkscape:collect="always"
id="filter4024"
x="-0.12996517"
width="1.2599303"
y="-0.14709377"
height="1.2941875">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="6.4759344"
id="feGaussianBlur4026" />
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.9899495"
inkscape:cx="100.20871"
inkscape:cy="517.35376"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="2880"
inkscape:window-height="1564"
inkscape:window-x="0"
inkscape:window-y="56"
inkscape:window-maximized="1"
showguides="true"
inkscape:guide-bbox="true" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-540.36218)">
<g
id="g4544"
transform="matrix(1.4692274,0,0,1.4692274,-77.435488,517.1562)">
<path
inkscape:connector-curvature="0"
id="path3814-0-7"
d="m 70.523181,34.870671 c -7.11959,15.242893 -10.17798,31.779192 -8.22563,48.814566 5.01677,43.774133 41.675309,79.324503 91.536109,95.162893 -6.62576,-22.40752 -5.34093,-44.9362 2.6395,-65.84431 C 108.73618,98.821131 74.828141,70.195435 70.523181,34.870671 Z"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
<path
inkscape:connector-curvature="0"
id="path3814-0"
d="m 303.77876,36.21406 c 7.11959,15.242893 10.17798,31.779192 8.22563,48.814566 -5.01677,43.774134 -41.67531,79.324504 -91.53611,95.162894 6.62576,-22.40752 5.34093,-44.9362 -2.6395,-65.84431 47.73698,-14.18269 81.64502,-42.808386 85.94998,-78.13315 z"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none" />
<path
inkscape:connector-curvature="0"
id="rect3804"
d="M -5.0905523,259.06055 H 13.326205 c 6.220455,0 11.228257,16.68196 11.228257,37.40349 v 172.83701 c 0,20.72153 -5.007802,37.40349 -11.228257,37.40349 H -5.0905523 c -6.2204547,0 -11.2282577,-16.68196 -11.2282577,-37.40349 V 296.46404 c 0,-20.72153 5.007803,-37.40349 11.2282577,-37.40349 z"
style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
transform="rotate(-49.03034)" />
<circle
r="107.58125"
cy="208.37973"
cx="294.45947"
transform="translate(-107.07617,-60.609153)"
id="path2987"
style="fill:url(#radialGradient3798);fill-opacity:1;fill-rule:nonzero;stroke:none" />
<circle
r="101.52033"
cy="299.29346"
cx="131.82491"
transform="matrix(0.76865672,0,0,0.76865672,85.80266,-82.535889)"
id="path3757"
style="fill:url(#linearGradient3865);fill-opacity:1;fill-rule:nonzero;stroke:none" />
<circle
r="27.274118"
cy="156.35687"
cx="183.34268"
transform="translate(5,-7.1428572)"
id="path3800"
style="fill:#1a1a1a;fill-opacity:1;fill-rule:nonzero;stroke:none" />
<circle
r="5.5558391"
cy="203.32896"
cx="197.9899"
transform="translate(1.4847712,-63.564549)"
id="path3802"
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none" />
<rect
transform="matrix(0.74466525,-0.84318084,0.84318084,0.74466525,-35.543204,-26.349917)"
ry="9.0007057"
rx="2.8666623"
y="337.8396"
x="19.525793"
height="159.43797"
width="2.2392972"
id="rect3916"
style="fill:#ffffff;fill-opacity:0.82211531;fill-rule:nonzero;stroke:none;filter:url(#filter4024)" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.3 KiB

View file

@ -2,15 +2,29 @@
set -eu set -eu
if [[ -z "$(ls -A /app/data)" ]]; then if [[ ! -f /app/data/uwsgi.ini ]]; then
echo "=> Detected first run" 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 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" \ -e "s/ultrasecretkey/`openssl rand -hex 16`/g" \
-i /app/data/settings.yml -i /app/data/settings.yml
fi fi
chown -R www-data.www-data /app/data chown -R www-data.www-data /app/data
echo "==> Starting searx" echo "==> Starting searXNG"
exec gosu www-data python /app/code/searx/webapp.py exec gosu www-data uwsgi --master --ini /app/data/uwsgi.ini --http-socket "0.0.0.0:8888"

2680
test/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

18
test/package.json Normal file
View file

@ -0,0 +1,18 @@
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "test.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"expect.js": "^0.3.1",
"mocha": "^9.1.4",
"selenium-server-standalone-jar": "^3.141.59",
"selenium-webdriver": "^4.1.1",
"chromedriver": "^97.0.0"
}
}

113
test/test.js Normal file
View file

@ -0,0 +1,113 @@
#!/usr/bin/env node
/* jslint node:true */
/* global it:false */
/* global xit:false */
/* global describe:false */
/* global before:false */
/* global after:false */
'use strict';
require('chromedriver');
const execSync = require('child_process').execSync,
expect = require('expect.js'),
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');
process.exit(1);
}
describe('Application life cycle test', function () {
this.timeout(0);
let browser, app;
const LOCATION = 'test';
const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
before(function () {
browser = new Builder().forBrowser('chrome').setChromeOptions(new Options().windowSize({ width: 1280, height: 1024 })).build();
});
after(function () {
browser.quit();
});
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);
}
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', EXEC_ARGS);
});
it('install app', function () {
execSync('cloudron install --location ' + LOCATION, EXEC_ARGS);
});
it('can get app information', getAppInfo);
it('can search', search);
it('backup app', function () {
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, 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 () {
execSync('cloudron restart --app ' + app.id);
});
it('can search', search);
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, EXEC_ARGS);
});
// test update
it('can install from appstore', function () {
execSync(`cloudron install --appstore-id ${app.manifest.id} --location ${LOCATION}`, EXEC_ARGS);
getAppInfo();
});
it('can update', function () {
execSync('cloudron update --app ' + LOCATION, EXEC_ARGS);
getAppInfo();
});
it('can search', search);
it('uninstall app', function () {
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
});
});