Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9ec91c5a44 | ||
|
4eeea53abc | ||
|
3603182a84 | ||
|
00f42d92c5 | ||
|
ee8db31cc6 | ||
|
c9ece7726e | ||
|
6a8c01ccdf | ||
|
dd60363721 | ||
|
2d1a59d7ca |
15
CHANGELOG
15
CHANGELOG
@@ -11,3 +11,18 @@
|
||||
* Switch from postgres to mysql. This will break previous installations, please start afresh
|
||||
* Optional SSO
|
||||
|
||||
[0.4.1]
|
||||
* Update traccar to 5.1
|
||||
* [Full changelog](https://github.com/traccar/traccar/releases/tag/v5.1)
|
||||
|
||||
[0.5.0]
|
||||
* Update traccar to 5.2
|
||||
* [Full changelog](https://github.com/traccar/traccar/releases/tag/v5.2)
|
||||
|
||||
[0.6.0]
|
||||
* Update traccar to 5.3
|
||||
* [Full changelog](https://github.com/traccar/traccar/releases/tag/v5.3)
|
||||
|
||||
[1.0.0]
|
||||
* First stable release
|
||||
* Add support for gl200 protocol port 5004
|
||||
|
@@ -5,12 +5,20 @@
|
||||
"description": "file://DESCRIPTION.md",
|
||||
"changelog": "file://CHANGELOG",
|
||||
"tagline": "Modern GPS Tracking Platform",
|
||||
"version": "0.4.0",
|
||||
"upstreamVersion": "5.0",
|
||||
"version": "1.0.0",
|
||||
"upstreamVersion": "5.3",
|
||||
"minBoxVersion": "7.1.0",
|
||||
"memoryLimit": 1073741824,
|
||||
"healthCheckPath": "/",
|
||||
"httpPort": 8082,
|
||||
"httpPorts": {
|
||||
"OSMAND_DOMAIN": {
|
||||
"title": "OsmAnd Domain",
|
||||
"description": "Port over which OsmAnd clients can connect",
|
||||
"containerPort": 5055,
|
||||
"defaultValue": "osmand"
|
||||
}
|
||||
},
|
||||
"addons": {
|
||||
"ldap": {},
|
||||
"sendmail": { "supportsDisplayName": false },
|
||||
@@ -24,6 +32,11 @@
|
||||
"title": "OsmAnd Port",
|
||||
"description": "Port over which OsmAnd clients can connect",
|
||||
"defaultValue": 5055
|
||||
},
|
||||
"GL200_PORT": {
|
||||
"title": "GL200 Protocol Port",
|
||||
"description": "Port over which GL200 clients can connect",
|
||||
"defaultValue": 5004
|
||||
}
|
||||
},
|
||||
"website": "https://www.traccar.org",
|
||||
|
@@ -3,7 +3,7 @@ FROM cloudron/base:3.2.0@sha256:ba1d566164a67c266782545ea9809dc611c4152e27686fd1
|
||||
RUN mkdir -p /app/code
|
||||
WORKDIR /app/code
|
||||
|
||||
ARG VERSION=5.0
|
||||
ARG VERSION=5.3
|
||||
|
||||
RUN wget https://github.com/traccar/traccar/releases/download/v${VERSION}/traccar-linux-64-${VERSION}.zip -O traccar.zip && \
|
||||
unzip traccar.zip && \
|
||||
|
@@ -34,3 +34,12 @@ npm install
|
||||
USERNAME=<cloudron username> PASSWORD=<cloudron password> mocha --bail test.js
|
||||
```
|
||||
|
||||
|
||||
## Devices
|
||||
|
||||
https://www.traccar.org/devices/
|
||||
|
||||
Traccar client | osmand | port 5055 (http)
|
||||
Tracker for Traccar | t55 | port 5005 | sends odb2 data
|
||||
Owntracks | owntracks | port 5144 | https://owntracks.org/booklet/features/traccar/
|
||||
|
||||
|
5
start.sh
5
start.sh
@@ -19,6 +19,7 @@ if [[ ! -f /app/data/traccar.xml ]]; then
|
||||
disable_registration &
|
||||
fi
|
||||
|
||||
echo "=> Ensure database settings"
|
||||
# database (https://www.traccar.org/mysql/)
|
||||
xmlstarlet ed --inplace \
|
||||
--update '//properties/entry[@key="database.url"]' -v "jdbc:mysql://${CLOUDRON_MYSQL_HOST}:${CLOUDRON_MYSQL_PORT}/${CLOUDRON_MYSQL_DATABASE}?serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''" \
|
||||
@@ -31,12 +32,13 @@ xmlstarlet ed --inplace --update '//properties/entry[@key="web.url"]' -v "${CLOU
|
||||
|
||||
# ldap
|
||||
if [[ -n "${CLOUDRON_LDAP_URL:-}" ]]; then
|
||||
echo "=> Ensure LDAP settings"
|
||||
xmlstarlet ed --inplace \
|
||||
--update '//properties/entry[@key="ldap.enable"]' -v "true" \
|
||||
--update '//properties/entry[@key="ldap.url"]' -v "${CLOUDRON_LDAP_URL}" \
|
||||
--update '//properties/entry[@key="ldap.base"]' -v "${CLOUDRON_LDAP_USERS_BASE_DN}" \
|
||||
--update '//properties/entry[@key="ldap.idAttribute"]' -v "username" \
|
||||
--update '//properties/entry[@key="ldap.searchFilter"]' -v 'username=:login' \
|
||||
--update '//properties/entry[@key="ldap.searchFilter"]' -v '(|(username=:login)(mail=:login))' \
|
||||
--update '//properties/entry[@key="ldap.user"]' -v "${CLOUDRON_LDAP_BIND_DN}" \
|
||||
--update '//properties/entry[@key="ldap.password"]' -v "${CLOUDRON_LDAP_BIND_PASSWORD}" \
|
||||
/app/data/traccar.xml
|
||||
@@ -45,6 +47,7 @@ else
|
||||
fi
|
||||
|
||||
# email
|
||||
echo "=> Ensure mail settings"
|
||||
xmlstarlet ed --inplace \
|
||||
--update '//properties/entry[@key="mail.smtp.host"]' -v "${CLOUDRON_MAIL_SMTP_SERVER}" \
|
||||
--update '//properties/entry[@key="mail.smtp.port"]' -v "${CLOUDRON_MAIL_SMTP_PORT}" \
|
||||
|
2793
test/package-lock.json
generated
Normal file
2793
test/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
19
test/package.json
Normal file
19
test/package.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "test.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"expect.js": "^0.3.1",
|
||||
"mocha": "^10.0.0",
|
||||
"selenium-webdriver": "^4.3.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"chromedriver": "^103.0.0"
|
||||
}
|
||||
}
|
166
test/test.js
Normal file
166
test/test.js
Normal file
@@ -0,0 +1,166 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/* jshint esversion: 8 */
|
||||
/* global describe */
|
||||
/* global before */
|
||||
/* global after */
|
||||
/* global it */
|
||||
|
||||
'use strict';
|
||||
|
||||
require('chromedriver');
|
||||
|
||||
var 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.EMAIL || !process.env.PASSWORD) {
|
||||
console.log('EMAIL and PASSWORD env vars need to be set');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
describe('Application life cycle test', function () {
|
||||
this.timeout(0);
|
||||
|
||||
const LOCATION = 'test';
|
||||
const TEST_TIMEOUT = 10000;
|
||||
const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
|
||||
const ADMIN_USERNAME = 'admin'; // the login form is called email but accepts usernames
|
||||
const ADMIN_PASSWORD = 'admin';
|
||||
const DEVICE_NAME = 'FancyDevice';
|
||||
const DEVICE_IDENTIFIER = 'device1';
|
||||
|
||||
var browser, app;
|
||||
|
||||
before(function () {
|
||||
const options = new Options().windowSize({ width: 1280, height: 1024 });
|
||||
if (process.env.HEADLESS) options.addArguments('headless');
|
||||
|
||||
browser = new Builder().forBrowser('chrome').setChromeOptions(options).build();
|
||||
});
|
||||
|
||||
after(function () {
|
||||
browser.quit();
|
||||
});
|
||||
|
||||
async function waitForElement(elem) {
|
||||
await browser.wait(until.elementLocated(elem), TEST_TIMEOUT);
|
||||
await browser.wait(until.elementIsVisible(browser.findElement(elem)), TEST_TIMEOUT);
|
||||
}
|
||||
|
||||
function getAppInfo() {
|
||||
var inspect = JSON.parse(execSync('cloudron inspect'));
|
||||
app = inspect.apps.filter(function (a) { return a.location.indexOf(LOCATION) === 0; })[0];
|
||||
expect(app).to.be.an('object');
|
||||
}
|
||||
|
||||
async function login(emailOrUsername, password) {
|
||||
await browser.get(`https://${app.fqdn}/login`);
|
||||
await waitForElement(By.xpath('//input[@name="email"]'));
|
||||
await browser.findElement(By.xpath('//input[@name="email"]')).sendKeys(Key.CONTROL + 'a');
|
||||
await browser.findElement(By.xpath('//input[@name="email"]')).sendKeys(emailOrUsername);
|
||||
await browser.findElement(By.xpath('//input[@name="password"]')).sendKeys(password);
|
||||
await browser.findElement(By.xpath('//button[text()="Login"]')).click();
|
||||
await waitForElement(By.xpath('//span[text()="Account"]'));
|
||||
}
|
||||
|
||||
async function logout() {
|
||||
await browser.get(`https://${app.fqdn}`);
|
||||
await waitForElement(By.xpath('//span[text()="Account"]'));
|
||||
await browser.findElement(By.xpath('//span[text()="Account"]')).click();
|
||||
await browser.sleep(1000);
|
||||
await waitForElement(By.xpath('//p[text()="Logout"]'));
|
||||
await browser.findElement(By.xpath('//p[text()="Logout"]')).click();
|
||||
await waitForElement(By.xpath('//input[@name="email"]'));
|
||||
}
|
||||
|
||||
async function addDevice() {
|
||||
await browser.get(`https://${app.fqdn}/settings/device`);
|
||||
await waitForElement(By.id(':r3:'));
|
||||
await browser.findElement(By.id(':r3:')).sendKeys(DEVICE_NAME);
|
||||
await browser.findElement(By.id(':r4:')).sendKeys(DEVICE_IDENTIFIER);
|
||||
await browser.findElement(By.xpath('//button[text()="Save"]')).click();
|
||||
await waitForElement(By.xpath(`//span[text()="${DEVICE_NAME}"]`));
|
||||
}
|
||||
|
||||
async function deviceExists() {
|
||||
await browser.get(`https://${app.fqdn}`);
|
||||
await waitForElement(By.xpath(`//span[text()="${DEVICE_NAME}"]`));
|
||||
}
|
||||
|
||||
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 login as admin', login.bind(null, ADMIN_USERNAME, ADMIN_PASSWORD));
|
||||
it('can add device', addDevice);
|
||||
it('device exists', deviceExists);
|
||||
it('can logout', logout);
|
||||
|
||||
it('can login as normal user with email', login.bind(null, process.env.EMAIL, process.env.PASSWORD));
|
||||
it('can logout', logout);
|
||||
|
||||
it('can login as normal user with username', login.bind(null, process.env.USERNAME, process.env.PASSWORD));
|
||||
it('can logout', logout);
|
||||
|
||||
it('can restart app', function () { execSync(`cloudron restart --app ${app.id}`); });
|
||||
|
||||
it('can login', login.bind(null, ADMIN_USERNAME, ADMIN_PASSWORD));
|
||||
it('device exists', deviceExists);
|
||||
it('can logout', logout);
|
||||
|
||||
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 --app ${app.id}`));
|
||||
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 login', login.bind(null, ADMIN_USERNAME, ADMIN_PASSWORD));
|
||||
it('device exists', deviceExists);
|
||||
it('can logout', logout);
|
||||
|
||||
it('move to different location', async function () {
|
||||
// ensure we don't hit NXDOMAIN in the mean time
|
||||
await browser.get('about:blank');
|
||||
execSync(`cloudron configure --location ${LOCATION}2 --app ${app.id}`, EXEC_ARGS);
|
||||
});
|
||||
|
||||
it('can get app information', getAppInfo);
|
||||
it('can login', login.bind(null, ADMIN_USERNAME, ADMIN_PASSWORD));
|
||||
it('device exists', deviceExists);
|
||||
it('can logout', logout);
|
||||
|
||||
it('uninstall app', async function () {
|
||||
// ensure we don't hit NXDOMAIN in the mean time
|
||||
await browser.get('about:blank');
|
||||
execSync(`cloudron uninstall --app ${app.id}`, EXEC_ARGS);
|
||||
});
|
||||
|
||||
// test update
|
||||
it('can install app', function () { execSync(`cloudron install --appstore-id org.traccar.cloudronapp --location ${LOCATION}`, EXEC_ARGS); });
|
||||
it('can get app information', getAppInfo);
|
||||
it('can login', login.bind(null, ADMIN_USERNAME, ADMIN_PASSWORD));
|
||||
it('can add device', addDevice);
|
||||
it('device exists', deviceExists);
|
||||
it('can logout', logout);
|
||||
|
||||
it('can update', function () { execSync(`cloudron update --app ${app.id}`, EXEC_ARGS); });
|
||||
|
||||
it('can login', login.bind(null, ADMIN_USERNAME, ADMIN_PASSWORD));
|
||||
it('device exists', deviceExists);
|
||||
it('can logout', logout);
|
||||
|
||||
it('can login as normal user with username', login.bind(null, process.env.USERNAME, process.env.PASSWORD));
|
||||
it('can logout', logout);
|
||||
|
||||
it('uninstall app', async function () {
|
||||
// ensure we don't hit NXDOMAIN in the mean time
|
||||
await browser.get('about:blank');
|
||||
execSync(`cloudron uninstall --app ${app.id}`, EXEC_ARGS);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user