- Download Node.JS LTS
- Open a terminal and cd into your desired directory
- Download a zip archive of the code or clone it using:
git clone https://github.com/GttMone/git-autoupdate .
- To install dependencies, run the following command in the same directory:
npm i
- Navigate to config.json
- All fields are required unless otherwise stated. You can leave optional fields an empty string ""
- Modify to your liking, here are the options explained:
{
"ignoredResources": ["my-resource"], // Put resources you'd like to be ignored.
"directoryPath": "/root/FXServer/txData/QboxProject_...base/resources/[qbx]", // Put the parent directory of all the resources that shall be auto updated.
"remoteOrgUrl": "https://github.com/Qbox-project", // Organization URL on GitHub, that all resource repos will be linked to. NOTE: DO NOT LEAVE A "/" AT THE END!
"updateOnStart": true, // Whether all resources should be updated on program start/restart. (Recommended)
"schedule": {
"cronExpression": "0 * * * *", // How often the program should check for updates in the format of a CRON expression. (Default: every whole hour)
"timezone": "" // Used for timestamps, use the following format: https://www.iana.org/time-zones
},
"logging": {
"enabled": true, // Whether logging is enabled. If set to false, everything below is ignored.
"out": { // Out/normal logs
"file": "./out.log", // Can be relative or absolute path
"webhook": { // Send logs to a Discord webhook
"enabled": false,
"url": "", // Put the Discord webhook here https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
"content": "" // Content, outside of the embed. You can make it ping a user/role using: <@ROLE-OR-USER-ID> or @everyone (optional)
}
},
"error": { // Error logs
"file": "./error.log", // Can be relative or absolute path
"webhook": { // Send logs to a Discord webhook
"enabled": true,
"url": "https://discord.com/api/webhooks/...", // Put the Discord webhook here https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
"content": "<@1010110011001010010>" // Content, outside of the embed. You can make it ping a user/role using: <@ROLE-OR-USER-ID> or @everyone (optional)
}
}
},
"pushEndpoint": "http://localhost:3000/push" // When all resources are updated, sends a POST request to this endpoint with no body. (optional)
}
WARNING: This script will remove all resources in the configured path and replace them with a fresh cloned version from GitHub.
- Run:
npm run init--confirm
npm start
And if you'd like to keep the program running in the background and automatically restart, I suggest you download PM2 - Process Manager For Node.JS
pm2 start dist/server.js --name git-autoupdate