Update traccar.xml #114
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'jcardus/traccar' | |
ref: 'master' | |
- uses: actions/checkout@v4 | |
with: | |
path: configuration | |
- name: update templates | |
run: | | |
rm -rf configuration/.git | |
cp -vr configuration/templates/* templates | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
cache: gradle | |
- run: ./gradlew build --no-daemon | |
- name: Build installers | |
working-directory: ./setup | |
run: | | |
sudo apt-get install makeself | |
wget -q https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2+13/OpenJDK21U-jdk_x64_linux_hotspot_21.0.2_13.tar.gz | |
mkdir -p out/{conf,data,lib,logs,web,schema,templates} | |
cp ../target/tracker-server.jar out | |
cp ../target/lib/* out/lib | |
cp ../schema/* out/schema | |
cp -r ../templates/* out/templates | |
cp traccar.xml out/conf | |
cp setup.sh out | |
cp traccar.service out | |
tar -xf OpenJDK21U-jdk_x64_linux_hotspot_21.0.2_13.tar.gz | |
jlink --module-path jdk-*/jmods --add-modules java.se,jdk.charsets,jdk.crypto.ec,jdk.unsupported --output out/jre | |
rm -rf jdk-* | |
makeself --needroot --quiet --notemp out traccar.run "traccar" ./setup.sh | |
mkdir deploy | |
mv traccar.run deploy | |
mv traccar.xml deploy | |
- run: | | |
sed -i "s/\${SMTP_PASSWORD}/${{secrets.SMTP_PASSWORD}}/g" configuration/traccar.xml | |
sed -i "s/\${SMTP_USER_NAME}/${{secrets.SMTP_USER_NAME}}/g" configuration/traccar.xml | |
sed -i "s/\${MAIL_SMTP_FROM}/${{secrets.MAIL_SMTP_FROM}}/g" configuration/traccar.xml | |
sed -i "s/\${DATABASE_HOST}/${{secrets.DATABASE_HOST}}/g" configuration/traccar.xml | |
sed -i "s/\${DATABASE_PASSWORD}/${{secrets.DATABASE_PASSWORD}}/g" configuration/traccar.xml | |
sed -i "s/\${DATABASE_USER}/${{secrets.DATABASE_USER}}/g" configuration/traccar.xml | |
sed -i "s/\${SMS_HTTP_AUTHORIZATION}/${{secrets.SMS_HTTP_AUTHORIZATION}}/g" configuration/traccar.xml | |
sed -i "s/\${GEOCODER_KEY}/${{secrets.GEOCODER_KEY}}/g" configuration/traccar.xml | |
sed -i "s/\${GEOLOCATION_KEY}/${{secrets.GEOLOCATION_KEY}}/g" configuration/traccar.xml | |
sed -i "/\${NOTIFICATOR_FIREBASE_SERVICE_ACCOUNT}/r /dev/stdin" configuration/traccar.xml <<'EOF' | |
<entry key='notificator.firebase.serviceAccount'>${{ secrets.NOTIFICATOR_FIREBASE_SERVICE_ACCOUNT }}</entry> | |
EOF | |
sed -i "/\${NOTIFICATOR_FIREBASE_SERVICE_ACCOUNT}/d" configuration/traccar.xml | |
cp -rv configuration/* setup/deploy | |
cat configuration/traccar.xml | |
- name: ssh deploy | |
uses: easingthemes/ssh-deploy@main | |
with: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
ARGS: "-rlgoDzvc -i" | |
SOURCE: "setup/deploy" | |
REMOTE_HOST: ${{ secrets.REMOTE_HOST }} | |
REMOTE_USER: ${{ secrets.REMOTE_USER }} | |
TARGET: ${{ secrets.REMOTE_TARGET }} | |
SCRIPT_AFTER: | | |
sudo /home/${{ secrets.REMOTE_USER }}/deploy/traccar.run | |
sudo cp -v /home/${{ secrets.REMOTE_USER }}/deploy/traccar.xml /opt/traccar/conf/ | |
sudo service traccar start | |
echo $RSYNC_STDOUT |