Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
c6dc2334a7 | ||
|
cf6ba93f35 | ||
|
36c07ba44f |
@@ -7,3 +7,7 @@
|
|||||||
[0.3.0]
|
[0.3.0]
|
||||||
* Log to stdout
|
* Log to stdout
|
||||||
|
|
||||||
|
[0.4.0]
|
||||||
|
* Switch from postgres to mysql. This will break previous installations, please start afresh
|
||||||
|
* Optional SSO
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
"description": "file://DESCRIPTION.md",
|
"description": "file://DESCRIPTION.md",
|
||||||
"changelog": "file://CHANGELOG",
|
"changelog": "file://CHANGELOG",
|
||||||
"tagline": "Modern GPS Tracking Platform",
|
"tagline": "Modern GPS Tracking Platform",
|
||||||
"version": "0.3.0",
|
"version": "0.4.0",
|
||||||
"upstreamVersion": "5.0",
|
"upstreamVersion": "5.0",
|
||||||
"minBoxVersion": "7.1.0",
|
"minBoxVersion": "7.1.0",
|
||||||
"memoryLimit": 1073741824,
|
"memoryLimit": 1073741824,
|
||||||
@@ -15,8 +15,9 @@
|
|||||||
"ldap": {},
|
"ldap": {},
|
||||||
"sendmail": { "supportsDisplayName": false },
|
"sendmail": { "supportsDisplayName": false },
|
||||||
"localstorage": {},
|
"localstorage": {},
|
||||||
"postgresql": {}
|
"mysql": {}
|
||||||
},
|
},
|
||||||
|
"optionalSso": true,
|
||||||
"manifestVersion": 2,
|
"manifestVersion": 2,
|
||||||
"tcpPorts": {
|
"tcpPorts": {
|
||||||
"OSMAND_PORT": {
|
"OSMAND_PORT": {
|
||||||
|
41
start.sh
41
start.sh
@@ -4,34 +4,47 @@ set -eu -o pipefail
|
|||||||
|
|
||||||
mkdir -p /run/traccar/logs /app/data/media
|
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() {
|
disable_registration() {
|
||||||
|
sleep 10
|
||||||
echo "==> disabling registration"
|
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"
|
echo "=> Ensure traccar.xml config"
|
||||||
if [[ ! -f /app/data/traccar.xml ]]; then
|
if [[ ! -f /app/data/traccar.xml ]]; then
|
||||||
cp /app/pkg/traccar.xml.template /app/data/traccar.xml
|
cp /app/pkg/traccar.xml.template /app/data/traccar.xml
|
||||||
(sleep 10000; disable_registration) &
|
disable_registration &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# database (https://www.traccar.org/mysql/)
|
||||||
xmlstarlet ed --inplace \
|
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.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_POSTGRESQL_USERNAME}" \
|
--update '//properties/entry[@key="database.user"]' -v "${CLOUDRON_MYSQL_USERNAME}" \
|
||||||
--update '//properties/entry[@key="database.password"]' -v "${CLOUDRON_POSTGRESQL_PASSWORD}" \
|
--update '//properties/entry[@key="database.password"]' -v "${CLOUDRON_MYSQL_PASSWORD}" \
|
||||||
/app/data/traccar.xml
|
/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="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 \
|
xmlstarlet ed --inplace \
|
||||||
--update '//properties/entry[@key="mail.smtp.host"]' -v "${CLOUDRON_MAIL_SMTP_SERVER}" \
|
--update '//properties/entry[@key="mail.smtp.host"]' -v "${CLOUDRON_MAIL_SMTP_SERVER}" \
|
||||||
--update '//properties/entry[@key="mail.smtp.port"]' -v "${CLOUDRON_MAIL_SMTP_PORT}" \
|
--update '//properties/entry[@key="mail.smtp.port"]' -v "${CLOUDRON_MAIL_SMTP_PORT}" \
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<properties>
|
<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.driver'>com.mysql.cj.jdbc.Driver</entry>
|
||||||
<entry key='database.url'>jdbc:postgresql://##CLOUDRON_POSTGRESQL_HOST##:##CLOUDRON_POSTGRESQL_PORT##/##CLOUDRON_POSTGRESQL_DATABASE##</entry>
|
<entry key='database.url'>jdbc:mysql://##CLOUDRON_MYSQL_HOST##:##CLOUDRON_MYSQL_PORT##/##CLOUDRON_MYSQL_DATABASE##</entry>
|
||||||
<entry key='database.user'>##CLOUDRON_POSTGRESQL_USERNAME##</entry>
|
<entry key='database.user'>##CLOUDRON_MYSQL_USERNAME##</entry>
|
||||||
<entry key='database.password'>##CLOUDRON_POSTGRESQL_PASSWORD##</entry>
|
<entry key='database.password'>##CLOUDRON_MYSQL_PASSWORD##</entry>
|
||||||
|
|
||||||
<entry key='web.url'>##CLOUDRON_APP_ORIGIN##</entry>
|
<entry key='web.url'>##CLOUDRON_APP_ORIGIN##</entry>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user