From 3992a77c78ffb5b676e47d9c791146a2605fc481 Mon Sep 17 00:00:00 2001 From: Nahuel Lofeudo Date: Sat, 18 Jul 2026 10:02:23 +0100 Subject: [PATCH] Updated deployment script and resources --- deploy.sh | 26 ++++++++++++++++++++++++-- resources/dublinbus.service | 1 + resources/dublinbus.yaml | 4 ++-- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/deploy.sh b/deploy.sh index 1635a46..89fb2a8 100755 --- a/deploy.sh +++ b/deploy.sh @@ -23,6 +23,10 @@ BUILD_MACHINE_NAME=raspi-ssd.localnet BUILD_MACHINE_USER=nahuel BUILD_MACHINE_SOURCE_DIRECTORY=/home/nahuel/Documents/sources +DEPLOY_MACHINE_NAME=dublinbus-display.local +DEPLOY_MACHINE_USER=display +DEPLOY_MACHINE_TARGET_DIRECTORY=/opt/dublinbus + # 1. Build locally cargo appimage @@ -42,11 +46,12 @@ echo "-------------------------------------------------------" echo "Local build successful " echo "-------------------------------------------------------" + # 2. Build remotely on the ARM machine ssh $BUILD_MACHINE_USER@$BUILD_MACHINE_NAME << EOF echo Entering ${BUILD_MACHINE_SOURCE_DIRECTORY} cd ${BUILD_MACHINE_SOURCE_DIRECTORY} - if [[ ! -n rs-dublinbus ]]; then + if [[ ! -d rs-dublinbus ]]; then git clone ${GIT_REPO_URL} cd rs-dublinbus else @@ -54,7 +59,6 @@ ssh $BUILD_MACHINE_USER@$BUILD_MACHINE_NAME << EOF git pull fi - cargo clean cargo appimage EOF @@ -67,8 +71,26 @@ if [[ $? -ne 0 ]]; then exit $? fi + echo echo echo "-------------------------------------------------------" echo "Remote build successful " echo "-------------------------------------------------------" + +# 3. SCP the appimage back to the local machine +scp $BUILD_MACHINE_USER@$BUILD_MACHINE_NAME:Documents/sources/rs-dublinbus/target/appimage/rs-dublinbus.AppImage /tmp + +# 4. SCP the files to the Raspberry Pi running the display: +scp /tmp/rs-dublinbus.AppImage $DEPLOY_MACHINE_USER@$DEPLOY_MACHINE_NAME:$DEPLOY_MACHINE_TARGET_DIRECTORY + +# Set up the service +ssh $DEPLOY_MACHINE_USER@$DEPLOY_MACHINE_NAME << EOF + sudo systemctl restart dublinbus +EOF + +echo +echo +echo "-------------------------------------------------------" +echo "Service deployed and restarted " +echo "-------------------------------------------------------" diff --git a/resources/dublinbus.service b/resources/dublinbus.service index 8669131..09c89b8 100644 --- a/resources/dublinbus.service +++ b/resources/dublinbus.service @@ -6,6 +6,7 @@ Wants=multi-user.target [Service] Restart=always Type=exec +WorkingDirectory=/opt/dublinbus ExecStart=/opt/dublinbus/rs-dublinbus.AppImage [Install] diff --git a/resources/dublinbus.yaml b/resources/dublinbus.yaml index 57b030b..b74ea75 100644 --- a/resources/dublinbus.yaml +++ b/resources/dublinbus.yaml @@ -1,7 +1,7 @@ screen: width: 1920 height: 720 - font-path: "resources/jd_lcd_rounded/jd-lcd-rounded.ttf" + font-path: "resources/jd-lcd-rounded.ttf" gtfs: routes: @@ -11,7 +11,7 @@ gtfs: stops: - 1114 - 2410 - data-folder: "/home/nahuel/Downloads" + data-folder: "/tmp" gtfs-url: "https://www.transportforireland.ie/transitData/Data/GTFS_Realtime.zip" realtime-url: "https://api.nationaltransport.ie/gtfsr/v2/gtfsr" realtime-api-key: "aa8509902455412e886b9df11f0e21ec"