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

Bundle backend as reusable library #231

Merged
merged 33 commits into from
Jun 28, 2024
Merged

Bundle backend as reusable library #231

merged 33 commits into from
Jun 28, 2024

Conversation

danielnaab
Copy link
Collaborator

@danielnaab danielnaab commented Jun 26, 2024

To support customizable form service instances, this branch adds an @atj/server package, which is consumed by the server-kansas and server-doj applications.

Things to note:

  • @atj/server is an Astro server, based on the existing client-side application
  • To use the server, the consumer imports a createServer function, which returns an Express application that hosts the entire app. This could be modularized further, to support hosting static assets via CDN, hosting multiple form service sites on the same Express instance, etc.
  • Customizations to the server would be injected as arguments to createServer
  • Because the prior implementation assumed in-browser usage, there is some future work necessary to make the configurable form elements injectable on the server-side. As a result, the default patterns are used directly, but they would become arguments to createServer in the future.

Copy link

github-actions bot commented Jun 26, 2024

Terraform plan for tts-10x-atj-staging

Plan: 4 to add, 0 to change, 2 to destroy.
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
+   create
-   destroy

Terraform will perform the following actions:

  # cloudfoundry_app.tts-10x-atj-staging-doj-demo_tts-10x-atj-staging-doj-demo-app_736F8430 will be destroyed
  # (because cloudfoundry_app.tts-10x-atj-staging-doj-demo_tts-10x-atj-staging-doj-demo-app_736F8430 is not in configuration)
-   resource "cloudfoundry_app" "tts-10x-atj-staging-doj-demo_tts-10x-atj-staging-doj-demo-app_736F8430" {
-       disk_quota                      = 4096 -> null
-       docker_image                    = "ghcr.io/gsa-tts/atj-platform/doj-demo:main" -> null
-       enable_ssh                      = true -> null
-       environment                     = (sensitive value) -> null
-       health_check_http_endpoint      = "/" -> null
-       health_check_invocation_timeout = 0 -> null
-       health_check_timeout            = 0 -> null
-       health_check_type               = "http" -> null
-       id                              = "828eaa40-786a-45ce-9a44-3271b1e659d5" -> null
-       id_bg                           = "828eaa40-786a-45ce-9a44-3271b1e659d5" -> null
-       instances                       = 1 -> null
-       labels                          = {} -> null
-       memory                          = 1024 -> null
-       name                            = "tts-10x-atj-staging-doj-demo-app" -> null
-       ports                           = [] -> null
-       space                           = "132fc49b-e29e-40b3-8914-4233e4d4caf4" -> null
-       stopped                         = false -> null
-       strategy                        = "none" -> null
-       timeout                         = 60 -> null
#        (1 unchanged attribute hidden)

-       routes {
-           port  = 0 -> null
-           route = "90846ea2-699e-4416-9037-2c3b739adc90" -> null
        }
    }

  # cloudfoundry_app.tts-10x-atj-staging-server-doj_tts-10x-atj-staging-server-doj-app_E0D2137F will be created
+   resource "cloudfoundry_app" "tts-10x-atj-staging-server-doj_tts-10x-atj-staging-server-doj-app_E0D2137F" {
+       buildpack                       = (known after apply)
+       disk_quota                      = 4096
+       docker_image                    = "ghcr.io/gsa-tts/atj-platform/server-doj:staging"
+       enable_ssh                      = (known after apply)
+       environment                     = (sensitive value)
+       health_check_http_endpoint      = "/"
+       health_check_invocation_timeout = (known after apply)
+       health_check_timeout            = (known after apply)
+       health_check_type               = "http"
+       id                              = (known after apply)
+       id_bg                           = (known after apply)
+       instances                       = 1
+       memory                          = 1024
+       name                            = "tts-10x-atj-staging-server-doj-app"
+       ports                           = (known after apply)
+       space                           = "132fc49b-e29e-40b3-8914-4233e4d4caf4"
+       stack                           = (known after apply)
+       stopped                         = false
+       strategy                        = "none"
+       timeout                         = 60

+       routes {
+           port  = (known after apply)
+           route = (known after apply)
        }
    }

  # cloudfoundry_app.tts-10x-atj-staging-server-kansas_tts-10x-atj-staging-server-kansas-app_0CAEC23C will be created
