CORTX is very useful as a mass storage tool, and when I considered what I personally found to be most valuable about cloud storage, I kept coming back to media: my personal images and videos. Being able to back up these memories and have the peace of mind that I won’t lose them is a huge benefit of cloud storage. So I decided to build a Flask project which allowed me to not only upload these images to CORTX, and replicate them to IPFS, but also access them through a static web page, connected to the database. This means that not only are my images backed up, but they are accessible remotely, meaning I can show them to friends and family on the go.
My project allows images to be uploaded to CORTX and IPFS, and also viewed via a static web page, all powered by a Flask app.
Link to my video - https://youtu.be/iwQ2beyMFtg
- To create a CORTX instance you can follow the steps outlined here
- You can see how to do this in this guide
- Alternatively:
- Start with a fresh install of Ubuntu 22.04
- Update
apt
and install necessary libraries
sudo apt update sudo apt full-upgrade sudo apt install ocl-icd-opencl-dev gcc wget git pkg-config curl hwloc libhwloc-dev clang mesa-opencl-icd
- Install golang
Check golang is installed:wget -c https://go.dev/dl/go1.17.10.linux-amd64.tar.gz rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.10.linux-amd64.tar.gz export PATH=$PATH:/usr/local/go/bin export PATH=$PATH:$(go env GOPATH)/bin export GOPATH=$(go env GOPATH)
go version
- Install IPFS with s3 plugin
git clone https://github.com/ipfs/go-ipfs cd go-ipfs export GO111MODULE=on go get github.com/ipfs/go-ds-s3/[email protected] echo -e "\ns3ds github.com/ipfs/go-ds-s3/plugin 0" >> plugin/loader/preload_list make build go mod tidy make build make install
- Run the IPFS binary
ipfs init
- Update the ~/.ipfs config and datastore_spec files
- vi config
"Datastore": { "StorageMax": "10GB", "StorageGCWatermark": 90, "GCPeriod": "1h", "Spec": { "mounts": [ { "child": { "type": "s3ds", "region": "us-east-1", "bucket": "picture", "rootDirectory": "uploads", "regionEndpoint": "http://uvo15mtkooygylat1ef.vm.cld.sr:31949", "accessKey": "sgiamadmin", "secretKey": "ldapadmin" }, "mountpoint": "/blocks", "prefix": "s3.datastore", "type": "measure" }, { "child": { "compression": "none", "path": "datastore", "type": "levelds" }, "mountpoint": "/", "prefix": "leveldb.datastore", "type": "measure" } ], "type": "mount" }, "HashOnRead": false, "BloomFilterSize": 0 },
- datastore_spec
{"mounts":[{"bucket":"picture","mountpoint":"/blocks","region":"us-east-1","rootDirectory":"uploads"}, {"mountpoint":"/","path":"datastore","type":"levelds"}],"type":"mount"}
- Once ipfs is installed you should be able to start the daemon process
- Run the below command in a new terminal:
cd ~/go-ipfs/cmd/ipfs ./ipfs daemon
- Once your storage servers running you can start your flask app
python3 app.py