From ef6304ca05c081eee763b629dd314758bb6014a8 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Wed, 21 Oct 2020 14:18:21 +0200 Subject: Garage doc is now improved --- "src/Technique/D\303\251veloppement/Garage.md" | 66 +++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git "a/src/Technique/D\303\251veloppement/Garage.md" "b/src/Technique/D\303\251veloppement/Garage.md" index e352758..ae5471c 100644 --- "a/src/Technique/D\303\251veloppement/Garage.md" +++ "b/src/Technique/D\303\251veloppement/Garage.md" @@ -48,7 +48,7 @@ Now, let's start by creating a key only for our PHP application: grg key new --name nextcloud-app-key ``` -You will have the following output (this one is fake, `key_id` and `secret_key` were generated with openssl CLI tool): +You will have the following output (this one is fake, `key_id` and `secret_key` were generated with the openssl CLI tool): ``` Key { key_id: "GK3515373e4c851ebaad366558", secret_key: "7d37d093435a41f2aab8f13c19ba067d9776c90215f56614adad6ece597dbb34", name: "nextcloud-app-key", name_timestamp: 1603280506694, deleted: false, authorized_buckets: [] } @@ -74,8 +74,72 @@ grg bucket info nextcloud-bucket ``` Now, let's move to the S3 API! +We will `s3cmd`. +You can install it via your favorite package manager. +Otherwise, check [their website](https://s3tools.org/s3cmd) +We will configure `s3cmd` with its interactive configuration tool, be careful not all endpoints are implemented! +``` +$ s3cmd --configure + +Enter new values or accept defaults in brackets with Enter. +Refer to user manual for detailed description of all options. + +Access key and Secret key are your identifiers for Amazon S3. Leave them empty for using the env variables. +Access Key: GK100653a3e4878215661ac15d +Secret Key: 8434e334eeb668d4f18c118a3f289d8a902e623b39b76c06bd03a068c057519d +Default Region [US]: garage + +Use "s3.amazonaws.com" for S3 Endpoint and not modify it to the target Amazon S3. +S3 Endpoint [s3.amazonaws.com]: garage.deuxfleurs.fr + +Use "%(bucket)s.s3.amazonaws.com" to the target Amazon S3. "%(bucket)s" and "%(location)s" vars can be used +if the target S3 system supports dns based buckets. +DNS-style bucket+hostname:port template for accessing a bucket [%(bucket)s.s3.amazonaws.com]: garage.deuxfleurs.fr + +Encryption password is used to protect your files from reading +by unauthorized persons while in transfer to S3 +Encryption password: +Path to GPG program [/usr/bin/gpg]: + +When using secure HTTPS protocol all communication with Amazon S3 +servers is protected from 3rd party eavesdropping. This method is +slower than plain HTTP, and can only be proxied with Python 2.7 or newer +Use HTTPS protocol [Yes]: + +On some networks all internet access must go through a HTTP proxy. +Try setting it here if you can't connect to S3 directly +HTTP Proxy server name: + +New settings: + Access Key: GK3515373e4c851ebaad366558 + Secret Key: 7d37d093435a41f2aab8f13c19ba067d9776c90215f56614adad6ece597dbb34 + Default Region: garage + S3 Endpoint: garage.deuxfleurs.fr + DNS-style bucket+hostname:port template for accessing a bucket: garage.deuxfleurs.fr + Encryption password: + Path to GPG program: /usr/bin/gpg + Use HTTPS protocol: True + HTTP Proxy server name: + HTTP Proxy server port: 0 + +Test access with supplied credentials? [Y/n] n + +Save settings? [y/N] y +Configuration saved to '/home/quentin/.s3cfg' +``` + +Now, if everything works, the following commands should work: + +``` +echo hello world > hello.txt +s3cmd put hello.txt s3://nextcloud-bucket +s3cmd ls s3://nextcloud-bucket +s3cmd rm s3://nextcloud-bucket/hello.txt +``` + +That's all for now! ## Context -- cgit v1.2.3