+   resource "cloudfoundry_app" "tts-10x-atj-staging-server-kansas_tts-10x-atj-staging-server-kansas-app_0CAEC23C" {
+       buildpack                       = (known after apply)
+       disk_quota                      = 4096
+       docker_image                    = "ghcr.io/gsa-tts/atj-platform/server-kansas:staging"
+       enable_ssh                      = (known after apply)
+       environment                     = (sensitive value)
+       health_check_http_endpoint      = "/"
+       health_check_invocation_timeout = (known after apply)
+       health_check_timeout            = (known after apply)
+       health_check_type               = "http"
+       id                              = (known after apply)
+       id_bg                           = (known after apply)
+       instances                       = 1
+       memory                          = 1024
+       name                            = "tts-10x-atj-staging-server-kansas-app"
+       ports                           = (known after apply)
+       space                           = "132fc49b-e29e-40b3-8914-4233e4d4caf4"
+       stack                           = (known after apply)
+       stopped                         = false
+       strategy                        = "none"
+       timeout                         = 60

+       routes {
+           port  = (known after apply)
+           route = (known after apply)
        }
    }

  # cloudfoundry_route.tts-10x-atj-staging-doj-demo-route will be destroyed
  # (because cloudfoundry_route.tts-10x-atj-staging-doj-demo-route is not in configuration)
-   resource "cloudfoundry_route" "tts-10x-atj-staging-doj-demo-route" {
-       domain   = "50ba3f69-cd54-4963-9172-14f3334b479e" -> null
-       endpoint = "tts-10x-atj-staging-doj-demo.app.cloud.gov" -> null
-       hostname = "tts-10x-atj-staging-doj-demo" -> null
-       id       = "90846ea2-699e-4416-9037-2c3b739adc90" -> null
-       space    = "132fc49b-e29e-40b3-8914-4233e4d4caf4" -> null
#        (1 unchanged attribute hidden)
    }

  # cloudfoundry_route.tts-10x-atj-staging-server-doj-route will be created
+   resource "cloudfoundry_route" "tts-10x-atj-staging-server-doj-route" {
+       domain   = "50ba3f69-cd54-4963-9172-14f3334b479e"
+       endpoint = (known after apply)
+       hostname = "tts-10x-atj-staging-server-doj"
+       id       = (known after apply)
+       port     = (known after apply)
+       space    = "132fc49b-e29e-40b3-8914-4233e4d4caf4"
    }

  # cloudfoundry_route.tts-10x-atj-staging-server-kansas-route will be created
+   resource "cloudfoundry_route" "tts-10x-atj-staging-server-kansas-route" {
+       domain   = "50ba3f69-cd54-4963-9172-14f3334b479e"
+       endpoint = (known after apply)
+       hostname = "tts-10x-atj-staging-server-kansas"
+       id       = (known after apply)
+       port     = (known after apply)
+       space    = "132fc49b-e29e-40b3-8914-4233e4d4caf4"
    }

Plan: 4 to add, 0 to change, 2 to destroy.

📝 Plan generated in Post Terraform plan to PR comment #43

@danielnaab danielnaab marked this pull request as ready for review June 27, 2024 21:05
Copy link
Collaborator

@natashapl natashapl left a comment

Choose a reason for hiding this comment

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

There are a lot of changes here, but it looks good to me.

Copy link
Collaborator

@ethangardner ethangardner left a comment

Choose a reason for hiding this comment

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

Overall, I think this looks great. The one thing I wanted was a small stub of documentation due to the issues I had slacked you about with regard to getting the code in this PR running locally. Other than that LGTM.

packages/server/README.md Outdated Show resolved Hide resolved
@danielnaab danielnaab merged commit 69da3eb into main Jun 28, 2024
1 check passed
@danielnaab danielnaab deleted the astro-library branch June 28, 2024 20:14
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.

3 participants