Important
This project is no longer maintained and the repository is archived.
The code is here and unchanged, but nobody is keeping it current with Kubo or
the Google Cloud SDK; go.mod still targets Go 1.20. Expect to do some work
before it builds against a recent Kubo.
One thing to know before you try: the ipfs init --profile gcsds step below
depends on ipfs/kubo#9889, which was
closed without being merged, so that profile does not exist in upstream Kubo.
The repository can be unarchived, but only for a named maintainer who commits to keeping it up. If that is you, reach out to the IPFS Foundation.
An implementation of the go-datastore interface backed by Google Cloud Storage, GCS. The implementation is based on go-ds-s3
Build this plugin as an included plugin with kubo.
Clone kubo.
git clone https://github.com/ipfs/kuboGet the GCS datastore plugin and add it to the preload list.
(cd kubo; go get github.com/ipfs-shipyard/go-ds-gcs/plugin)
echo "gcsds github.com/ipfs-shipyard/go-ds-gcs/plugin 0" >> kubo/plugin/loader/preload_listBuild kubo with the plugin
(cd kubo; make build)(Optionally) install kubo onto the local system.
(cd kubo; make install)Follow the "Building binary" section first. Clone the GCS datastore plugin and build the Docker entrypoint.
git clone https://github.com/ipfs-shipyard/go-ds-gcs
(cd go-ds-gcs; go build docker/entrypoint.go)Build docker and container.
docker build -f go-ds-gcs/docker/Dockerfile -t ipfs .(Optional) tag and push image to repository. Replace repository with your GCR repository.
docker tag ipfs gcr.io/repository/ipfs
docker push gcr.io/repository/ipfsipfs is the image name from the previous section, "Building docker container"
docker run -d -p 4001:4001 -p 5001:5001 -p 8080:8080 --name=ipfs ipfsOr you can use the tagged image from the previous section.
docker run -d -p 4001:4001 -p 5001:5001 -p 8080:8080 --name=ipfs gcr.io/repository/ipfs- Create a GKE cluster. The node pool must have write permission to the GCS bucket.
- Replace repository with your repository name in kubernetes/ipfs.yml
- Replace mynamespace with your namespace name in kubernetes/ipfs.yml
- Create namespace in GKE.
kubectl create namespace mynamespace- Deploy to GKE.
kubectl apply -f kubernetes/ipfs.yml- IPFS can now be accessed at ipfs.mynamespace from other pods in the GKE cluster:
curl http://ipfs.mynamespace:8080/...For a brand new ipfs instance (no data stored yet):
- Install kubo/cmd/ipfs/ipfs
- Initialize IPFS. Replace mybucket with your bucket name. Note that this depends on this Pull Request.
KUBO_GCS_BUCKET=mybucket ipfs init --profile gcsds- To run as a server, also run
ipfs config profile apply server
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
ipfs daemonThe config file should include the following. Replace mybucket with your bucket name.
{
"Datastore": {
"Spec": {
"mounts": [{
"child": {
"bucket": "mybucket",
"cachesize": 40000,
"prefix": "ipfs",
"type": "gcsds",
"workers": 100
},
"mountpoint": "/blocks",
"prefix": "flatfs.datastore",
"type": "measure"
}]
}
}
}Google Cloud credentials should automatically be provided when running in Google Compute Engine (GCE) or Google Kubernetes Engine (GKE). Note that for both GCE and GKE, the (node) VM needs to have write permission (scope) to GCS. For GKE, this is achieved by creating the node pool with the "Storage read/write" scope, which is "devstorage.read_write".
In other environments, you may have to provide credentials. One way is to use the GOOGLE_APPLICATION_CREDENTIALS environment variable. See this document for more details.
This repository is archived and is not accepting contributions. Drive-by patches will not reopen it. Unarchiving requires someone willing to be named as maintainer and to keep the plugin working against current Kubo. If that is you, contact the IPFS Foundation. Forking is fine too.
This repository falls under the IPFS Code of Conduct and the Google Code of Conduct
Apache 2.0