Portfolio is a distribution implementation focused on safe concurrent object storage management via transactional metadata and relatively simple abstractions between HTTP API and storage backends.
- rust
- docker compose
- Digitalocean account
- You will need a (preferably) fresh Spaces bucket and access/secret key
- Bring up the docker compose dev env:
docker compose up -d
- Initialized the cockroachdb cluster:
docker exec -it portfolio-region1-1 ./cockroach init --insecure
- Take note of the postgres connection string in the output of
docker compose logs
. These should look something like the following (note that you will have to replace the network identifier withlocalhost
later):
postgresql://root@71990c668326:26257/defaultdb?sslmode=disable
- Retrieve your secret & access keys for Spaces.
- Create a file called
dev-config.yml
that should look something like:
metadata:
type: Postgres
connection_string: postgresql://root@localhost:26257/defaultdb?sslmode=disable
objects:
type: S3
secret_key: <spaces-secret-key>
access_key: <spaces-access-key>
hostname: <bucket-region>.digitaloceanspaces.com
bucket_name: <bucket-name>
- Run DB migrations:
export DATABASE_URL=postgresql://root@localhost:26257/defaultdb?sslmode=disable
cargo install sqlx-cli
sqlx migrate run --source db/postgres/migrations
Because we use the sqlx::query!
macro, which provides compile-time Postgres
query correctness guarantees, you will need to set a connection string variable
when compiling locally or if your text editor uses
rust-analyzer (which it should!), otherwise
you will see DB connection errors at compile time. For example, if running
cargo build
to verify your changes build then you would need the following in
your shell:
export DATABASE_URL=postgresql://root@localhost:26257/defaultdb?sslmode=disable