Skip to content

Commit

Permalink
refactor: deploy subcommands (#111)
Browse files Browse the repository at this point in the history
Ref #35 #73 

Refactors the `bonsol deploy` command, adding better help messages and
clearer usage.

```
$ bonsol deploy --help
Deploy a program with various storage options, such as S3, ShadowDrive, or manually with a URL

Usage: bonsol deploy <COMMAND>

Commands:
  s3            Deploy a program using an AWS S3 bucket
  shadow-drive  Deploy a program using ShadowDrive
  url           Deploy a program manually with a URL
  help          Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help

--

$ bonsol deploy s3 --help
Deploy a program using an AWS S3 bucket

Usage: bonsol deploy s3 [OPTIONS] --bucket <BUCKET> --access-key <ACCESS_KEY> --secret-key <SECRET_KEY> --region <REGION> --manifest-path <MANIFEST_PATH>

Options:
      --bucket <BUCKET>                Specify the S3 bucket name
      --access-key <ACCESS_KEY>        Specify the AWS access key ID [env: AWS_ACCESS_KEY_ID=]
      --secret-key <SECRET_KEY>        Specify the AWS secret access key [env: AWS_SECRET_ACCESS_KEY=]
      --region <REGION>                Specify the AWS region [env: AWS_REGION=]
      --endpoint <ENDPOINT>            Specify the AWS S3 compatibility endpoint [env: AWS_S3_ENDPOINT=]
  -m, --manifest-path <MANIFEST_PATH>  The path to the program's manifest file (manifest.json)
  -y, --auto-confirm                   Whether to automatically confirm deployment
  -h, --help                           Print help
```
  • Loading branch information
eureka-cpu authored Dec 18, 2024
1 parent 5b3873b commit 6a4cfef
Show file tree
Hide file tree
Showing 13 changed files with 134 additions and 297 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ on:
pull_request:
branches:
- '**'

concurrency:
group: "integration-tests"
cancel-in-progress: true

permissions: read-all

jobs:
integration-tests:
name: Setup Toolchain and Test
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/update-cachix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#
# substituter: https://bonsol.cachix.org
# public-key: bonsol.cachix.org-1:yz7vi1rCPW1BpqoszdJvf08HZxQ/5gPTPxft4NnT74A=

name: Update Cachix
on:
push:
Expand All @@ -22,22 +21,18 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
extra-substituters = https://bonsol.cachix.org
extra-trusted-public-keys = bonsol.cachix.org-1:yz7vi1rCPW1BpqoszdJvf08HZxQ/5gPTPxft4NnT74A=
- name: Install and configure Cachix
uses: cachix/cachix-action@v15
with:
name: bonsol
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Run nix flake check
run: nix flake check

- name: Enter development shell
run: nix develop
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Changed
* `bonsol` cli option requirements and error messages updated for added clarity
* **Breaking**: `bonsol deploy` cli subcommand requirements updated. Please refer to the docs, or use `bonsol deploy --help` for more info.

### Added
* `bonsol estimate` for estimating execution cost of bonsol programs.
Expand Down
2 changes: 1 addition & 1 deletion charts/templates/deployment-tester.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ spec:
- -c
- |
solana config set --keypair {{ .Values.signer.path }} -u $RPC_ENDPOINT
bonsol deploy -y -m {{ include "bonsol-tester.manifestPath" . }} -t url --url $SIMPLE_IMAGE
bonsol deploy url -y -m {{ include "bonsol-tester.manifestPath" . }} --url $SIMPLE_IMAGE
while :
do
date '+%Y/%m/%d %H:%M:%S'
Expand Down
4 changes: 2 additions & 2 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ The output of the build command is a manifest.json file which is placed in the r
You can deploy a bonsol program with the following command

```
bonsol -k ./keypair.json -u http://localhost:8899 deploy -m {path to manifest.json} -y {auto confirm} -t {s3|shadow-drive|url} ... {upload type specific options}
bonsol -k ./keypair.json -u http://localhost:8899 deploy {s3|shadow-drive|url} -m {path to manifest.json} -y {auto confirm} ... {upload type specific options}
```
There will be many options for how to upload the program, the default is s3. Here is an example of how to deploy a program to s3
```
bonsol -k ./keypair.json -u http://localhost:8899 deploy -m program/manifest.json -t s3 --bucket bonsol-public-images --region us-east-1 --access-key {your key} --secret-key {your secret key}
bonsol -k ./keypair.json -u http://localhost:8899 deploy s3 -m program/manifest.json --bucket bonsol-public-images --region us-east-1 --access-key {your key} --secret-key {your secret key}
```
In the above example the manifest.json file is the file that was created by the build command.
This will try to upload the binary to the s3 bucket and create a deployment account for the program. Programs are indexed by the image id, which is a kind of checksum of the program elf file. This means that if you change the elf file, the image id will change and the program will be deployed again under a new deployment account. Programs are immutable and can only be changed by redeploying the program. When a node downloads a program it will check the image id and if it doesnt match the deployment account it will reject the program. Furthermore when bonsol checks the proof, it will check the image id and if it doesnt match the deployment account and desired image id from execution request it will reject the proof.
Expand Down
Loading

0 comments on commit 6a4cfef

Please sign in to comment.