-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Buckets Scaleway : ajuste lifecycle rules (#3411)
- Loading branch information
1 parent
56662d9
commit 2820c4f
Showing
3 changed files
with
63 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Scaleway bucket configurations | ||
|
||
We use Scaleway for database backups replication. | ||
|
||
This folder holds configuration for: | ||
- bucket policies (permissions) | ||
- bucket lifecycles (how long to keep uploaded files, when to delete temporary files) | ||
|
||
## Scaleway documentation links | ||
|
||
- [Using bucket policies](https://www.scaleway.com/en/docs/storage/object/api-cli/using-bucket-policies/) | ||
- [Managing the lifecycle of objects](https://www.scaleway.com/en/docs/storage/object/api-cli/lifecycle-rules-api/) | ||
|
||
[See the GitHub issue comment](https://github.com/etalab/transport-site/issues/1548#issuecomment-1083189225) explaining what has been implemented. | ||
|
||
## Seeing / applying configuration | ||
|
||
At the moment **these configuration are NOT automatically applied** through CI or something else. You'll need to run CLI commands. | ||
|
||
Grab Scaleway credentials from our password manager solution first and [install the AWS CLI](https://www.scaleway.com/en/docs/storage/object/api-cli/object-storage-aws-cli/). | ||
|
||
### CLI commands related to lifecycles | ||
``` | ||
# See the lifecycle configuration | ||
aws --endpoint-url "https://s3.fr-par.scw.cloud" --region fr-par s3api get-bucket-lifecycle-configuration --bucket transport-staging-backups | ||
aws --endpoint-url "https://s3.fr-par.scw.cloud" --region fr-par s3api get-bucket-lifecycle-configuration --bucket transport-prod-backups | ||
# Apply a lifecycle configuration to a bucket | ||
aws --endpoint-url "https://s3.fr-par.scw.cloud" --region fr-par s3api put-bucket-lifecycle-configuration --lifecycle-configuration file:///Users/antoineaugusti/Documents/transport-site/docs/scaleway/bucket_lifecycle_configuration_production.json --bucket transport-prod-backups | ||
### CLI commands related to bucket policies | ||
``` | ||
# See a bucket policy configuration | ||
aws --endpoint-url "https://s3.fr-par.scw.cloud" --region fr-par s3api get-bucket-policy --bucket transport-prod-backups | ||
|
||
# Apply a bucket policy configuration to a bucket | ||
aws --endpoint-url "https://s3.fr-par.scw.cloud" --region fr-par s3api put-bucket-policy --bucket transport-prod-backups --policy file://docs/scaleway/bucket_policy_production.json | ||
``` |
16 changes: 13 additions & 3 deletions
16
docs/scaleway/bucket_lifecycle_configuration_production.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
{ | ||
"Rules":[ | ||
{ | ||
"ID":"delete-after-90-days", | ||
"Status":"Enabled", | ||
"Filter":{ | ||
"Prefix":"" | ||
}, | ||
"Expiration":{ | ||
"Days":90 | ||
}, | ||
"ID":"delete-after-90-days", | ||
} | ||
}, | ||
{ | ||
"ID":"Remove uncompleted uploads", | ||
"Status":"Enabled", | ||
"Filter":{ | ||
"Prefix":"" | ||
}, | ||
"Status":"Enabled" | ||
"AbortIncompleteMultipartUpload":{ | ||
"DaysAfterInitiation":1 | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
{ | ||
"Rules":[ | ||
{ | ||
"ID":"delete-after-30-days", | ||
"Status":"Enabled", | ||
"Filter":{ | ||
"Prefix":"" | ||
}, | ||
"Expiration":{ | ||
"Days":30 | ||
}, | ||
"ID":"delete-after-30-days", | ||
} | ||
}, | ||
{ | ||
"ID":"Remove uncompleted uploads", | ||
"Status":"Enabled", | ||
"Filter":{ | ||
"Prefix":"" | ||
}, | ||
"Status":"Enabled" | ||
"AbortIncompleteMultipartUpload":{ | ||
"DaysAfterInitiation":1 | ||
} | ||
} | ||
] | ||
} |