|
| 1 | +[](https://goreportcard.com/report/github.com/appscode/osm) |
| 2 | + |
| 3 | +# osm |
| 4 | +Object Store Manipulator (osm: pronounced like `awesome`) - `curl` for cloud storage services. 🙌 `osm` can create & delete buckets and upload, download & delete files from buckets for AWS S3, Google Cloud Storage, Microsoft Azure storage and OpenStack Swift. Its single binary can be easily packaged instead of official python based clis inside Docker images. |
| 5 | + |
| 6 | +## Install OSM |
| 7 | +You can download and install a pre-built binary: |
| 8 | +```console |
| 9 | +# Linux amd 64-bit: |
| 10 | +wget -O osm https://cdn.appscode.com/binaries/osm/0.5.1/osm-linux-amd64 \ |
| 11 | + && chmod +x osm \ |
| 12 | + && sudo mv osm /usr/local/bin/ |
| 13 | + |
| 14 | +# Linux 386 32-bit: |
| 15 | +wget -O osm https://cdn.appscode.com/binaries/osm/0.5.1/osm-linux-386 \ |
| 16 | + && chmod +x osm \ |
| 17 | + && sudo mv osm /usr/local/bin/ |
| 18 | + |
| 19 | +# Mac 64-bit |
| 20 | +wget -O osm https://cdn.appscode.com/binaries/osm/0.5.1/osm-darwin-amd64 \ |
| 21 | + && chmod +x osm \ |
| 22 | + && sudo mv osm /usr/local/bin/ |
| 23 | + |
| 24 | +# Mac 32-bit |
| 25 | +wget -O osm https://cdn.appscode.com/binaries/osm/0.5.1/osm-darwin-386 \ |
| 26 | + && chmod +x osm \ |
| 27 | + && sudo mv osm /usr/local/bin/ |
| 28 | +``` |
| 29 | + |
| 30 | +To build from source, run: `go get -u github.com/appscode/osm` |
| 31 | + |
| 32 | +## Usage |
| 33 | +```console |
| 34 | +osm [command] [flags] |
| 35 | +osm [command] |
| 36 | + |
| 37 | +Available Commands: |
| 38 | + config OSM configuration |
| 39 | + help Help about any command |
| 40 | + ls List container |
| 41 | + mc Make container |
| 42 | + pull Pull item from container |
| 43 | + push Push item from container |
| 44 | + rc Remove container |
| 45 | + rm Remove item from container |
| 46 | + stat Stat item from container |
| 47 | + version Prints binary version number. |
| 48 | + |
| 49 | +Flags: |
| 50 | + --alsologtostderr log to standard error as well as files |
| 51 | + --log_backtrace_at traceLocation when logging hits line file:N, emit a stack trace (default :0) |
| 52 | + --log_dir string If non-empty, write log files in this directory |
| 53 | + --logtostderr log to standard error instead of files |
| 54 | + --stderrthreshold severity logs at or above this threshold go to stderr (default 2) |
| 55 | + -v, --v Level log level for V logs |
| 56 | + --vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging |
| 57 | + |
| 58 | +Use "osm [command] --help" for more information about a command. |
| 59 | + |
| 60 | +``` |
| 61 | + |
| 62 | +### OSM Configuration |
| 63 | +`osm` stores credentials necessary to connect to a cloud storage provider in YAML format in `$HOME/.osm/config` file. |
| 64 | +This allows providing commands one time for multiple subsequent operations with a cloud provider. |
| 65 | +```console |
| 66 | +# AWS S3: |
| 67 | +osm config set-context osm-s3 --provider=s3 --s3.access_key_id=<key_id> --s3.secret_key=<secret_key> --s3.region=us-east-1 |
| 68 | + |
| 69 | +# Google Cloud Storage: |
| 70 | +osm config set-context osm-gs --provider=google --google.json_key_path=<path_sa_file> --google.project_id=<my_project> |
| 71 | + |
| 72 | +# Microsoft Azure ARM Storage: |
| 73 | +osm config set-context osm-az --provider=azure --azure.account=<storage_ac> --azure.key=<key> |
| 74 | +``` |
| 75 | + |
| 76 | +### Bucket Operations |
| 77 | +```console |
| 78 | +# create bucket |
| 79 | +osm mc mybucket |
| 80 | + |
| 81 | +# upload file to bucket |
| 82 | +osm push -c mybucket ~/Downloads/appscode.pdf a/b/c.pdf |
| 83 | + |
| 84 | +# print uploaded file attributes |
| 85 | +osm stat -c mybucket a/b/c.pdf |
| 86 | + |
| 87 | +# download file from bucket |
| 88 | +osm pull -c mybucket a/b/c.pdf /tmp/d.pdf |
| 89 | + |
| 90 | +# list bucket |
| 91 | +osm ls mybucket |
| 92 | + |
| 93 | +# remove file from bucket |
| 94 | +osm rm -c mybucket a/b/c.pdf |
| 95 | + |
| 96 | +# remove bucket (use -f to delete any files inside) |
| 97 | +osm rc -f mybucket |
| 98 | +``` |
| 99 | + |
| 100 | +## Contribution guidelines |
| 101 | +Want to help improve OSM? Please start [here](/CONTRIBUTING.md). |
| 102 | + |
| 103 | +## Support |
| 104 | +If you have any questions, you can reach out to us. |
| 105 | +* [Slack](https://slack.appscode.com) |
| 106 | +* [Twitter](https://twitter.com/AppsCodeHQ) |
| 107 | +* [Website](https://appscode.com) |
0 commit comments