aboutsummaryrefslogtreecommitdiff
path: root/doc/book/src/getting_started/bucket.md
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2021-03-18 10:39:55 +0100
committerAlex <alex@adnab.me>2021-03-18 10:39:55 +0100
commit5b659b28ce6bef15072d2fc93f777aa8ff73b2d8 (patch)
treee7ec9ec9dae459aeb6a99b35c537d46745053ec0 /doc/book/src/getting_started/bucket.md
parent6a3dcf39740cda27e61b93582b6fea66991ec4f2 (diff)
parentea21c544343afeb37e96678089bcd535e64982a7 (diff)
downloadgarage-5b659b28ce6bef15072d2fc93f777aa8ff73b2d8.tar.gz
garage-5b659b28ce6bef15072d2fc93f777aa8ff73b2d8.zip
Merge pull request 'Add a `mdbook` documentation to present garage and help user on-boarding' (#45) from feature/mdbook into master
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/45
Diffstat (limited to 'doc/book/src/getting_started/bucket.md')
-rw-r--r--doc/book/src/getting_started/bucket.md78
1 files changed, 78 insertions, 0 deletions
diff --git a/doc/book/src/getting_started/bucket.md b/doc/book/src/getting_started/bucket.md
new file mode 100644
index 00000000..b22ce788
--- /dev/null
+++ b/doc/book/src/getting_started/bucket.md
@@ -0,0 +1,78 @@
+# Create buckets and keys
+
+*We use a command named `garagectl` which is in fact an alias you must define as explained in the [Control the daemon](./daemon.md) section.*
+
+In this section, we will suppose that we want to create a bucket named `nextcloud-bucket`
+that will be accessed through a key named `nextcloud-app-key`.
+
+Don't forget that `help` command and `--help` subcommands can help you anywhere, the CLI tool is self-documented! Two examples:
+
+```
+garagectl help
+garagectl bucket allow --help
+```
+
+## Create a bucket
+
+Fine, now let's create a bucket (we imagine that you want to deploy nextcloud):
+
+```
+garagectl bucket create nextcloud-bucket
+```
+
+Check that everything went well:
+
+```
+garagectl bucket list
+garagectl bucket info nextcloud-bucket
+```
+
+## Create an API key
+
+Now we will generate an API key to access this bucket.
+Note that API keys are independent of buckets: one key can access multiple buckets, multiple keys can access one bucket.
+
+Now, let's start by creating a key only for our PHP application:
+
+```
+garagectl key new --name nextcloud-app-key
+```
+
+You will have the following output (this one is fake, `key_id` and `secret_key` were generated with the openssl CLI tool):
+
+```javascript
+Key {
+ key_id: "GK3515373e4c851ebaad366558",
+ secret_key: "7d37d093435a41f2aab8f13c19ba067d9776c90215f56614adad6ece597dbb34",
+ name: "nextcloud-app-key",
+ name_timestamp: 1603280506694,
+ deleted: false,
+ authorized_buckets: []
+}
+```
+
+Check that everything works as intended (be careful, info works only with your key identifier and not with its friendly name!):
+
+```
+garagectl key list
+garagectl key info GK3515373e4c851ebaad366558
+```
+
+## Allow a key to access a bucket
+
+Now that we have a bucket and a key, we need to give permissions to the key on the bucket!
+
+```
+garagectl bucket allow \
+ --read \
+ --write
+ nextcloud-bucket \
+ --key GK3515373e4c851ebaad366558
+```
+
+You can check at any times allowed keys on your bucket with:
+
+```
+garagectl bucket info nextcloud-bucket
+```
+