CAR server
It is an HTTP server that converts arbitrary content into a CARv2 file and serves it over HTTP - supporting the latest CARv2 format, which is not yet entirely supported by other crates in the Rust ecosystem. The next steps describe how to run the server locally and use it to upload and download files.
Start the server
- Create a Docker volume to store uploaded files:
docker volume create storage_provider
- Start the server:
docker run \
-p 127.0.0.1:9000:9000 \
--mount source=storage_provider,destination=/app/uploads \
polkadotstorage.azurecr.io/polka-storage-provider:0.1.0 storage \
--listen-addr 0.0.0.0:9000
-p 127.0.0.1:9000:9000
: Maps port9000
on the localhost to port9000
on the container.--mount source=storage_provider,destination=/app/uploads
: Mounts thestorage_provider
volume to/app/uploads
inside the container.polkadotstorage.azurecr.io/polka-storage-provider:0.1.0 storage
: Runs thepolkadotstorage.azurecr.io/polka-storage-provider:0.1.0
image with thestorage
command.--listen-addr 0.0.0.0:9000
: Configures the server to listen on all available network interfaces.
Verifying the Setup
After setting up and starting the CAR server, it's essential to verify that everything works correctly. Follow these steps to ensure your setup works as expected:
-
Upload a test file using the instructions in the Upload a file section. Make sure to note the CID returned by the server.
-
Download the CAR file using the retrieved CID, following the steps in the Download the CAR File section.
-
[Optional] Verify the contents of the downloaded CAR file. Using, for example, go-car's
inspect
command:car inspect <target_file>
The user can use
debug
for more detailed output:car debug <target_file>
If the user desires, they can extract the contents of the file:
car extract <target_file>
If a file can be successfully uploaded, the server produces a CID, allows download the corresponding CAR file, and verify its contents, the CAR server setup is working correctly.