3

Storing Pulumi State on IPFS with Filebase

 1 year ago
source link: https://dev.to/fllstck/storing-pulumi-state-on-ipfs-with-filebase-l3n
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Cover image for Storing Pulumi State on IPFS with Filebase

sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg 1

 

Storing Pulumi State on IPFS with Filebase

I played around with my favourite infrastructure tool Pulumi and asked myself if I could use IPFS as storage backend the deployment state of my projects.

Pulumi is open source and allows to self-host your storage backend. Could be interesting to have your state publicly available on IPFS, and since the state doesn't include the deployment credentials it wouldn't leak anything critical.

Filebase is a file hosting provider which offers a Amazon S3 compatible API to store files that are then pinned to IPFS. Since Pulumi comes out-of-the-box with a S3 connector, I gave it a try.

Prerequistes

A Filebase account. It comes with a free tier that doesn't require a credit card.

A Node.js installation.

Setup

First, we create a S3 bucket on Filebase. Hop on the Filebase Console, click on "Create Bucket", name it "deployments", chose IPFS, and hit "Create Bucket".

Next, get the Filebase credentials here. We will need them later.

Then install Pulumi:

$ curl -fsSL https://get.pulumi.com | sh

This might require a restart of the terminal so the pulumi command works.

And finally logging into the Filebase S3 bucket with Pulumi, but replace the keys.

$ export AWS_REGION='us-east-1' && \
  export AWS_ACCESS_KEY_ID='<FILEBASE_KEY>' && \
  export AWS_SECRET_ACCESS_KEY='<FILEBASE_SECRET>' && \
  pulumi login 's3://deployments?endpoint=s3.filebase.com&s3ForcePathStyle=true'

Aaaand we're good to go.

Testing Everything

Let's create a Pulumi project. This will automatically upload a empty state to Filebase.

$ mkdir my-project && cd my-project
$ pulumi new aws-typescript

After this, we can find the state in dev.json in the bucket we created here. This page will also show the "IPFS Gateway URL" with the CID of our file, so we can open it in the browser.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK