Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
dd60363721 | ||
|
2d1a59d7ca | ||
|
c6dc2334a7 | ||
|
cf6ba93f35 | ||
|
36c07ba44f |
@@ -7,3 +7,11 @@
|
||||
[0.3.0]
|
||||
* Log to stdout
|
||||
|
||||
[0.4.0]
|
||||
* 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)
|
||||
|
||||
|
@@ -5,18 +5,27 @@
|
||||
"description": "file://DESCRIPTION.md",
|
||||
"changelog": "file://CHANGELOG",
|
||||
"tagline": "Modern GPS Tracking Platform",
|
||||
"version": "0.3.0",
|
||||
"upstreamVersion": "5.0",
|
||||
"version": "0.4.1",
|
||||
"upstreamVersion": "5.1",
|
||||
"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 },
|
||||
"localstorage": {},
|
||||
"postgresql": {}
|
||||
"mysql": {}
|
||||
},
|
||||
"optionalSso": true,
|
||||
"manifestVersion": 2,
|
||||
"tcpPorts": {
|
||||
"OSMAND_PORT": {
|
||||
|
@@ -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.1
|
||||
|
||||
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/
|
||||
|
||||
|
41
start.sh
41
start.sh
@@ -4,34 +4,47 @@ set -eu -o pipefail
|
||||
|
||||
mkdir -p /run/traccar/logs /app/data/media
|
||||
|
||||
echo -e "[client]\npassword=${CLOUDRON_MYSQL_PASSWORD}" > /run/traccar/mysql-extra
|
||||
readonly mysql="mysql --defaults-file=/run/traccar/mysql-extra --user=${CLOUDRON_MYSQL_USERNAME} --host=${CLOUDRON_MYSQL_HOST} -P ${CLOUDRON_MYSQL_PORT} ${CLOUDRON_MYSQL_DATABASE}"
|
||||
|
||||
disable_registration() {
|
||||
sleep 10
|
||||
echo "==> disabling registration"
|
||||
PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE} -c "UPDATE tc_servers SET registration=false WHERE id=1"
|
||||
$mysql -e "UPDATE tc_servers SET registration=0 WHERE id=1"
|
||||
}
|
||||
|
||||
echo "=> Ensure traccar.xml config"
|
||||
if [[ ! -f /app/data/traccar.xml ]]; then
|
||||
cp /app/pkg/traccar.xml.template /app/data/traccar.xml
|
||||
(sleep 10000; disable_registration) &
|
||||
disable_registration &
|
||||
fi
|
||||
|
||||
# database (https://www.traccar.org/mysql/)
|
||||
xmlstarlet ed --inplace \
|
||||
--update '//properties/entry[@key="database.url"]' -v "jdbc:postgresql://${CLOUDRON_POSTGRESQL_HOST}:${CLOUDRON_POSTGRESQL_PORT}/${CLOUDRON_POSTGRESQL_DATABASE}" \
|
||||
--update '//properties/entry[@key="database.user"]' -v "${CLOUDRON_POSTGRESQL_USERNAME}" \
|
||||
--update '//properties/entry[@key="database.password"]' -v "${CLOUDRON_POSTGRESQL_PASSWORD}" \
|
||||
--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=''" \
|
||||
--update '//properties/entry[@key="database.user"]' -v "${CLOUDRON_MYSQL_USERNAME}" \
|
||||
--update '//properties/entry[@key="database.password"]' -v "${CLOUDRON_MYSQL_PASSWORD}" \
|
||||
/app/data/traccar.xml
|
||||
|
||||
# origin
|
||||
xmlstarlet ed --inplace --update '//properties/entry[@key="web.url"]' -v "${CLOUDRON_APP_ORIGIN}" /app/data/traccar.xml
|
||||
|
||||
xmlstarlet ed --inplace \
|
||||
--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.user"]' -v "${CLOUDRON_LDAP_BIND_DN}" \
|
||||
--update '//properties/entry[@key="ldap.password"]' -v "${CLOUDRON_LDAP_BIND_PASSWORD}" \
|
||||
/app/data/traccar.xml
|
||||
|
||||
# ldap
|
||||
if [[ -n "${CLOUDRON_LDAP_URL:-}" ]]; then
|
||||
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.user"]' -v "${CLOUDRON_LDAP_BIND_DN}" \
|
||||
--update '//properties/entry[@key="ldap.password"]' -v "${CLOUDRON_LDAP_BIND_PASSWORD}" \
|
||||
/app/data/traccar.xml
|
||||
else
|
||||
xmlstarlet ed --inplace --update '//properties/entry[@key="ldap.enable"]' -v "false" /app/data/traccar.xml
|
||||
fi
|
||||
|
||||
# email
|
||||
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}" \
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
<properties>
|
||||
|
||||
<entry key='config.default'>./conf/default.xml</entry>
|
||||
<entry key='config.default'>/app/code/conf/default.xml</entry>
|
||||
|
||||
<!--
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
|
||||
-->
|
||||
|
||||
<entry key='database.driver'>org.postgresql.Driver</entry>
|
||||
<entry key='database.url'>jdbc:postgresql://##CLOUDRON_POSTGRESQL_HOST##:##CLOUDRON_POSTGRESQL_PORT##/##CLOUDRON_POSTGRESQL_DATABASE##</entry>
|
||||
<entry key='database.user'>##CLOUDRON_POSTGRESQL_USERNAME##</entry>
|
||||
<entry key='database.password'>##CLOUDRON_POSTGRESQL_PASSWORD##</entry>
|
||||
<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
|
||||
<entry key='database.url'>jdbc:mysql://##CLOUDRON_MYSQL_HOST##:##CLOUDRON_MYSQL_PORT##/##CLOUDRON_MYSQL_DATABASE##</entry>
|
||||
<entry key='database.user'>##CLOUDRON_MYSQL_USERNAME##</entry>
|
||||
<entry key='database.password'>##CLOUDRON_MYSQL_PASSWORD##</entry>
|
||||
|
||||
<entry key='web.url'>##CLOUDRON_APP_ORIGIN##</entry>
|
||||
|
||||
|
Reference in New Issue
Block a user