This project was born with the idea of creating a simple and fast way to pin new releases of a customisable list of applications on IPFS.
The app is a simple Fastify server that runs a cron job every 5 minutes. The cron job checks if there are new releases of the applications listed in the /src/utils/config.ts
file. If there are new releases, the app will get the Content Identifier (CIDv0 of the release), pin it on IPFS and update the transfrom rule for this application on cloudflare.
- Clone the repository
- Install the dependencies with
npm install
- 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. - Obtain your
PINATA_JWT
Token and set it in the.env
file. Make sure to have thepinByHash
andunpin
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 theZone.Transform Rules
permissions for the API Token.
- Set the correct value for
- Create a Telegram Bot for deployment notifications.
- Set the
TELEGRAM_BOT_TOKEN
in the.env
file. - Create a new group, add your new bot to it, make it the group admin. Find out the chat ID of the group by visiting
https://web.telegram.org/a/
and selecting the group. The chat ID will be in the URL, it ususally starts with-100
for groups that have bot admins. Set theTELEGRAM_CHAT_ID
in the.env
file.
- Set the
- Create a new Cloudflare Transform Rule for each of the apps you want to pin. 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.
- Copy the
src/utils/config.sample.ts
file and rename it tosrc/utils/config.ts
- Add the
appUUID
,transformedURL
,transformedURL
insidecloudflareRuleExpression
,cloudflareZoneId
,cloudflareRulesetId
andcloudflareRuleId
for each of the apps. You can obtain thecloudflareZoneId
by following the instructions in the Cloudflare documentation. ThecloudflareRulesetId
andcloudflareRuleId
can be obtained by following the instructions on this page.
- Add the
- Deploy with a method of your choice, just like any backend application, Dockerfile is included.