Static publishing with InstanceIO

IPFS deployment

What IPFS changes

InstanceIO turns a dynamic PHP application into a static HTML distribution. IPFS stores that distribution by its content identifier, or CID, so the published files can be retrieved from IPFS peers and gateways without a PHP runtime.

IIO publishes the contents of dist/ as the CID root. A combined build therefore opens at /ipfs/<CID>/index.html, not /ipfs/<CID>/dist/index.html. Every changed build receives a new immutable CID.

The deployment flow

Build Render the routes in sitemap.json into a validated static distribution.
Add Kubo adds the contents of dist/ and returns a CID whose root contains index.html and the generated assets.
Verify IIO checks the local pin, root directory, and index before it starts the local gateway.
Pin Local pinning protects the deployment from local garbage collection. Remote pinning keeps a provider available when your computer is offline.
Retrieve Open the CID through a local, provider, or other active IPFS gateway.

Install and initialize Kubo

Install the Kubo command-line tool for your operating system and make sure the ipfs executable is available on your PATH. IIO does not install Kubo.

From the application root, initialize the local repository and check the installation:

php console/cmd.php Ipfs setup
php console/cmd.php Ipfs status

Use --binary=/path/to/ipfs when Kubo is not on PATH, or --ipfs-path=/path/to/repository for a non-default repository. The setup command initializes the repository but does not start the daemon.

Build, verify, and serve locally

Build and publish the current site, then keep the local daemon attached to the terminal:

php console/cmd.php Ipfs deploy --build --serve

To publish without starting the daemon, then verify or serve an existing CID:

php console/cmd.php Build
php console/cmd.php Ipfs deploy
php console/cmd.php Ipfs check --cid=<CID>
php console/cmd.php Ipfs serve --cid=<CID>

The serve command verifies the local pin, root directory, and index.html before starting Kubo. Wait for Daemon is ready, then open:

http://127.0.0.1:8080/ipfs/<CID>/

Keep the terminal running. Press Ctrl-C to stop the foreground daemon. A node behind double NAT or carrier-grade NAT may have limited inbound reachability; local browsing still works, but remote pinning is recommended for public availability.

Pin with Pinata or another provider

Local pinning does not guarantee that another server can retrieve the CID. Configure a remote pinning service through Kubo. The provider endpoint and token are service-specific. The example below uses Pinata's IPFS Pinning Service API endpoint.

Create a Pinata API key with pinning permissions, copy its JWT, and keep it in an environment variable:

read -s PINATA_JWT
export PINATA_JWT

Register the service with IIO:

php console/cmd.php Ipfs remote setup \
  --service=pinata \
  --endpoint=https://api.pinata.cloud/psa \
  --token-env=PINATA_JWT

Pin an existing CID and check the provider status:

php console/cmd.php Ipfs remote pin \
  --service=pinata \
  --cid=<CID>

php console/cmd.php Ipfs remote status \
  --service=pinata \
  --cid=<CID>

Wait for the remote status to become pinned. Do not put the JWT in config.json, source code, or a committed shell script. IIO receives the token through the environment and Kubo stores the configured service credentials in the local IPFS repository.

Pin every deployment automatically

After configuring the remote service, submit each new deployment after IIO has verified the local CID:

php console/cmd.php Ipfs deploy \
  --build \
  --remote \
  --remote-service=pinata

Use --remote-background to queue the provider request without waiting for the remote service to finish:

php console/cmd.php Ipfs deploy \
  --build \
  --remote \
  --remote-service=pinata \
  --remote-background

You can enable automatic remote pinning in config.json without storing the token:

{
    "ipfs": {
        "remote": {
            "service": "pinata",
            "endpoint": "https://api.pinata.cloud/psa",
            "token_env": "PINATA_JWT",
            "name": "iio-website",
            "background": false,
            "deploy": true
        }
    }
}

Configure the deployment

The local defaults use the native Kubo executable, the default repository, and the local gateway:

{
    "ipfs": {
        "binary": "ipfs",
        "path": "~/.ipfs",
        "gateway": "http://127.0.0.1:8080/ipfs",
        "cid_version": 1,
        "pin": true
    }
}

CLI options override configuration. Useful options include --output=dist, --gateway=https://gateway.example/ipfs, --cid-version=1, --pin=false, --no-pin, --cid=<CID>, and --index=site/index.html.

Open and update a deployment

Use a provider gateway or another active gateway after the remote status becomes pinned:

https://<gateway-host>/ipfs/<CID>/

The old https://ipfs.io/ipfs/ gateway is retired. A gateway URL is only an HTTP access path; the CID is the immutable identifier. When you change the site, build and pin the new CID. The previous CID remains available only while at least one provider continues to pin and serve it.

For resilient hosting, keep a local pin and use one or more remote pinning providers. Pinning the same CID with multiple providers increases redundancy without changing the CID.

Before you deploy

IPFS serves static output only. Add every public route to sitemap.json, confirm that assets use deployable URLs, and run php console/cmd.php Build successfully before publishing. PHP controllers, server-only API calls, and other runtime behavior will not execute from a static IPFS gateway.

Read the IPFS section in the framework docs for the short command reference, or return to the full documentation for the complete application workflow.

Build once. Publish by CID.

Use the framework documentation for the application workflow, then follow the IPFS guide when you are ready to publish a static build.