deislabs / bindle

Bindle: Object Storage for Collections
Apache License 2.0
263 stars 37 forks source link

Dockerize bindle #343

Closed FrankYang0529 closed 1 year ago

FrankYang0529 commented 2 years ago

ref: https://github.com/fermyon/installer/pull/100

~It looks like Using Bindle example can't work on the current master branch, so I use v0.8.0 for testing.~ https://github.com/deislabs/bindle/pull/343#issuecomment-1250080411

Start Bindle

  1. Clone this branch.
  2. Run git reset HEAD~1 to keep Dockerfile.
  3. Run git checkout v0.8.0 to check out to v0.8.0.
  4. Run docker build -t bindle ..
  5. Run BINDLE_TEMP=$(mktemp -d).
  6. Run docker run --name bindle -d --restart=unless-stopped -e RUST_LOG=debug -v $BINDLE_TEMP:/bindle-data -p 8080:8080 bindle.

Start consul & nomad

  1. Run consul agent --dev
  2. Run nomad agent --dev

Start Hippo

  1. Clone the latest Hippo.
  2. Run following commands.
    export Database__Driver=sqlite
    export ConnectionStrings__Database="Data Source=hippo.db;Cache=Shared"
    export ConnectionStrings__Bindle="Address=http://127.0.0.1:8080/v1"
    export Nomad__Driver="raw_exec"
    export Jwt__Key="ceci n'est pas une jeton"
    export Jwt__Issuer="localhost"
    export Jwt__Audience="localhost"
    dotnet build
    dotnet run
  3. Create a Hippo account with username admin and password p@ssword.

Run Spin

  1. Clone the latest Spin.
  2. Run make build.
  3. Run following commands.
    export BINDLE_URL="http://localhost:8080/v1/"
    export HIPPO_USERNAME="admin"
    export HIPPO_PASSWORD="p@ssword"
    export HIPPO_URL="http://localhost:5309"
  4. Run spin new http-rust myapp.
  5. In myapp folder, run spin build.
  6. Run spin deploy.
ghost commented 2 years ago

CLA assistant check
All CLA requirements met.

FrankYang0529 commented 2 years ago

Hi @vdice, I add Dockerfile for dockerize bindle. May you review it when you have time? Thank you.

vdice commented 2 years ago

It looks like Using Bindle example can't work on the current master branch, so I use v0.8.0 for testing.

I think we may want to ensure that the docs example can run successfully with this image at HEAD as well. Or at least by the next tagged release -- so we'll want to create issue(s) around the current failing behavior so that they can be fixed.

FrankYang0529 commented 1 year ago

I think we may want to ensure that the docs example can run successfully with this image at HEAD as well. Or at least by the next tagged release -- so we'll want to create issue(s) around the current failing behavior so that they can be fixed.

https://github.com/deislabs/bindle/issues/344

FrankYang0529 commented 1 year ago

Test for Using Bindle example with master branch:

Build and setup bindle-server

# build
make build
docker build -t bindle .

# Setup
BINDLE_TEMP=$(mktemp -d)
echo $BINDLE_TEMP
export BINDLE_KEYRING=$BINDLE_TEMP/keyring.toml
./target/debug/bindle keys create "VishnuJin<me@example.com>" -f $BINDLE_TEMP/secret_keys.toml

# Start bindle-server
docker run --name bindle -d --restart=unless-stopped -e RUST_LOG=debug -v $BINDLE_TEMP:/bindle-data -p 8080:8080 bindle
docker logs bindle -f

Sign and push invoice

# setup
export BINDLE_TEMP=<path from bindle-server terminal>
export BINDLE_KEYRING=$BINDLE_TEMP/keyring.toml

# create invoice.toml file
cat <<EOF > invoice.toml
bindleVersion = "1.0.0"
[bindle]
name = "mybindle"
version = "0.1.0"
authors = ["vdice"]
description = "My first bindle"
[annotations]
myname = "myvalue"
EOF

# sign invoice
./target/debug/bindle sign-invoice invoice.toml -o signed-invoice.toml -l "VishnuJin<me@example.com>" -f $BINDLE_TEMP/secret_keys.toml

# push invoice 
./target/debug/bindle push-invoice signed-invoice.toml

# see invoice
./target/debug/bindle keys fetch
./target/debug/bindle info mybindle/0.1.0
FrankYang0529 commented 1 year ago

Hi @vdice, it looks like we can't use the latest bindle with Spin. Bindle rejects un-signed invoices after this change https://github.com/deislabs/bindle/pull/300/. I will focus on https://github.com/fermyon/spin/issues/689 to fix this issue first.

thomastaylor312 commented 1 year ago

Hi @vdice, it looks like we can't use the latest bindle with Spin. Bindle rejects un-signed invoices after this change https://github.com/deislabs/bindle/pull/300. I will focus on https://github.com/fermyon/spin/issues/689 to fix this issue first

@FrankYang0529 Yeah that is why the 0.9.0 release is still in an RC. We were giving everyone time to update to the required signing.

thomastaylor312 commented 1 year ago

@vdice leaving final approval up to you. If you'd like to see a make target and some docs in this PR, I am good with that

FrankYang0529 commented 1 year ago

Hi @vdice, I updated docs/README.md. May you help me review it again? Thank you.