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

Improve the docker build to use the release configuration and allow splitting off the database/web front end to allow scaling #96

Open
SeanFarrow opened this issue Sep 9, 2018 · 4 comments

Comments

@SeanFarrow
Copy link

Having just looked at the dockerfile, I wondered whether there was a reason why it built BaGet using the debug configuration.

Also, is there a reason tests aren't run during build?

Finally, it would be nice to split the web frontend and database in to separate containers using docker compose for scalability.
Happy to submit pr's to do this.

@SeanFarrow SeanFarrow changed the title Improve the docker build to build a release build and allow splitting off the databased/web front end to allow scaling Improve the docker build to use the release configuration and allow splitting off the database/web front end to allow scaling Sep 9, 2018
@loic-sharma
Copy link
Owner

loic-sharma commented Sep 10, 2018

Hey there! BaGet's Docker integration could definitely use some love. BaGet's Docker image is pretty much unusable for production environments.

... it would be nice to split the web frontend and database in to separate containers using docker compose for scalability.

This would be awesome.

... why it built BaGet using the debug configuration.

BaGet creates its database at startup if it is run debug mode (see this). Today, the Docker image uses this feature to create its database. This is an ugly hack that should be removed. Instead, the database should be created when the container is created.

Also, is there a reason tests aren't run during build?

The tests are run on each commit by the Travis CI configuration. Is the idea to run the tests while creating the docker image? If so, what are the added benefits to doing this?

Happy to submit pr's to do this.

That'd be great! I'm no Docker expert and I'd appreciate any help 😄

@SeanFarrow
Copy link
Author

@loic-sharma,

Ok, what database do we want to use in development, I'm assuming people will be running on .net core, therefore I'd suggest either PostGres or sql server on Linux, with a preference to the former!
We should probably disable database creation and have an SQL script created during build using the .net cli.

The idea is definitely to run tests during Docke image creation, it means hat local and CI ae in step with each other--currently you are assuming the tests have been run locally, which in my view is a bad idea!

Once we've decided on a database, I'll start creating docker files. We will have 3 containers locally, one for the database, one for the API and one for the frontend.

@loic-sharma
Copy link
Owner

Ok, what database do we want to use in development

I'd suggest either PostGres or sql server on Linux, with a preference to the former!

BaGet has been ported to SQL Server and SQLite, so we should stick to those. For now, I recommend using SQLite for development and SQL Server for production. I'm definitely open to porting BaGet to more database engines though! 😄

We should probably disable database creation and have an SQL script created during build using the .net cli.

You can create the database manually by following these steps:

  1. Install .NET Core
  2. Navigate to src\BaGet
  3. Update appsettings.json with your desired database configuration
  4. Run dotnet ef database update

@tomzo
Copy link
Contributor

tomzo commented Sep 30, 2018

I will soon create a docker image which uses published release configuration. The backend database type will be indicated by environment variable. By default it will be sqlite.
If database does not exist in expected location then it will be created on container start.
Then I will setup e2e tests with such image.
Later we can extend those to include other databases, as long as they can run in docker.

tomzo added a commit to ai-traders/BaGet that referenced this issue Oct 1, 2018
tomzo added a commit to ai-traders/BaGet that referenced this issue Oct 1, 2018
tomzo added a commit to ai-traders/BaGet that referenced this issue Oct 1, 2018
tomzo added a commit to ai-traders/BaGet that referenced this issue Oct 1, 2018
tomzo added a commit to ai-traders/BaGet that referenced this issue Oct 4, 2018
tomzo added a commit to ai-traders/BaGet that referenced this issue Oct 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants