-
Notifications
You must be signed in to change notification settings - Fork 7
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
Improve Multi-Instance Docker Support and DB Restoration Fix #47
Improve Multi-Instance Docker Support and DB Restoration Fix #47
Conversation
This will add a .env file to each Docker project that specifies a DB_DIRECTORY. This environment variable will specify a new directory on /var/opt/mssql/host_data/ within the container so that the DB may persist when adding other docker projects of type mssql/server:2019-latest.
If the container and its network are deleted, then the databases will be dropped. So when `docker compose up` runs again to create the containers, then the `CREATE DATABASE` command won't work since there is already a .mdf/.ldf file existent. This is why the `FOR ATTACH` command is needed in this case if the files already exist.
Based on my PR here: episerver/content-templates#47
Thank you for this contribution. Before we can merge this, we need make this work a bit better with the templating system;
|
Fix in response to episerver#47 (comment). See https://learn.microsoft.com/en-us/dotnet/core/tools/custom-templates for information on custom templates.
@JohanPetersson I apologize for my late response to this. The recent commit 182b656 should update the code according to your recent comment. For the empty commerce template
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested all templates now. Everything looks fine when the proposed changes I added now are in place. Thank you so much!
This will also fix the DB directory for the empty commerce template to be the variable of the project name
5d0b43e
to
4a9d57c
Compare
@JohanPetersson Sorry again for the late response, I was out on vacation. Fixes to the recent change requests are in 4a9d57c. Since I accidentally removed the newlines from the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much again for your contribution!
This PR will accomplish two tasks:
The ability for multiple Optimizely Docker projects to be created without storage conflicts in /var/opt/mssql/host_data
The ability to restore pre-existing databases from .mdf & .ldf files on
docker compose up
docker compose up
runs again to create the containers, then the plainCREATE DATABASE
command won't work since there is already a .mdf & .ldf file copied over. This commit 3ca4fc2 will check if the .mdf file exists. If so, it will add aFOR ATTACH
command to the end ofCREATE DATABASE
to restore the DB from .mdf and .ldf.