🤖IPFS Automation
Last updated
Last updated
This guide has instructions to set up workflow which will run automatically to pin the latest hashes and create/update the transform rules set in Cloudflare whenever new version releases will be published across all apps.
Note: This tool is open-sourced by Kitkat Validator.
Set the correct value for `MONGO_URI`. You can use any MongoDB instance, including one inside a self-hosted container. If you don't have a MongoDB instance, you can use the free tier of [MongoDB Atlas] as shown in the image below. Copy the URI marked by the arrow:
Obtain your PINATA_JWT Token and set it in the .env file. Make sure to have the pinByHash and unpin permission enabled.
Obtain your GITHUB_AUTH_TOKEN and set it in the .env file. No permissions are required if only fetching releases from public repositories.
Obtain your CLOUDFLARE_API_TOKEN and set it in the .env file. Make sure to have the Zone.Transform Rules permissions for the API Token as shown in the image below.
Account -> Account Rulesets -> Read
Zone -> Transform Rules -> Read
Zone -> Transform Rules -> Edit
Set the TELEGRAM_BOT_TOKEN in the .env
file
Ensure to assign Group Admin Rights and Channel Admin Rights to the created bot using BotFather
Create a new group, add your new bot to it, make it the group admin. Find out the chat ID of the group by checking https://web.telegram.org/a/ and selecting the group. The chat ID will be in the URL, it usually starts with -100 for groups that have bot admins. Set the TELEGRAM_CHAT_ID in the .env file.
The rules can have any values for now as our application will fix them for us. We just need to do this for the Rule ID to be available in the next step.
src/utils/config.sample.ts
file and rename it to src/utils/config.ts
Add the appUUID, transformedURL, transformedURL inside cloudflareRuleExpression, cloudflareZoneId, cloudflareRulesetId and cloudflareRuleId for each of the apps. You can obtain the cloudflareZoneId by following the instructions in the Cloudflare documentation. The cloudflareRulesetId and cloudflareRuleId can be obtained by following the instructions on this page.
Get your rulesetId querying the below URL and search for the object with phase: http_request_transform and copy that rulesetId. This becomes your cloudflareRulesetId.
curl https://api.cloudflare.com/client/v4/zones/{zone_id}/rulesets \ --header "Authorization: Bearer <API_TOKEN>"
Now use this cloudflareRulesetId to query the below URL and get the respective cloudflareRuleId for individual transform rules and update it in src/utils/config.ts
curlhttps://api.cloudflare.com/client/v4/zones/{zone_id}/rulesets
/{ruleset_id} \ --header "Authorization: Bearer <API_TOKEN>"