mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-03-23 15:25:07 +00:00
try faster s3
This commit is contained in:
@@ -9,21 +9,21 @@ services:
|
||||
service: scim-test-server
|
||||
localstack-s3:
|
||||
image: localstack/localstack:s3-latest
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localstack-s3:4566"]
|
||||
interval: 1s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
create-bucket:
|
||||
image: amazon/aws-cli:latest
|
||||
environment:
|
||||
AWS_ACCESS_KEY_ID: test
|
||||
AWS_SECRET_ACCESS_KEY: test
|
||||
AWS_DEFAULT_REGION: us-east-1
|
||||
depends_on:
|
||||
localstack-s3:
|
||||
condition: service_healthy
|
||||
entrypoint: "aws --endpoint-url=http://localstack-s3:4566 s3 mb s3://pocket-id-test"
|
||||
volumes:
|
||||
- ./localstack-init-s3.py:/etc/localstack/init/ready.d/10-init-s3.py
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
"CMD-SHELL",
|
||||
'curl -fs http://localstack-s3:4566/_localstack/init/ready | grep -q ''"completed": true''',
|
||||
]
|
||||
interval: 1s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
pocket-id:
|
||||
extends:
|
||||
file: docker-compose.yml
|
||||
@@ -37,8 +37,8 @@ services:
|
||||
S3_SECRET_ACCESS_KEY: test
|
||||
S3_FORCE_PATH_STYLE: true
|
||||
depends_on:
|
||||
create-bucket:
|
||||
condition: service_completed_successfully
|
||||
localstack-s3:
|
||||
condition: service_healthy
|
||||
|
||||
volumes:
|
||||
pocket-id-test-data:
|
||||
|
||||
22
tests/setup/localstack-init-s3.py
Normal file
22
tests/setup/localstack-init-s3.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import boto3
|
||||
from botocore.exceptions import ClientError
|
||||
|
||||
BUCKET_NAME = "pocket-id-test"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
s3 = boto3.client(
|
||||
"s3",
|
||||
endpoint_url="http://localhost:4566",
|
||||
aws_access_key_id="test",
|
||||
aws_secret_access_key="test",
|
||||
region_name="us-east-1",
|
||||
)
|
||||
|
||||
try:
|
||||
s3.head_bucket(Bucket=BUCKET_NAME)
|
||||
except ClientError:
|
||||
s3.create_bucket(Bucket=BUCKET_NAME)
|
||||
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user