Running locally with 'devstack'
You can run a stand-alone Bacalhau and IPFS network on your computer with the following guide.
The devstack
command of bacalhau
will start a 3 node cluster alongside isolated ipfs servers.
This is useful to kick the tires and/or developing on the codebase. It's also the tool used by some tests.
Pre-requisites
x86_64 or ARM64 architecture
Ubuntu 20.0+ has most often been used for development and testing
Go >= 1.21
(Optional) Docker Engine
(Optional) A build of the latest Bacalhau release
(Optional) Building Bacalhau from source
Start the cluster
This will start a 3 node Bacalhau cluster connected with libp2p.
Each node has its own IPFS server isolated using the IPFS_PATH
environment variable and its own API RPC server isolated using a random port. These IPFS nodes are not connected to the public IPFS network. If you wish to connect the devstack to the public IPFS network, you can include --public-ipfs
flag.
You can also use your own IPFS node and connect it to the devstack by running (after starting the devstack):
If you would like to make it a bit more predictable and/or ignore errors (such as during CI), you can add the following before your execution:
Once everything has started up - you will see output like the following:
The message above contains the environment variables you need for a new window. You can paste these into a new terminal so that bacalhau will use your local devstack.
Alternatively, to remove the need to copy and paste, you can set DEVSTACK_ENV_FILE
environment variable to the name of a .env file that devstack will write to, and bacalhau commands will read from, before launching the devstack e.g.:
When the devstack is shut down, the local env file (if configured) will be removed. It is suggested you use .devstack.env
to avoid clashing with longer lived .env
files.
New Terminal Window
Open an additional terminal window to be used for submitting jobs.
Copy and paste environment variables from previous message into this window. EG:
You are now ready to submit a job to your local devstack.
Submit a simple job
This will submit a simple job to a single node:
This should output something like the following:
After a short while - the job should be in complete
state.
Download the results to the current directory:
You should now have the following files and directories:
stdout
stderr
volumes/output
If you cat stdout
it should read "hello devstack test". If you write any files in your job, they will appear in volumes/output.