Docker Compose

Run Computes with docker-compose

Example Compose

An easy way to get started with computes is to run our docker image. This tutorial will show you how to get the daemon and IPFS up and running in seconds.

version: '3'
services:
  ipfs:
    image: ipfs/go-ipfs:v0.4.15
    ports:
      - "5001:5001"
    volumes:
      - ./data/ipfs:/data/ipfs
  computes-daemon:
    image: computes/daemon:latest
    depends_on:
      - ipfs
    ports:
      - "8189:8189"
    volumes:
      - ./data/computes:/data/computes
      - ./data/ipfs:/data/ipfs
    environment:
      COMPUTES_NAMESPACE: {{SOME_RANDOM_STRING}}
      COMPUTES_LICENSE_KEY: {{YOUR_BETA_KEY}}
      COMPUTES_QUEUE_SEED: {{ANOTHER_RANDOM_STRING}}
      COMPUTES_WHITELIST: {{WHITELIST_IPFS_CID}}

Save the file above to computes/docker-compose.yml. Be sure to replace the namespace, license key, and queue seed with your own unique values. Docker compose uses the folder name as a prefix, so if you choose to use a different folder name, some of the commands below will need to be changed.

Start Computes

This step will start the IPFS and Computes daemons in docker.

cd computes
docker-compose up -d
> Creating network "computes" with the default driver
> Pulling go-ipfs (ipfs/go-ipfs:v0.4.15)...
> Pulling computes-daemon (computes/daemon:latest)...
> ...
> Creating computes_ipfs_1 ... done
> Creating computes_computes-daemon_1 ... done

Check Status

You can ensure the daemons are running by doing two things:

$ docker-compose ps

          Name                        Command               State                               Ports
----------------------------------------------------------------------------------------------------------------------------------
computes_computes-daemon_1   /computes-daemon run             Up      0.0.0.0:8189->8189/tcp
computes_ipfs_1              /sbin/tini -- /usr/local/b ...   Up      4001/tcp, 4002/udp, 0.0.0.0:5001->5001/tcp, 8080/tcp, 8081/tcp
$ docker run --rm --name computes-cli --network computes computes/cli:latest queue dump
> {"__meta__":{"computes":{"seed":"{{THE VALUE YOU PUT IN COMPUTES_QUEUE_SEED}}"}}}

Your computes daemon is up and running! You can use the computes/cli docker image to add tasks and check on their status, etc.