Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add start script and local db config #13

Merged
merged 4 commits into from
Sep 16, 2024
Merged

Add start script and local db config #13

merged 4 commits into from
Sep 16, 2024

Conversation

bryophyta
Copy link
Contributor

@bryophyta bryophyta commented Sep 11, 2024

What does this change?

  • Add a config function for connecting to the local postgres db
  • Add a start script (modelled after the Grid's start.sh which:
    • Checks for necessary dependencies
    • By default will spin up the Docker containers, run the ingestion-lambda in 'dev' mode, and start the Play app.
    • If passed the --use-CODE flag, it will establish a tunnel to the CODE db, if there isn't one already, and start the Play app.

How to test

How can we measure success?

Have we considered potential risks?

Images

Accessibility

@@ -46,8 +46,11 @@ class AppComponents(context: Context)
.build()

if (context.environment.mode == Mode.Dev) {
// TODO run against a local DB?
Database.configureRemoteDevDb(ssmClient)
if (sys.env.contains("USE_CODE_DB")) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not super happy about using an environment variable here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we discussed in-person and ideally we might instead have an environment variable more specific to connect differences, such as USE_IAM_AUTH but let's save for a future PR

scripts/start Outdated Show resolved Hide resolved
else
echo "Using the local stack. Starting Docker, Ingestion Lambda and Play App."
# run all three, and terminate together when the user presses `ctrl+c`: https://stackoverflow.com/a/52033580
(trap 'kill 0' SIGINT; startDockerContainers && startIngestionLambda & startPlayApp & wait)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to broadly work as expected, but I've noticed a couple of bugs with my shell when subsequently doing interactive stuff in the same shell session, so I think this needs a bit more investigation..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had trouble with backgrounding via & before, let's see how painful it gets when using day-to-day and improve in a future PR if needs be

@bryophyta bryophyta marked this pull request as ready for review September 12, 2024 12:02
@bryophyta bryophyta requested a review from a team as a code owner September 12, 2024 12:02
@@ -46,8 +46,11 @@ class AppComponents(context: Context)
.build()

if (context.environment.mode == Mode.Dev) {
// TODO run against a local DB?
Database.configureRemoteDevDb(ssmClient)
if (sys.env.contains("USE_CODE_DB")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we discussed in-person and ideally we might instead have an environment variable more specific to connect differences, such as USE_IAM_AUTH but let's save for a future PR

else
echo "Using the local stack. Starting Docker, Ingestion Lambda and Play App."
# run all three, and terminate together when the user presses `ctrl+c`: https://stackoverflow.com/a/52033580
(trap 'kill 0' SIGINT; startDockerContainers && startIngestionLambda & startPlayApp & wait)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had trouble with backgrounding via & before, let's see how painful it gets when using day-to-day and improve in a future PR if needs be

@twrichards
Copy link
Contributor

Awesome work @bryophyta this will make things much easier while we're developing 🙌

@bryophyta bryophyta merged commit 2e26030 into main Sep 16, 2024
3 checks passed
@bryophyta bryophyta deleted the pf/add-start-script branch September 16, 2024 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants