Add first part of the remote build/deploy script
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
# The deployment process works like this:
|
||||
# 1. Build locally just to make sure that things work
|
||||
# 2. SSH into the machine that will build the AppImage for ARM. There:
|
||||
# 2.1. run git pull to get the latest version of the code
|
||||
# 2.2. run argo appimage to build the image
|
||||
# 3. SCP the appimage back to the local machine
|
||||
# 4. SCP the files to the Raspberry Pi running the display:
|
||||
# AppImage
|
||||
# systemd service file
|
||||
# 5. SSH into the display machine as root and:
|
||||
# 5.1. Copy the AppImage file to /opt/dublinbus-display (create the directory if necessary)
|
||||
# 5.2. If the service exists, restart it and exit
|
||||
# 5.3. Copy the service file to /etc/systemd/system
|
||||
# 5.4. Enable and activate the service
|
||||
|
||||
|
||||
|
||||
# Variables
|
||||
GIT_REPO_URL="http://git.nahuellofeudo.com/nahuel/rs-dublinbus.git"
|
||||
|
||||
# For the build machine
|
||||
BUILD_MACHINE_NAME=raspi-ssd.localnet
|
||||
BUILD_MACHINE_USER=nahuel
|
||||
BUILD_MACHINE_SOURCE_DIRECTORY=/home/nahuel/Documents/sources
|
||||
|
||||
|
||||
# 1. Build locally
|
||||
cargo appimage
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo
|
||||
echo
|
||||
echo "-------------------------------------------------------"
|
||||
echo "\"cargo appimage\" failed. Check the logs"
|
||||
echo "-------------------------------------------------------"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
echo
|
||||
echo
|
||||
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
|
||||
git clone ${GIT_REPO_URL}
|
||||
cd rs-dublinbus
|
||||
else
|
||||
cd rs-dublinbus
|
||||
git pull
|
||||
fi
|
||||
|
||||
cargo clean
|
||||
cargo appimage
|
||||
EOF
|
||||
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo
|
||||
echo
|
||||
echo "-------------------------------------------------------"
|
||||
echo "Remote build failed. Check the logs"
|
||||
echo "-------------------------------------------------------"
|
||||
exit $?
|
||||
fi
|
||||
|
||||
echo
|
||||
echo
|
||||
echo "-------------------------------------------------------"
|
||||
echo "Remote build successful "
|
||||
echo "-------------------------------------------------------"
|
||||
Reference in New Issue
Block a user