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

Parameterize database path and deletion #1763

Closed
5 tasks done
thekaveman opened this issue Oct 28, 2023 · 0 comments · Fixed by #1770
Closed
5 tasks done

Parameterize database path and deletion #1763

thekaveman opened this issue Oct 28, 2023 · 0 comments · Fixed by #1770
Assignees
Labels
back-end Django views, sessions, middleware, models, migrations etc. docker Application container, devcontainer, Compose, etc. infrastructure Terraform, Azure, etc.

Comments

@thekaveman
Copy link
Member

thekaveman commented Oct 28, 2023

Background

Currently, the bin/init.sh script deletes and then recreates (via Django's manage.py helpers) the Sqlite database file every time it is called. This happens both during local development and in the Azure app service -- bin/init.sh is called during the app image's startup.

The Django app settings put the Sqlite database file in the same directory as the source code within the running app (or dev) container. In the Azure app service, this is an ephemeral directory that is lost on app service restarts / redeploys, so it is "good" that the database file is recreated each app service restart.

However, our "data" is encoded in a large data migration file that can read from the environment. We want to move away from configuring the app as code, and the first step is being able to maintain our database file between app service restarts.

Acceptance Criteria

  • database is deleted if environment variable e.g. DATABASE_RESET if set and true
  • database stored in a location determined by an environment variable e.g. DATABASE_DIR; default to the current directory to maintain existing behavior if unset
  • local devcontainer workflow is unaffected / still works OOTB
  • DATABASE_DIR set to /home/site/wwwroot for Azure app service; Maintain Sqlite config database in mounted storage container #1673 (comment) Reverted to . for more research
  • DATABASE_RESET set to true for Azure app service for now to maintain existing behavior while we migrate to an Admin interface

Additional context

@thekaveman thekaveman added back-end Django views, sessions, middleware, models, migrations etc. docker Application container, devcontainer, Compose, etc. infrastructure Terraform, Azure, etc. labels Oct 28, 2023
@thekaveman thekaveman added this to the Admin tool: v1 milestone Oct 28, 2023
@thekaveman thekaveman changed the title Parameterize database path deletion Parameterize database path and deletion Oct 28, 2023
@thekaveman thekaveman self-assigned this Oct 31, 2023
@thekaveman thekaveman linked a pull request Nov 1, 2023 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back-end Django views, sessions, middleware, models, migrations etc. docker Application container, devcontainer, Compose, etc. infrastructure Terraform, Azure, etc.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant