Skip to content

Commit

Permalink
Update run-configs for Job Framework setup scripts & apply some fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Rögner <[email protected]>
  • Loading branch information
roegi committed Oct 16, 2024
1 parent bedc96c commit 3f52086
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .run/jobServiceSetup.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@

<component name="ProjectRunConfigurationManager">
<configuration default="false" name="jobServiceSetup" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="" />
<option name="SCRIPT_TEXT" value="docker exec localstack-main /home/localstack/job-service/localSetup.sh" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/xyz-jobs/xyz-job-service/src/main/bash/localSetup.sh" />
<option name="SCRIPT_PATH" value="" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$/xyz-jobs/xyz-job-service/src/main/bash" />
<option name="SCRIPT_WORKING_DIRECTORY" value="." />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="/bin/bash" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="false" />
<envs />
<method v="2" />
</configuration>
Expand Down
4 changes: 2 additions & 2 deletions docker-compose-dynamodb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ services:
- "/var/run/docker.sock:/var/run/docker.sock"
- "./xyz-hub-test/src/test/resources/mock-servers/localstack/docker-entrypoint-initaws.d/01-create-bucket.sh:/etc/localstack/init/ready.d/init-aws.sh"
- "./xyz-jobs/xyz-job-service/src/main/bash:/home/localstack/job-service"
- "./xyz-jobs/xyz-job-steps/src/main/bash:/home/localstack/job-steps"
- "./xyz-jobs/xyz-job-steps/target:/home/localstack/job-steps.target"
- "./xyz-jobs/xyz-job-steps/src/main/bash:/home/localstack/job-steps-scripts"
- "./xyz-jobs/xyz-job-steps:/home/localstack/job-steps"
s3-explorer:
image: aws-js-s3-explorer
build:
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ services:
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "./xyz-hub-test/src/test/resources/mock-servers/localstack/docker-entrypoint-initaws.d/01-create-bucket.sh:/etc/localstack/init/ready.d/init-aws.sh"
- "./xyz-jobs/xyz-job-service/src/main/bash:/home/localstack/job-service"
- "./xyz-jobs/xyz-job-steps/src/main/bash:/home/localstack/job-steps"
- "./xyz-jobs/xyz-job-steps/target:/home/localstack/job-steps.target"
s3-explorer:
image: aws-js-s3-explorer
build:
Expand Down
9 changes: 2 additions & 7 deletions xyz-jobs/xyz-job-service/src/main/bash/localSetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
# License-Filename: LICENSE
#

invocation_endpoint = "http://host.docker.internal:7070/admin/state/events"
invocation_endpoint="http://host.docker.internal:7070/admin/state/events"

if [ "$HOSTNAME" = "localstack" ]; then
invocation_endpoint="'http://host.docker.internal:7070/admin/state/events'"
invocation_endpoint="'http://host.docker.internal:7070/admin/state/events'"
fi


state_machine_arn_prefix=arn:aws:states:us-east-1:000000000000:stateMachine:job-

aws --endpoint http://localhost:4566 events put-rule \
Expand All @@ -40,17 +39,13 @@ connection_arn=$(aws --endpoint http://localhost:4566 events create-connection \
--auth-parameters "ApiKeyAuthParameters={ApiKeyName=apiKey,ApiKeyValue=dummy-admin-api-key}" \
--region us-east-1 | sed -n 's/.*"ConnectionArn":\s*"\([^"]*\)".*/\1/p' )

echo "connection_arn -> $connection_arn"

api_destination_arn=$(aws --endpoint http://localhost:4566 events create-api-destination \
--name JobApiDestination \
--connection-arn "$connection_arn" \
--invocation-endpoint $invocation_endpoint \
--http-method POST \
--region us-east-1 | sed -n 's/.*"ApiDestinationArn":\s*"\([^"]*\)".*/\1/p')

echo "api_destination_arn -> $api_destination_arn"

aws --endpoint http://localhost:4566 events put-targets \
--rule StepFunctionStateChangeRule \
--targets "Id"="JobApiDestination","Arn"="$api_destination_arn" \
Expand Down
7 changes: 6 additions & 1 deletion xyz-jobs/xyz-job-steps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,12 @@
<execution>
<configuration>
<workingDirectory>${project.build.directory}</workingDirectory>
<executable>${basedir}/src/main/bash/deployLocalLambda.sh</executable>
<executable>docker</executable>
<arguments>
<argument>exec</argument>
<argument>localstack-main</argument>
<argument>/home/localstack/job-steps-scripts/deployLocalLambda.sh</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
Expand Down
3 changes: 2 additions & 1 deletion xyz-jobs/xyz-job-steps/src/main/bash/deployLocalLambda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ LOCAL_STACK_HOST="http://localhost:4566"
targetPathRel="../../../target"

if [ "$HOSTNAME" = "localstack" ]; then
targetPathRel="../job-steps.target"
targetPathRel="../job-steps/target"
fi

#Check if the localstack is up and running
Expand All @@ -41,6 +41,7 @@ cd ${scriptBasePath}/${targetPathRel}
rm -rf lib > /dev/null 2>&1
mkdir lib
cp ./xyz-job-steps-fat.jar lib
chown -R 1000:1000 lib
zip -r xyz-job-steps.zip lib

#Delete a potentially existing old local Lambda Function with the same name
Expand Down

0 comments on commit 3f52086

Please sign in to comment.