1
0
Fork 0
config/forgejo
2024-11-16 05:44:26 +01:00
..
README.md Update 2024-02-22 20:28:55 +01:00
restart.sh Update 2024-02-22 20:26:12 +01:00
upgrade.js 🐛 Fix unexpected downgrades 2024-11-16 05:44:26 +01:00

Forgejo auto-upgrade script

Automatically download and run the latest Forgejo release.

Setup

  • Install the following programs :

  • In your Forgejo instance directory :

    • Create the following files :
      • a symbolic link of any name to a Forgejo executable (e.g. ln -s ./forgejo-x.y.z-linux-arch ./forgejo)
      • a restart.sh script (e.g. containing systemctl/screen commands)
    • Download the upgrade.js script
  • Add the script to your crontab (e.g. 0 * * * * bash -c "cd <path> && bun ./upgrade.js" to make it run every hour).

My setup

As I'm managing services with screen, I made a custom restart.sh script that :

  • stops the currently running screen session (if any) ;
  • waits for the Forgejo port to be closed ;
  • starts a new screen session ;
  • waits for the Forgejo port to be open.

You may use it by providing the following parameters in a .env file :

  • SCREEN_NAME : the screen session name
  • SYMLINK_NAME : the name of the symbolic link to the Forgejo executable
  • PORT : the Forgejo HTTP server's listening port.