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 app contents to Dockerfile.dev to enable use in remote environments #599

Closed
wants to merge 1 commit into from

Conversation

jeremywmoore
Copy link
Collaborator

@jeremywmoore jeremywmoore commented Sep 19, 2024

This PR adds the contents of the hushline repo to Dockerfile.dev to facilitate running tools/scripts in remove dev environments where we don't have volume mounts.

@jeremywmoore jeremywmoore added deploy create dev deployment and removed deploy create dev deployment labels Sep 19, 2024
@jeremywmoore jeremywmoore added deploy create dev deployment and removed deploy create dev deployment labels Sep 20, 2024
@jeremywmoore jeremywmoore added deploy create dev deployment destroy destroy dev deployment and removed deploy create dev deployment labels Sep 23, 2024
@github-actions github-actions bot removed deploy create dev deployment destroy destroy dev deployment labels Sep 23, 2024
@jeremywmoore jeremywmoore added the deploy create dev deployment label Sep 23, 2024
Copy link

github-actions bot commented Sep 24, 2024

Terraform plan in terraform/dev in the hushline-dev-dev-data workspace

With variables

branch = "dev-data"
name   = "dev-dev-data"
Plan: 1 to add, 0 to change, 1 to destroy. Changes to Outputs.
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # module.app.digitalocean_app.app must be replaced
-/+ resource "digitalocean_app" "app" {
+       active_deployment_id = (known after apply)
!~      created_at           = "2024-09-24 16:12:37 +0000 UTC" -> (known after apply)
+       default_ingress      = (known after apply)
!~      id                   = "************************************" -> (known after apply)
+       live_url             = (known after apply)
!~      updated_at           = "2024-09-24 16:37:03 +0000 UTC" -> (known after apply)
!~      urn                  = "do:app:addb53f5-59bb-4003-b906-e484d669ecbe" -> (known after apply)
#        (1 unchanged attribute hidden)

!~      dedicated_ips (known after apply)

!~      spec {
!~          domains  = [] -> (known after apply)
            name     = "dev-dev-data"
#            (2 unchanged attributes hidden)

!~          domain (known after apply)

!~          ingress (known after apply)
-           ingress {
-               rule {
-                   component {
-                       name                 = "app" -> null
-                       preserve_path_prefix = false -> null
#                        (1 unchanged attribute hidden)
                    }
-                   match {
-                       path {
-                           prefix = "/" -> null
                        }
                    }
                }
            }

!~          job {
!~              dockerfile_path    = "./Dockerfile.prod" -> "./Dockerfile.dev"
                name               = "dev-data"
#                (7 unchanged attributes hidden)

#                (1 unchanged block hidden)
            }

!~          service {
!~              internal_ports     = [] -> (known after apply)
                name               = "app"
+               run_command        = (known after apply)
#                (7 unchanged attributes hidden)

!~              health_check {
-                   failure_threshold     = 0 -> null
-                   initial_delay_seconds = 0 -> null
-                   period_seconds        = 0 -> null
-                   port                  = 0 -> null
-                   success_threshold     = 0 -> null
-                   timeout_seconds       = 0 -> null
#                    (1 unchanged attribute hidden)
                }

!~              routes (known after apply)

#                (1 unchanged block hidden)
            }
!~          service {
!~              http_port          = 0 -> (known after apply)
                name               = "db"
+               run_command        = (known after apply)
#                (7 unchanged attributes hidden)

!~              image {
-                   registry_credentials = (sensitive value) -> null
#                    (4 unchanged attributes hidden)

!~                  deploy_on_push (known after apply)
                }

!~              routes (known after apply)
            }

#            (1 unchanged block hidden)
        }
    }

Plan: 1 to add, 0 to change, 1 to destroy.

Changes to Outputs:
+   app_live_url = (known after apply)

✅ Plan applied in Deploy/Destroy Branch Dev Environment #301

Outputs
app_live_url = "https://dev-dev-data-knkuz.ondigitalocean.app"

Copy link

🚀 App successfully deployed to https://dev-dev-data-knkuz.ondigitalocean.app!

@jeremywmoore jeremywmoore changed the title testing dev data on dev deployments Add app contents to Dockerfile.dev to enable use in remote environments Sep 24, 2024
@jeremywmoore jeremywmoore force-pushed the dev-data branch 2 times, most recently from 975f771 to 71a7368 Compare September 24, 2024 16:48
@jeremywmoore jeremywmoore marked this pull request as ready for review September 24, 2024 16:48
@scidsg scidsg deleted a comment from github-actions bot Sep 24, 2024
@scidsg scidsg deleted a comment from github-actions bot Sep 24, 2024
@scidsg scidsg deleted a comment from github-actions bot Sep 24, 2024
@scidsg scidsg deleted a comment from github-actions bot Sep 24, 2024
@scidsg scidsg deleted a comment from github-actions bot Sep 24, 2024
@scidsg scidsg deleted a comment from github-actions bot Sep 24, 2024
@scidsg scidsg deleted a comment from github-actions bot Sep 24, 2024
@scidsg scidsg deleted a comment from github-actions bot Sep 24, 2024
@scidsg scidsg deleted a comment from github-actions bot Sep 24, 2024
@scidsg scidsg deleted a comment from github-actions bot Sep 24, 2024
@scidsg scidsg deleted a comment from github-actions bot Sep 24, 2024
@scidsg scidsg deleted a comment from github-actions bot Sep 24, 2024
@scidsg scidsg deleted a comment from github-actions bot Sep 24, 2024
@scidsg scidsg deleted a comment from github-actions bot Sep 24, 2024
@scidsg scidsg deleted a comment from github-actions bot Sep 24, 2024
@scidsg scidsg deleted a comment from github-actions bot Sep 24, 2024
@jeremywmoore
Copy link
Collaborator Author

Alternatively, we could update Dockerfile.prod to remove the --no-root option since we no longer need to optimize builds for local development.

@brassy-endomorph
Copy link
Collaborator

I'm lost again on this PR. We mentioned some bug, but I can't find discussion of it. What was this trying to fix?

@jeremywmoore
Copy link
Collaborator Author

@brassy-endomorph no worries, this PR is intended to support running the dev_data.py script in the context of remote dev deployments. The image built by Dockerfile.dev in its current form isn't suitable because it doesn't contain the project source (the script or hushline app source). The image built by Dockerfile.prod isn't suitable as it doesn't install hushline into the venv, only its dependency (--no-root). The two options are 1) Add the source to the Dockerfile.dev or 2) install the application without the --no-root option. I chose option 1 here since adding test data feels like a "dev" type of activity and when we use the dev container locally, it has the source code mounted as a volume.

Alternatively, we could make the change presented in #619 and run the dev_data script from an image build from Dockerfile.prod.

@brassy-endomorph
Copy link
Collaborator

Both of these feel like kluges and if we're going to include dev_data.py in a prod container, we might as well just make it a normal click command and put it in the app so we can avoid all these oddities. Double poetry install on the prod container and copying the project root to /app and then also mounting the project root to /app in the compose file both feel like anti-patterns to me.

Should we just make it a command then? Can do the same with the dev_migrations.py too at that point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy create dev deployment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants