Compare commits

..

No commits in common. "16aa418e473a5e9ef229060d20f6eb280df272a2" and "3a0e07404707568dabb13cecaf79e0466c5fc296" have entirely different histories.

4 changed files with 8 additions and 11 deletions

View file

@ -421,7 +421,7 @@ Now we can write a simple script (eg `~/.local/bin/matrix-cache-gc`):
## CONFIGURATION ## ## CONFIGURATION ##
AWS_ACCESS_KEY_ID=GKxxx AWS_ACCESS_KEY_ID=GKxxx
AWS_SECRET_ACCESS_KEY=xxxx AWS_SECRET_ACCESS_KEY=xxxx
AWS_ENDPOINT_URL=http://localhost:3900 S3_ENDPOINT=http://localhost:3900
S3_BUCKET=matrix S3_BUCKET=matrix
MEDIA_STORE=/var/lib/matrix-synapse/media MEDIA_STORE=/var/lib/matrix-synapse/media
PG_USER=matrix PG_USER=matrix
@ -442,7 +442,7 @@ EOF
s3_media_upload update-db 1d s3_media_upload update-db 1d
s3_media_upload --no-progress check-deleted $MEDIA_STORE s3_media_upload --no-progress check-deleted $MEDIA_STORE
s3_media_upload --no-progress upload $MEDIA_STORE $S3_BUCKET --delete --endpoint-url $AWS_ENDPOINT_URL s3_media_upload --no-progress upload $MEDIA_STORE $S3_BUCKET --delete --endpoint-url $S3_ENDPOINT
``` ```
This script will list all the medias that were not accessed in the 24 hours according to your database. This script will list all the medias that were not accessed in the 24 hours according to your database.

View file

@ -70,17 +70,16 @@ Then a file named `~/.aws/config` and put:
```toml ```toml
[default] [default]
region=garage region=garage
endpoint_url=http://127.0.0.1:3900
``` ```
Now, supposing Garage is listening on `http://127.0.0.1:3900`, you can list your buckets with: Now, supposing Garage is listening on `http://127.0.0.1:3900`, you can list your buckets with:
```bash ```bash
aws s3 ls aws --endpoint-url http://127.0.0.1:3900 s3 ls
``` ```
If you're using awscli `<1.29.0` or `<2.13.0`, you need to pass `--endpoint-url` to each CLI invocation explicitly. Passing the `--endpoint-url` parameter to each command is annoying but AWS developers do not provide a corresponding configuration entry.
As a workaround, you can redefine the aws command by editing the file `~/.bashrc` in this case: As a workaround, you can redefine the aws command by editing the file `~/.bashrc`:
``` ```
function aws { command aws --endpoint-url http://127.0.0.1:3900 $@ ; } function aws { command aws --endpoint-url http://127.0.0.1:3900 $@ ; }

View file

@ -269,14 +269,12 @@ named `~/.awsrc` with this content:
export AWS_ACCESS_KEY_ID=xxxx # put your Key ID here export AWS_ACCESS_KEY_ID=xxxx # put your Key ID here
export AWS_SECRET_ACCESS_KEY=xxxx # put your Secret key here export AWS_SECRET_ACCESS_KEY=xxxx # put your Secret key here
export AWS_DEFAULT_REGION='garage' export AWS_DEFAULT_REGION='garage'
export AWS_ENDPOINT_URL='http://localhost:3900' export AWS_ENDPOINT='http://localhost:3900'
function aws { command aws --endpoint-url $AWS_ENDPOINT $@ ; }
aws --version aws --version
``` ```
Note you need to have at least `awscli` `>=1.29.0` or `>=2.13.0`, otherwise you
need to specify `--endpoint-url` explicitly on each `awscli` invocation.
Now, each time you want to use `awscli` on this target, run: Now, each time you want to use `awscli` on this target, run:
```bash ```bash

View file

@ -1,7 +1,7 @@
export AWS_ACCESS_KEY_ID=`cat /tmp/garage.s3 |cut -d' ' -f1` export AWS_ACCESS_KEY_ID=`cat /tmp/garage.s3 |cut -d' ' -f1`
export AWS_SECRET_ACCESS_KEY=`cat /tmp/garage.s3 |cut -d' ' -f2` export AWS_SECRET_ACCESS_KEY=`cat /tmp/garage.s3 |cut -d' ' -f2`
export AWS_DEFAULT_REGION='garage' export AWS_DEFAULT_REGION='garage'
# FUTUREWORK: set AWS_ENDPOINT_URL instead, once nixpkgs bumps awscli to >=2.13.0.
function aws { command aws --endpoint-url http://127.0.0.1:3911 $@ ; } function aws { command aws --endpoint-url http://127.0.0.1:3911 $@ ; }
aws --version aws --version