Skip to content

Commit fc7ff20

Browse files
committed
fixup: fix bootstrapper issues
1 parent 1421fec commit fc7ff20

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

lib/bootstrapper/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ function hasVpc(
1717
return (instance as aws_rds.DatabaseInstance).vpc !== undefined;
1818
}
1919

20+
const DEFAULT_PGSTAC_VERSION = "0.6.8";
21+
2022
/**
2123
* Bootstraps a database instance, installing pgSTAC onto the database.
2224
*/
@@ -26,12 +28,13 @@ export class BootstrapPgStac extends Construct {
2628
constructor(scope: Construct, id: string, props: BootstrapPgStacProps) {
2729
super(scope, id);
2830

31+
const { pgstacVersion = DEFAULT_PGSTAC_VERSION } = props;
2932
const handler = new aws_lambda.Function(this, "lambda", {
3033
handler: "handler.handler",
3134
runtime: aws_lambda.Runtime.PYTHON_3_8,
3235
code: aws_lambda.Code.fromDockerBuild(__dirname, {
3336
file: "runtime/Dockerfile",
34-
buildArgs: { PGSTAC_VERSION: props.pgstacVersion || "0.6.8" },
37+
buildArgs: { PGSTAC_VERSION: pgstacVersion },
3538
}),
3639
timeout: Duration.minutes(2),
3740
vpc: hasVpc(props.database) ? props.database.vpc : props.vpc,
@@ -74,7 +77,7 @@ export class BootstrapPgStac extends Construct {
7477
properties: {
7578
// By setting pgstac_version in the properties assures
7679
// that Create/Update events will be passed to the service token
77-
pgstac_version: props.pgstacVersion,
80+
pgstac_version: pgstacVersion,
7881
conn_secret_arn: props.dbSecret.secretArn,
7982
new_user_secret_arn: this.secret.secretArn,
8083
},

lib/bootstrapper/runtime/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,7 @@ COPY runtime/handler.py /asset/handler.py
1212
# https://stackoverflow.com/a/61746719
1313
# Tip from eoAPI: turns out, asyncio is part of python
1414
RUN rm -rf /asset/asyncio*
15+
16+
# A command must be present avoid the following error on CDK deploy:
17+
# Error response from daemon: No command specified
18+
CMD [ "echo", "ready to go!" ]

lib/bootstrapper/runtime/handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ def handler(event, context):
309309

310310
except Exception as e:
311311
print(f"Unable to bootstrap database with exception={e}")
312-
return send(event, context, "FAILED", {"message": str(e)})
312+
send(event, context, "FAILED", {"message": str(e)})
313+
raise e
313314

314315
print("Complete.")
315316
return send(event, context, "SUCCESS", {})

0 commit comments

Comments
 (0)