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.
Step 2: Install the dependencies with npm install1
Step 3: Copy the .env.sample file and rename it to .env
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.
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.
ℹ️ Info: #### Ignore this step if you already have transform rules setup for the IPFS apps.
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.
Step 6: Copy the 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.
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
Step 7: Please modify the appUUID, transformedURL, transformedURL inside cloudflareRuleExpression, cloudflareZoneId, cloudflareRulesetId and cloudflareRuleId as mentioned above and depending on your config.
Example for src/utils/config.ts
Step 8: Deploy with a method of your choice, just like any backend application, Dockerfile is included.