Piper Sync is the versatile bash script designed to effortlessly manage web applications, keeping a vigilant eye on a designated Git repository for any updates. Seamlessly, it ensures your local repository stays synchronized, automatically integrating the latest features onto your server.
Piper Sync simplifies the synchronization between your local and remote repositories, ensuring smooth operation of your web application on your server. Its features include testing new project versions before deployment, efficiently cloning, building, and executing your web application from your chosen Git repository branch. Piper Sync gracefully halts the application upon detecting updates, clones the latest version from the repository, executes necessary build processes, and seamlessly restarts the application, keeping your server up-to-date with the latest changes.
-
Clones the project from a GitHub repository.
-
Checks if the project is up to date.
-
Tests the new project version for stability.
-
Handles unstable project versions by reverting to the last stable version.
-
git clone https://github.com/GabrielFlores8227/Piper-Sync
-
-
*
PROJECT_URL
: The URL of the GitHub repository. -
*
PROJECT_BRANCH
: The branch of the GitHub repository. -
*
PROJECT_PATH
: The local path where the project will be cloned (include the project folder name). -
*
PROJECT_STARTUP_TIME
: Average project startup time (in seconds). -
BUILD_PROJECT_COMMAND
: Command to build the project (the command will run underPROJECT_PATH
). -
START_PROJECT_COMMAND
: Command to start the project (the command will run underPROJECT_PATH
). -
STOP_PROJECT_COMMAND
: Command to stop the project (the command will run underPROJECT_PATH
).
-
-
bash start.sh
Piper-Sync monitors the specified branch for updates every 5 minutes. Upon detecting changes, it clones the new repository version to the
/tmp
folder for stability testing. If the new branch version proves stable, Piper-Sync applies the changes to the project specified in the
config.env
file.
For a seamless experience, configure a daemon to automatically start Piper Sync when your machine boots. Below are the configurations to set up
the daemon (don't forget to enable the daemon by running: systemctl enable
):
-
Create a file named piper-sync.service in /etc/systemd/system/ with the following content:
[Unit] Description=Pyper-Sync Service After=network.target [Service] Type=simple ExecStartPre=/bin/sleep 15 ExecStart=/bin/bash /path/to/start.sh [Install] WantedBy=multi-user.target
Then, enable the daemon:
sudo systemctl enable piper-sync.service
This will ensure that Piper Sync starts automatically when your machine boots.
This script is licensed under the GNU General Public License, Version 3, 29 June 2007.
Feel free to use, modify, and distribute this script as per the terms of the license.