This commit is contained in:
Frail7487Real 2024-11-03 10:36:38 +07:00
parent b6bc292475
commit 3fd220be4b
No known key found for this signature in database
3 changed files with 5 additions and 35 deletions

View file

@ -1,4 +1,4 @@
name: Runs Global name: Run
on: on:
workflow_dispatch: workflow_dispatch:
@ -91,10 +91,10 @@ jobs:
- name: Run the long-lived process - name: Run the long-lived process
working-directory: /mnt/globalData working-directory: /mnt/globalData
run: | run: |
wget https://raw.githubusercontent.com/Resample3118Belike/didactic-octo-pancake/refs/heads/master/checkTime.js wget https://raw.githubusercontent.com/Frail7487Real/laughing-spork/refs/heads/master/checkTime.js
wget https://raw.githubusercontent.com/Resample3118Belike/didactic-octo-pancake/refs/heads/master/loop.sh wget https://raw.githubusercontent.com/Frail7487Real/laughing-spork/refs/heads/master/loop.sh
chmod +x loop.sh chmod +x loop.sh
# what an argument mess # what an argument mess
bash loop.sh ${{ inputs.runNext }} $GH_TOKEN didactic-octo-pancake runglobal.yml master ${{ inputs.name }} $WEBHOOK_URL true ${{ inputs.oldTailscaleHostname }} bash loop.sh ${{ inputs.runNext }} $GH_TOKEN laughing-spork runglobal.yml master ${{ inputs.name }} $WEBHOOK_URL true ${{ inputs.oldTailscaleHostname }}

View file

@ -1,30 +0,0 @@
# Global
This repository makes a free server. It is originally made out of [Docker-VNC](https://github.com/Efebey2903/Docker-VNC), but I got too addicted into this and turned it into another project with a lot more improvements.
# How It Works
#### (totally not [ChatGPT](https://chatgpt.com) generated (with some modifications), [original prompt](https://chatgpt.com/share/6711fc01-0178-8009-8ac8-2be6917b54f6))
During the first runtime, a data directory named `globalData` is created in `/mnt/`, which is [Azure's temporary storage partition](https://learn.microsoft.com/en-us/azure/virtual-machines/managed-disks-overview#temporary-disk). This partition is used for storing the swap file by default, but also offers a lot of space for storing large files. You can store the stuff that you don't want to keep throughout the runtimes inside that folder.
There's also another folder called `toBackup` inside `globalData`. Files in this folder will persist across the runtimes. You can also create these 2 scripts inside the directory and it will run at the following time periods:
- `postinstall.sh` - runs after the runtime finishes setting things up.
- `postruntime.sh` - executes 30 minutes before the runtime stops (which has a maximum limit of 6 hours).
You can configure tasks that you want to start or stop at each runtime.
For the `toBackup` data bridge, the script first archives the folder into the file `archive.tar.gz` (inside `globalData`). Then I used [serve](https://github.com/vercel/serve), which runs on the old runtime's port 5000, then on the new runtime, I used [aria2](https://github.com/aria2/aria2) to download the archive in parallel and finally extract the archive.
And with all of this, I also have Discord Webhook integration so you get notified on new runtimes, and [Tailscale](https://tailscale.com/) set up so you can actually access the runtime.
# Why not just use actions' [`on.schedule.cron`](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#onschedule)?
[The time is not accurate](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule:~:text=The%20schedule%20event%20can%20be%20delayed%20during%20periods%20of%20high%20loads%20of%20GitHub%20Actions%20workflow%20runs.%20High%20load%20times%20include%20the%20start%20of%20every%20hour.), which may lead to a downtime gap between each runtime.
# Secrets that are NEEDED to set
- `WEBHOOK_URL` - discord webhook url
- `TAILSCALE_KEY` - tailscale auth key

View file

@ -76,7 +76,7 @@ check() {
command+="--method POST " command+="--method POST "
command+='-H "Accept: application/vnd.github+json" ' command+='-H "Accept: application/vnd.github+json" '
command+='-H "X-GitHub-Api-Version: 2022-11-28" ' command+='-H "X-GitHub-Api-Version: 2022-11-28" '
command+="\"/repos/Resample3118Belike/$REPO/actions/workflows/$WORKFLOW_FILE/dispatches\" " command+="\"/repos/Frail7487Real/$REPO/actions/workflows/$WORKFLOW_FILE/dispatches\" "
command+="-f \"ref=$BRANCH\" -f \"inputs[runNext]=true\" " command+="-f \"ref=$BRANCH\" -f \"inputs[runNext]=true\" "
if [[ "$IS_GLOBAL" == "true" ]]; then if [[ "$IS_GLOBAL" == "true" ]]; then