I have cleaned up my drone plugin that pins a folder to the ipfs network. Under the hood, it uses ipfs-deploy
to manage pinning and updating dns records.
This is set up as a real plugin for drone, meaning that it uses the appropriate pipeline syntax instead of running commands in the docker container.
For example, I use this stanza to deploy this website:
- name: push to ipfs
image: pacbard/drone-ipfs-deploy
settings:
path: public/
pinner: pinata
environment:
IPFS_DEPLOY_PINATA__API_KEY:
from_secret: pinata_api_key
IPFS_DEPLOY_PINATA__SECRET_API_KEY:
from_secret: pinata_secret_api_key
The settings
include source
for the source directory, pinning_service
for the pinning service, and dns_service
for the dns service. ipfs-deploy
also requires environment variables to be set with further options for pinning or dns services. I set them using the environment
section and save those to secrets.
You can get this plugin on Docker Hub or GitHub.
I also have a step that updates the DNSlink
record on duckdns to point to the latest pin, allowing for access to this website through ipns. It is a very simple curl command:
- name: update duckdns TXT record
image: curlimages/curl
environment:
DUCKDNS_TOKEN:
from_secret: duckdns_token
DUCKDNS_DOMAIN:
from_secret: duckdns_domain
commands:
- curl https://www.duckdns.org/update\?domains\=$DUCKDNS_DOMAIN\&token\=$DUCKDNS_TOKEN\&txt\=dnslink\=/ipfs/$(cat .hash)
Note that this step requires a .hash
file to work. That file is saved in the previous step by drone-ipfs-deploy
. This is a workaround because drone does not have output variables that are shared between steps in the pipeline (unlike GitHub Actions).
July 2021 Update: The docker container now is also available for linux-arm64.