Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ brew "pngquant"
brew "jq"
brew "exiftool"
brew "md5sha1sum"
brew "watch"
tap "guardian/devtools"
brew "guardian/devtools/dev-nginx"
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ trait AwsClientV2BuilderUtils extends GridLogging {
def awsCredentialsV2: AwsCredentialsProvider = DefaultCredentialsProvider.builder().profileName("media-service").build()

final def withAWSCredentialsV2[T, S <: AwsClientBuilder[S, T]](builder: AwsClientBuilder[S, T], localstackAware: Boolean = true, maybeRegionOverride: Option[Region] = None): S = {
val credentialedBuilder = builder.credentialsProvider(awsCredentialsV2).region(maybeRegionOverride.getOrElse(awsRegionV2))

awsLocalEndpointUri match {
case Some(endpoint) if localstackAware => {
case Some(endpoint) if localstackAware =>
logger.info(s"creating aws client with local endpoint $endpoint")
builder.credentialsProvider(awsCredentialsV2).endpointOverride(endpoint)
}
case _ => builder.credentialsProvider(awsCredentialsV2).region(maybeRegionOverride.getOrElse(awsRegionV2))
credentialedBuilder.endpointOverride(endpoint)
case _ => credentialedBuilder
}
}
}
9 changes: 9 additions & 0 deletions dev/cloudformation/grid-dev-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ Resources:
Type: AWS::S3::Bucket
DependsOn: IngestSqsQueue
Properties:
CorsConfiguration:
CorsRules:
- Id: AllowUploadsFromBrowser
AllowedHeaders:
- '*'
AllowedMethods:
- PUT
AllowedOrigins:
- 'https://media.local.dev-gutools.co.uk'
NotificationConfiguration:
QueueConfigurations:
- Event: "s3:ObjectCreated:*"
Expand Down
16 changes: 15 additions & 1 deletion dev/script/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,21 @@ createCoreStack() {
fi
set +x

# TODO - this should wait until the stack operation has completed
for attempt in $(seq 1 15); do
status="$(aws cloudformation describe-stacks --stack-name "$CORE_STACK_NAME" \
--endpoint-url $LOCALSTACK_ENDPOINT | jq -r ".Stacks[0].StackStatus")"

if [[ $status = "CREATE_COMPLETE" || $status = "UPDATE_COMPLETE" ]]; then
echo "core stack created"
return
else
echo "still waiting for core stack - status was $status"
sleep 2
fi
done

echo "cloudformation stack did not finish creating after 30s - what's gone wrong?"
exit 1
}

createGuardianLocalAuthStack() {
Expand Down
13 changes: 6 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,19 @@ services:
ports:
- "9090:9000"
localstack:
image: localstack/localstack:0.12.3
platform: 'linux/x86_64'
image: localstack/localstack:4.5.0
ports:
- "4566:4566" # localstack's service proxy endpoint
- "4572:4572" # localstack's direct S3 endpoint, needed for image and image-origin buckets (see nginx-mappings.yml)
- "127.0.0.1:4566:4566" # LocalStack Gateway
- "127.0.0.1:4510-4559:4510-4559" # external services port range
expose:
- 4566 # provide the imgops container with access to localstack's direct S3 endpoint
environment:
SERVICES: cloudformation,cloudwatch,dynamodb,kinesis,s3,sns,sqs
SERVICES: cloudformation,cloudwatch,dynamodb,kinesis,s3,sns,sqs,iam
DEFAULT_REGION: eu-west-1
KINESIS_ERROR_PROBABILITY: 0.0
DATA_DIR: /tmp/localstack/data
volumes:
- './dev/.localstack:/tmp/localstack'
- "./dev/.localstack:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
oidc-provider:
build:
context: ./dev/oidc-provider
Expand Down
Loading