1
0
mirror of https://git.cloudron.io/cloudron/syncthing-app synced 2025-09-13 16:29:09 +00:00

Compare commits

...

50 Commits

Author SHA1 Message Date
Girish Ramakrishnan
4c1b0d17e9 Version 1.1.0 2018-10-14 14:39:36 -07:00
Girish Ramakrishnan
e68c1e9ef2 Use latest base image 2018-10-14 14:39:18 -07:00
Girish Ramakrishnan
0d98ee2f5c Version 1.0.7 2018-10-04 16:35:40 -07:00
Girish Ramakrishnan
b2f48f24af Update syncthing to 0.14.51 2018-10-04 16:13:10 -07:00
Girish Ramakrishnan
481765c3db Version 1.0.6 2018-09-11 16:24:19 -07:00
Girish Ramakrishnan
6ea6e0cd30 Update packages 2018-09-11 16:14:50 -07:00
Girish Ramakrishnan
0cd6523548 Update syncthing to 0.14.50 2018-09-11 15:56:03 -07:00
Girish Ramakrishnan
ae1f3401ae Version 1.0.5 2018-08-08 18:17:51 -07:00
Girish Ramakrishnan
7dd3979bdc Update Syncthing to 0.14.49 2018-08-08 18:16:29 -07:00
Girish Ramakrishnan
a5a91b09c8 Version 1.0.4 2018-06-07 09:26:24 -07:00
Girish Ramakrishnan
91335ebc70 Update syncthing to 0.14.48 2018-06-07 09:21:41 -07:00
Girish Ramakrishnan
c0ba039523 Version 1.0.3 2018-05-02 13:33:56 -07:00
Girish Ramakrishnan
9f78b41ca2 make the tests work 2018-05-02 13:33:07 -07:00
Girish Ramakrishnan
5c2828f669 Fix paranthesis 2018-05-02 13:22:27 -07:00
Girish Ramakrishnan
391419d9f4 Update syncthing to 0.14.47 2018-05-02 13:10:39 -07:00
Girish Ramakrishnan
d99a39a0e5 Version 1.0.2 2018-04-08 00:12:35 -07:00
Girish Ramakrishnan
ab3a81a67b update package.json 2018-04-08 00:11:57 -07:00
Girish Ramakrishnan
8e5306db31 install chromedriver 2018-04-06 17:02:37 -07:00
Girish Ramakrishnan
e73991042d Update syncthing to 0.14.46 2018-04-06 17:01:24 -07:00
Girish Ramakrishnan
d566e12bc9 Version 1.0.1 2018-03-06 09:42:25 -08:00
Girish Ramakrishnan
6d051c2ad1 Update syncthing to 0.14.45 2018-03-06 09:25:21 -08:00
Girish Ramakrishnan
72d3757c51 add bad login test 2018-02-26 18:15:29 -08:00
Girish Ramakrishnan
5ca914f8d3 Fix mediaLinks 2018-02-26 17:50:51 -08:00
Girish Ramakrishnan
53bc9300d7 Add screenshots from docs 2018-02-26 17:48:24 -08:00
Girish Ramakrishnan
b67f87106f Add documentationUrl 2018-02-26 17:42:51 -08:00
Girish Ramakrishnan
84533d94cc Add back removeFolder 2018-02-26 17:16:52 -08:00
Girish Ramakrishnan
7d0ae7f24a Version 1.0.0 2018-02-26 17:14:03 -08:00
Girish Ramakrishnan
1901d8450d Fix tests 2018-02-26 17:09:23 -08:00
Girish Ramakrishnan
319d23ead8 Change the appstore id since it is not compat with older version 2018-02-26 17:08:41 -08:00
Girish Ramakrishnan
c1da43713e Fix postinstall 2018-02-26 17:08:41 -08:00
Girish Ramakrishnan
310b9443b0 Add nginx for healthcheck route 2018-02-26 16:35:12 -08:00
Girish Ramakrishnan
ee5dc6e5b8 Set defaultFolderPath 2018-02-26 14:59:30 -08:00
Girish Ramakrishnan
c8eca300d8 log audit events 2018-02-26 14:51:54 -08:00
Girish Ramakrishnan
22f8c8625e Move env vars 2018-02-26 14:51:26 -08:00
Girish Ramakrishnan
7a9f077e99 Use SYNC_PORT instead 2018-02-26 14:46:02 -08:00
Girish Ramakrishnan
9e7649fe36 Revert "Disable usage reporter"
This reverts commit aa6baa6ab9.

This is unnecessary, let the app decide the best UX
2018-02-26 14:44:53 -08:00
Girish Ramakrishnan
5b2993e1e0 No USERNAME and PASSWORD anymore 2018-02-26 14:44:35 -08:00
Girish Ramakrishnan
2fd1f42e44 Update post install 2018-02-26 14:44:35 -08:00
Girish Ramakrishnan
aa6baa6ab9 Disable usage reporter 2018-02-26 14:41:36 -08:00
Girish Ramakrishnan
9cd9df2876 Set default admin/password 2018-02-26 14:40:20 -08:00
Girish Ramakrishnan
09b27ff425 Rename to SYNCER_PORT 2018-02-26 14:07:43 -08:00
Girish Ramakrishnan
94520d61bf Remove ldap auth
syncthing is fundamentally a single user app and it's confusing that
one can LDAP login giving the impression it is somehow multi-user.
2018-02-26 14:05:39 -08:00
Girish Ramakrishnan
cdca87ef50 Update syncthing to 0.14.44 2018-02-26 08:54:55 -08:00
Girish Ramakrishnan
3078a34c8d Syncthing 0.14.42 2017-12-28 19:13:32 -08:00
Girish Ramakrishnan
a3f10a7f2d Use syncthing 0.14.41 2017-12-14 16:09:28 +05:30
Dennis Schwerdel
748697ba51 Version 0.5.0 2017-11-26 23:27:19 +01:00
Girish Ramakrishnan
d281fb8aef Version 0.4.0 2017-10-14 11:52:22 -07:00
Girish Ramakrishnan
d72a041d67 Use syncthing 0.14.39 2017-10-14 11:47:27 -07:00
Dennis Schwerdel
88a47bcf1a Update to 0.14.38 2017-09-21 23:06:33 +02:00
Dennis Schwerdel
6be20dbf5e Update to 0.14.37 2017-09-05 18:36:50 +02:00
16 changed files with 190 additions and 109 deletions

View File

@@ -40,3 +40,59 @@
[0.3.2] [0.3.2]
* Updated to version 0.14.36 * Updated to version 0.14.36
[0.3.3]
* Updated to version 0.14.37
[0.3.4]
* Updated to version 0.14.38
[0.4.0]
* Updated to version 0.14.39
* #4357: Removing paused folders no longer triggers a crash.
* #4360: Add further security related HTTP headers
* #4375: Improve info level logging in some cases
* #4377: Improve GUI tooltips in chromium based browsers
* #4382: Hide temporary files on Windows
* #4387: Add -device-id command line switch
[0.5.0]
* Updated to version 0.14.40
[1.0.0]
* Updated to version 0.14.44
* #4634: Panic when connecting to device with auto accept and paused folders
* #4636: List of files needed on remote is not wrapped at word boundaries
* #4644: Impossible to run non-release builds without deadlock detectors
* #4649: UTF-8 normalization does not work correctly on ZFS.
* #4654: Upgrade system shows an error on RCs in some cases
* #4657: Sparse files with zero blocks are not closed when pulling
* #4668: Remote device out of sync items shows "0 items, ~0 B"
[1.0.1]
* Updated to version 0.14.45
* #4659: panic: bug: removed more than added
* #4680: Ignore pattern beginning with "#" does not match subpaths
* #4689: Ignore patterns in web UI aren't reloaded if only comments change
* #4701: Global is different from local state when ignoring files
[1.0.2]
* Update Syncthing to version 0.14.46
[1.0.3]
* Update Syncthing to version 0.14.47
[1.0.4]
* Update Syncthing to version 0.14.48
[1.0.5]
* Update Syncthing to 0.14.49
[1.0.6]
* Update Syncthign to 0.14.50
[1.0.7]
* Update Syncthing to 0.14.51
[1.1.0]
* Use latest base image

View File

@@ -1,20 +1,19 @@
{ {
"id": "net.syncthing.cloudronapp", "id": "net.syncthing.cloudronapp2",
"title": "Syncthing", "title": "Syncthing",
"author": "Syncthing Developers", "author": "Syncthing Developers",
"description": "file://DESCRIPTION.md", "description": "file://DESCRIPTION.md",
"changelog": "file://CHANGELOG", "changelog": "file://CHANGELOG",
"tagline": "Decentralized file synchronization", "tagline": "Decentralized file synchronization",
"version": "0.3.2", "version": "1.1.0",
"healthCheckPath": "/check", "healthCheckPath": "/healthcheck",
"httpPort": 8000, "httpPort": 8000,
"addons": { "addons": {
"localstorage": {}, "localstorage": {}
"ldap": {}
}, },
"tcpPorts": { "tcpPorts": {
"PORT": { "SYNC_PORT": {
"title": "Port", "title": "Sync Port",
"description": "Port over which syncthing will exchange data (do not disable)", "description": "Port over which syncthing will exchange data (do not disable)",
"defaultValue": 22000, "defaultValue": 22000,
"containerPort": 22000 "containerPort": 22000
@@ -28,8 +27,12 @@
"storage", "storage",
"sync" "sync"
], ],
"minBoxVersion": "1.8.1",
"documentationUrl": "https://cloudron.io/documentation/apps/syncthing/",
"mediaLinks": [ "mediaLinks": [
"https://git.cloudron.io/dswd/syncthing-app/raw/master/screenshots/1.jpg" "https://s3.amazonaws.com/cloudron-app-screenshots/net.syncthing.cloudronapp2/53bc9300d71bb5bf32362f8213194a0c3a415429/1.png",
"https://s3.amazonaws.com/cloudron-app-screenshots/net.syncthing.cloudronapp2/53bc9300d71bb5bf32362f8213194a0c3a415429/2.png",
"https://s3.amazonaws.com/cloudron-app-screenshots/net.syncthing.cloudronapp2/53bc9300d71bb5bf32362f8213194a0c3a415429/3.png"
], ],
"postInstallMessage": "file://POSTINSTALL.md" "postInstallMessage": "file://POSTINSTALL.md"
} }

View File

@@ -1,15 +1,17 @@
This app packages Syncthing <upstream>v0.14.36</upstream>. This app packages Syncthing <upstream>v0.14.51</upstream>.
Syncthing replaces proprietary sync and cloud services with something open, trustworthy and decentralized. Your data is your data alone and you deserve to choose where it is stored, if it is shared with some third party and how it's transmitted over the Internet. Syncthing replaces proprietary sync and cloud services with something open, trustworthy and decentralized. Your data is your data alone and you deserve to choose where it is stored, if it is shared with some third party and how it's transmitted over the Internet.
### Features ### Features
#### Secure & Private #### Secure & Private
- **Private.** None of your data is ever stored anywhere else other than on your computers. There is no central server that might be compromised, legally or illegally. - **Private.** None of your data is ever stored anywhere else other than on your computers. There is no central server that might be compromised, legally or illegally.
- **Encrypted.** All communication is secured using TLS. The encryption used includes perfect forward secrecy to prevent any eavesdropper from ever gaining access to your data. - **Encrypted.** All communication is secured using TLS. The encryption used includes perfect forward secrecy to prevent any eavesdropper from ever gaining access to your data.
- **Authenticated.** Every node is identified by a strong cryptographic certificate. Only nodes you have explicitly allowed can connect to your cluster. - **Authenticated.** Every node is identified by a strong cryptographic certificate. Only nodes you have explicitly allowed can connect to your cluster.
#### Easy to Use #### Easy to Use
Syncthing is still in development, although a large number of features have already been implemented: Syncthing is still in development, although a large number of features have already been implemented:
- **Web GUI.** Configure and monitor Syncthing via a responsive and powerful interface accessible via your browser. - **Web GUI.** Configure and monitor Syncthing via a responsive and powerful interface accessible via your browser.
@@ -18,6 +20,7 @@ Syncthing is still in development, although a large number of features have alre
- **Powerful.** Synchronize as many folders as you need with different people. - **Powerful.** Synchronize as many folders as you need with different people.
#### Native GUIs & Integrations #### Native GUIs & Integrations
- **Windows** tray utility, filesystem watcher & launcher: [SyncTrayzor](https://github.com/canton7/SyncTrayzor/releases/latest) - **Windows** tray utility, filesystem watcher & launcher: [SyncTrayzor](https://github.com/canton7/SyncTrayzor/releases/latest)
- **Cross-platform** GUI wrapper: [Syncthing-GTK](https://github.com/syncthing/syncthing-gtk/releases/latest) - **Cross-platform** GUI wrapper: [Syncthing-GTK](https://github.com/syncthing/syncthing-gtk/releases/latest)
- **Android** app: [Syncthing App](https://f-droid.org/repository/browse/?fdid=com.nutomic.syncthingandroid) - **Android** app: [Syncthing App](https://f-droid.org/repository/browse/?fdid=com.nutomic.syncthingandroid)

View File

@@ -1,34 +1,6 @@
FROM cloudron/base:0.10.0 FROM cloudron/base:1.0.0@sha256:147a648a068a2e746644746bbfb42eb7a50d682437cead3c67c933c546357617
MAINTAINER Syncthing Developers <support@cloudron.io>
EXPOSE 8000 ENV VERSION 0.14.51
RUN apt-get update && apt-get -y install busybox
ENV NGINX_VERSION=1.12.0
ENV NGINX_LDAP_VERSION=b80942160417e95adbadb16adc41aaa19a6a00d9
# Build a custom nginx with ldap support
RUN apt-get remove -y nginx-full && apt-get autoremove -y && apt-get -y install libldap2-dev libpcre3-dev
RUN mkdir -p /tmp/nginx-ldap
WORKDIR /tmp/nginx-ldap
RUN wget "https://github.com/kvspb/nginx-auth-ldap/archive/${NGINX_LDAP_VERSION}.tar.gz" -O - \
| tar -xz -C /tmp/nginx-ldap --strip-components=1
RUN mkdir -p /tmp/nginx
WORKDIR /tmp/nginx
RUN wget "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" -O - \
| tar -xz -C /tmp/nginx --strip-components=1
RUN ./configure \
--add-dynamic-module=/tmp/nginx-ldap \
--modules-path=/usr/local/nginx/modules \
--conf-path=/app/code/nginx.conf \
--pid-path=/run/nginx.pid \
--error-log-path=/run/nginx.error.log \
--build=cloudron-river
RUN make install
ENV VERSION 0.14.36
RUN mkdir -p /app/code \ RUN mkdir -p /app/code \
&& wget https://github.com/syncthing/syncthing/releases/download/v${VERSION}/syncthing-linux-amd64-v${VERSION}.tar.gz -O - \ && wget https://github.com/syncthing/syncthing/releases/download/v${VERSION}/syncthing-linux-amd64-v${VERSION}.tar.gz -O - \
@@ -36,8 +8,11 @@ RUN mkdir -p /app/code \
WORKDIR /app/code WORKDIR /app/code
# add supervisor configs
ADD supervisor/* /etc/supervisor/conf.d/
RUN ln -sf /run/syncthing/supervisord.log /var/log/supervisor/supervisord.log
ADD nginx.conf /app/code/nginx.conf ADD nginx.conf /app/code/nginx.conf
ADD inittab /etc/inittab
ADD start.sh /app/code/start.sh ADD start.sh /app/code/start.sh
CMD [ "/app/code/start.sh" ] CMD [ "/app/code/start.sh" ]

View File

@@ -1,9 +1,8 @@
This application integrates with Cloudron authentication. Use the following credentials for initial setup:
However, all Cloudron users share the same Syncthing session.
Please note that only the username is accepted as login and not the email address.
Syncthing contains an internal user `admin` that is needed by Cloudron but not exposed. `username`: admin
Please do not change the password of that account.
Please create all sync folders as subfolders of `/app/data` as this is the only writable folder. `password`: changeme
**Please change the admin password on first login**

View File

@@ -1,2 +0,0 @@
::respawn:sudo -nu cloudron /app/code/syncthing -gui-address=0.0.0.0:3000 -home=/app/data/config -no-browser >/dev/stdout 2>/dev/stderr
::respawn:/usr/local/nginx/sbin/nginx -c /app/code/nginx.conf

View File

@@ -1,5 +1,4 @@
user cloudron; user cloudron;
load_module "/usr/local/nginx/modules/ngx_http_auth_ldap_module.so";
worker_processes 1; worker_processes 1;
pid /run/nginx.pid; pid /run/nginx.pid;
@@ -8,14 +7,11 @@ daemon off;
# Send logs to stderr # Send logs to stderr
error_log /dev/stderr warn; error_log /dev/stderr warn;
events { events {
worker_connections 768; worker_connections 768;
} }
http { http {
include /run/ldap.conf;
error_log /dev/stderr warn; error_log /dev/stderr warn;
log_format simple '$remote_addr [$time_local] "$request" $status $body_bytes_sent "$http_referer"'; log_format simple '$remote_addr [$time_local] "$request" $status $body_bytes_sent "$http_referer"';
access_log /dev/stdout simple; access_log /dev/stdout simple;
@@ -28,22 +24,18 @@ http {
proxy_buffering off; proxy_buffering off;
proxy_cache_path /tmp/proxy_cache levels=1:2 keys_zone=my_cache:10m max_size=100m inactive=60m use_temp_path=off; proxy_cache_path /tmp/proxy_cache levels=1:2 keys_zone=my_cache:10m max_size=100m inactive=60m use_temp_path=off;
proxy_cache my_cache; proxy_cache my_cache;
auth_ldap_cache_enabled on;
auth_ldap_cache_expiration_time 300000;
auth_ldap_cache_size 100;
server { server {
error_log /dev/stderr warn; error_log /dev/stderr warn;
listen 8000 default_server; listen 8000 default_server;
server_name _; server_name _;
proxy_read_timeout 120s; proxy_read_timeout 120s;
location /check { location /healthcheck {
proxy_pass http://localhost:3000/syncthing/app.js; return 200;
} }
location / { location / {
auth_ldap "Forbidden";
auth_ldap_servers cloudron;
proxy_pass http://localhost:3000; proxy_pass http://localhost:3000;
} }
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

BIN
screenshots/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
screenshots/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

BIN
screenshots/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

View File

@@ -2,32 +2,28 @@
set -eu set -eu
mkdir -p /app/data/config mkdir -p /app/data/config /app/data/folders /run/syncthing
export STNODEFAULTFOLDER=1 STNOUPGRADE=1
# if this if the first run, generate a useful config # if this if the first run, generate a useful config
if [ ! -f /app/data/config/config.xml ]; then if [ ! -f /app/data/config/config.xml ]; then
echo "=> Generating config" echo "=> Generating config"
/app/code/syncthing --generate="/app/data/config" STNODEFAULTFOLDER=1 /app/code/syncthing --generate="/app/data/config"
# The password value was determined by reading config.xml and setting value in the GUI
# urAccepted is 0 for not decided, -1 for no reporting
xmlstarlet ed --inplace \
--subnode "//configuration/gui" -t elem -n user -v "admin" \
--subnode "//configuration/gui" -t elem -n password -v '$2a$10$93OsgwAMD4NcPFTpGDnuTORMMbj5dc1ZlYUPrQCcy1N/Bsy9scUvK' \
--update "//configuration/options/defaultFolderPath" -v '/app/data/folders' \
--update "//configuration/options/urAccepted" -v '-1' \
/app/data/config/config.xml
fi fi
cat >/run/ldap.conf <<EOF
ldap_server cloudron {
url ${LDAP_URL}/${LDAP_USERS_BASE_DN}?username;
binddn ${LDAP_BIND_DN};
binddn_passwd ${LDAP_BIND_PASSWORD};
group_attribute ${LDAP_GROUPS_BASE_DN};
group_attribute_is_dn on;
require valid_user;
}
EOF
# Set the listenAddress and the gui enabled to make sure user doesnt lock themselves out by accident. # Set the listenAddress and the gui enabled to make sure user doesnt lock themselves out by accident.
sed -e 's,<listenAddress>.*</listenAddress>,<listenAddress>tcp://:22000</listenAddress>,' -i /app/data/config/config.xml sed -e "s,<listenAddress>.*</listenAddress>,<listenAddress>tcp://:${SYNC_PORT}</listenAddress>," -i /app/data/config/config.xml
sed -e 's,<gui .*>,<gui enabled="true" tls="false" debugging="false">,' -i /app/data/config/config.xml sed -e 's,<gui .*>,<gui enabled="true" tls="false" debugging="false">,' -i /app/data/config/config.xml
chown -R cloudron:cloudron /app/data/config /app/data chown -R cloudron:cloudron /app/data /run/syncthing
exec busybox init
echo "Starting supervisor"
exec /usr/bin/supervisord --configuration /etc/supervisor/supervisord.conf --nodaemon -i GitLab

12
supervisor/nginx.conf Normal file
View File

@@ -0,0 +1,12 @@
[program:nginx]
priority=100
directory=/tmp
command=/usr/sbin/nginx -c /app/code/nginx.conf
user=root
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

14
supervisor/syncthing.conf Normal file
View File

@@ -0,0 +1,14 @@
[program:syncthing]
priority=20
environment=HOME=/app/data/folders,STNOUPGRADE=1
; -no-browser opens up the browser (for desktop app preumably)
; auditfile "-" means log to stdout
command=/app/code/syncthing -gui-address=127.0.0.1:3000 -home=/app/data/config -no-browser -auditfile=-
user=cloudron
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

View File

@@ -9,14 +9,14 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"chromedriver": "^2.36.0",
"ejs": "^2.4.2", "ejs": "^2.4.2",
"expect.js": "^0.3.1", "expect.js": "^0.3.1",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"mocha": "^2.5.3", "mocha": "^2.5.3",
"rimraf": "^2.5.3", "rimraf": "^2.5.3",
"selenium-server-standalone-jar": "^2.53.1", "selenium-server-standalone-jar": "^2.53.1",
"selenium-webdriver": "^2.53.1", "selenium-webdriver": "^2.53.3",
"superagent": "^1.4.0", "superagent": "^1.4.0"
"chromedriver": "^2.31.0"
} }
} }

View File

@@ -2,8 +2,11 @@
'use strict'; 'use strict';
require('chromedriver');
var execSync = require('child_process').execSync, var execSync = require('child_process').execSync,
expect = require('expect.js'), expect = require('expect.js'),
superagent = require('superagent'),
path = require('path'), path = require('path'),
webdriver = require('selenium-webdriver'); webdriver = require('selenium-webdriver');
@@ -19,17 +22,12 @@ var bucket_prefix = 'bucket',
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
if (!process.env.USERNAME || !process.env.PASSWORD) {
console.log('USERNAME and PASSWORD env vars need to be set');
process.exit(1);
}
describe('Application life cycle test', function () { describe('Application life cycle test', function () {
this.timeout(0); this.timeout(0);
var chrome = require('selenium-webdriver/chrome'); var chrome = require('selenium-webdriver/chrome');
var server, browser = new chrome.Driver(); var server, browser = new chrome.Driver();
var username = process.env.USERNAME, password = process.env.PASSWORD; var username = 'admin', password = 'changeme';
before(function (done) { before(function (done) {
var seleniumJar= require('selenium-server-standalone-jar'); var seleniumJar= require('selenium-server-standalone-jar');
@@ -48,9 +46,14 @@ describe('Application life cycle test', function () {
var LOCATION = 'test'; var LOCATION = 'test';
var TEST_TIMEOUT = 30000; var TEST_TIMEOUT = 30000;
var FOLDER = 'xmf'; // keep this small. long folder names fail in automation, not sure why
var SYNC_PORT = 22001; var SYNC_PORT = 22001;
var app; var app;
function installApp() {
execSync('cloudron install --new --wait --port-bindings SYNC_PORT=' + SYNC_PORT + ' --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
}
function pageLoaded() { function pageLoaded() {
return browser.wait(until.titleMatches(/[0-9a-f]{12} \| Syncthing/), TEST_TIMEOUT); return browser.wait(until.titleMatches(/[0-9a-f]{12} \| Syncthing/), TEST_TIMEOUT);
} }
@@ -61,6 +64,14 @@ describe('Application life cycle test', function () {
}); });
} }
function invalidPassword(callback) {
superagent.get('https://' + app.fqdn).auth(username, password + 'x').end(function (error, result) {
expect(result.status).to.eql(401);
callback();
});
}
function loadPage(callback) { function loadPage(callback) {
browser.manage().deleteAllCookies().then(function () { browser.manage().deleteAllCookies().then(function () {
return browser.get('https://' + username + ':' + encodeURIComponent(password) + '@' + app.fqdn).then(function () { return browser.get('https://' + username + ':' + encodeURIComponent(password) + '@' + app.fqdn).then(function () {
@@ -74,45 +85,54 @@ describe('Application life cycle test', function () {
} }
function addFolder(callback) { function addFolder(callback) {
pageLoaded().then(function() { browser.get('https://' + app.fqdn).then(function () {
return browser.findElement(by.css('[ng-click*=addFolder]')).click(); return browser.findElement(by.css('[ng-click*=addFolder]')).click();
}).then(function () { }).then(function () {
return visible(by.id('folderPath')); return visible(by.id('folderPath'));
}).then(function() {
return browser.findElement(by.id('folderLabel')).sendKeys('test');
}).then(function () { }).then(function () {
return browser.findElement(by.id('folderPath')).sendKeys('/app/data/test'); return browser.sleep(4000); // wait more, not sure why this is needed
}).then(function() { }).then(function() {
//Clear and re-enter the folder to avoid race with auto-completion return browser.findElement(by.id('folderLabel')).sendKeys(FOLDER);
return browser.findElement(by.id('folderPath')).clear(); }).then(function () {
}).then(function() { return browser.sleep(4000); // without this sometimes only part of the folder name gets through
return browser.findElement(by.id('folderPath')).sendKeys('/app/data/test');
}).then(function() { }).then(function() {
return browser.findElement(by.css('[ng-click*=saveFolder]')).click(); return browser.findElement(by.css('[ng-click*=saveFolder]')).click();
}).then(function() { }).then(function() {
return browser.wait(until.elementLocated(by.css('#folders .panel-status span[ng-switch-when=unshared]')), TEST_TIMEOUT); return browser.wait(until.elementLocated(by.css('#folders .panel-status span[ng-switch-when=unshared]')), TEST_TIMEOUT);
}).then(function () {
return browser.sleep(4000);
}).then(function() { }).then(function() {
callback(); callback();
}); });
} }
function checkFolder(callback) {
browser.get('https://' + app.fqdn).then(function () {
return browser.wait(until.elementLocated(by.xpath(`//span[text()="${FOLDER}"]`)), TEST_TIMEOUT);
}).then(function () {
callback();
});
}
function removeFolder(callback) { function removeFolder(callback) {
browser.get('https://' + username + ':' + encodeURIComponent(password) + '@' + app.fqdn).then(function () { browser.get('https://' + app.fqdn).then(function () {
return browser.get('https://' + app.fqdn);
}).then(function () {
return pageLoaded(); return pageLoaded();
}).then(function() { }).then(function() {
return browser.findElement(by.css('#folders button')).click(); return browser.findElement(by.css('#folders button')).click();
}).then(function () { }).then(function () {
return browser.sleep(1000); //No way to check for visibility of angular-js components return browser.sleep(3000); //No way to check for visibility of angular-js components
}).then(function () { }).then(function () {
return browser.findElement(by.css('#folder-0 button[ng-click*=editFolder]')).click(); return browser.findElement(by.css('#folder-0 button[ng-click*=editFolder]')).click();
}).then(function () { }).then(function () {
return browser.sleep(1000); //No way to check for visibility of angular-js components return browser.sleep(3000); //No way to check for visibility of angular-js components
}).then(function () {
return browser.findElement(by.xpath('//button[@data-target="#remove-folder-confirmation"]')).click();
}).then(function () {
return browser.sleep(3000); //No way to check for visibility of angular-js components
}).then(function () { }).then(function () {
return browser.findElement(by.css('[ng-click*=deleteFolder]')).click(); return browser.findElement(by.css('[ng-click*=deleteFolder]')).click();
}).then(function () { }).then(function () {
return browser.sleep(1000); //This needs to run for some time return browser.sleep(3000); //This needs to run for some time
}).then(function () { }).then(function () {
callback(); callback();
}); });
@@ -122,9 +142,7 @@ describe('Application life cycle test', function () {
execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
}); });
it('install app', function () { it('install app', installApp);
execSync('cloudron install --new --wait --port-bindings PORT=' + SYNC_PORT + ' --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
});
it('can get app information', function () { it('can get app information', function () {
var inspect = JSON.parse(execSync('cloudron inspect')); var inspect = JSON.parse(execSync('cloudron inspect'));
@@ -134,9 +152,9 @@ describe('Application life cycle test', function () {
expect(app).to.be.an('object'); expect(app).to.be.an('object');
}); });
it('fails with invalid password', invalidPassword);
it('can load page', loadPage); it('can load page', loadPage);
it('can add folder', addFolder); it('can add folder', addFolder);
it('can remove folder', removeFolder);
it('backup app', function () { it('backup app', function () {
execSync('cloudron backup create --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); execSync('cloudron backup create --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
@@ -147,8 +165,7 @@ describe('Application life cycle test', function () {
}); });
it('can load page', loadPage); it('can load page', loadPage);
it('can add folder', addFolder); it('can check folder', checkFolder);
it('can remove folder', removeFolder);
it('move to different location', function () { it('move to different location', function () {
browser.manage().deleteAllCookies(); browser.manage().deleteAllCookies();
@@ -159,11 +176,27 @@ describe('Application life cycle test', function () {
}); });
it('can load page', loadPage); it('can load page', loadPage);
it('can add folder', addFolder); it('can check folder', checkFolder);
it('can remove folder', removeFolder); it('can remove folder', removeFolder);
it('uninstall app', function () { it('uninstall app', function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
}); });
// test update
it('can install app', function () {
installApp();
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 load page', loadPage);
it('can add folder', addFolder);
it('can update', function () {
execSync('cloudron install --wait --app ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
});
it('can check folder', checkFolder);
it('uninstall app', function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
});
}); });