Stop application if db version is wrong - flyway

I have an web application that runs in JBoss and i use FlyWay in command line mode to migrate between database versions.
I want integrate Flyway in to my application using Spring Framework and only stop the deployment in to the web server if the db version is wrong. Is this possible?

First of all, I strongly recommend migrating the database on application startup so a mismatch can never occur.
If this is not an option, you can implement custom logic to check the results of Flyway.info() against the desired version.

Related

Application Insights picks up SQL telemetry locally but not in a real environment

Generally I've had pretty good luck with Application Insights' auto-detection of a SQL dependency. However, in a recent case where we added Application Insights to a Web API project, we are not seeing dependency tracking for SQL Server in the portal. Version info:
Application Insights 2.5.0
Entity Framework 6.x
.NET 4.5.2
The funny thing is that Azure will automatically pick up SQL calls when developers are using the debugger from Visual Studio. What do we need to do to capture timings for SQL calls on a real environment?
Thanks,
BGU
The solution was to upgrade the Web API project to a more recent version of .NET (4.6 or higher). Good luck out there.
https://learn.microsoft.com/en-us/azure/application-insights/app-insights-monitor-performance-live-website-now
Dependency diagnostics like full sql command text will be available in Application insights only at runtime. If web api project is hosted on IIS server, then try integrating your web application virtual directory to app insights resource using status monitor. Once you do that, it will push full sql command text to d app insights portal.Comparison Build time and run time integration

Deploying ASP.NET Core solution with class library to Azure

I'm working in VS2015 and have a ASP.NET Core solution with two projects - an API Web Project and a Class Library that holds all the data entities, context and Entity Framework migrations. The API project references the class library and all works well on my local machine.
I now want to deploy the solution to Azure and this is where I'm hitting the problem. If I right click on the API project and go through the Azure App Service publish wizard, on the Settings tab I expand Databases and the message is "No databases found for this project" - which I'm guessing is because it can't find a context as it's not in this project.
If I do the same on the CL project though, there is no Azure App Service deployment option, the only option is File System and clearly there's no option to create the database there either.
So, in summary, my question is how I can deploy this type of solution to Azure and have the database created and migrations applied?
I think you need to create the DB first in the azure and then try to publish your application through the wizard. The database is on your local machine and the application will work just fine on your local environment. But on the cloud you have to first create the database on Azure SQL. Then you need to get the SQL connection string from the portal and update your config file accordingly. Once this is done you can then publish your application from Visual Studio. Please note that the wizard will still not show you the databases, but the application, when configured properly will run fine.

Application Insights - No data for dependency duration

I am not getting data for any dependency calls (Azure SQL calls) in one of my clients' Application Insights which is running an Azure Web App. Initially, I thought the application is on older version of .Net (4.0), and then I created a sample Azure Web App with the latest ASP.NET 5 template with Azure SQL as database. Even for this one, no dependency call related data in Application Insights. Both the applications have been deployed successfully in Azure and I am checking the Application Insights data in the Azure portal. Any clue what is going on ..where should I check?
Please make sure you have Microsoft.ApplicationInsights.AspNet v.1.0.0-rc1-update3 installed (not that 1.0.0-rc1 that is default with VS2015). v.1.0.0-rc1-update3 should also install Dependency Collector module, so you should have HTTP/SQL dependencies collected by default for full framework. Just verified this is the case.

Running DNX (EF7) database migration on Azure

I've been running a MVC project with ASP.NET 4.6 and EF7 locally and everything works fine. I ran the dnx . ef migration Initial commands to create the database tables, and everything ran fine. The app works.
With Azure I have one problem, I can't seem to run the dnx . ef migration command so my SQL database is empty. I've debugged Startup.cs and the connection string is correctly retrieved, but the tables are not there.
I used the Publish option in Visual Studio 2015 to deploy to my Azure Web App.
How can I run this command on my web app? Is there another way to generate the database?
Thanks
It seems that the EF team has eliminated the infamous database initializers and offers a more versatile method for that on version 7.
Just use these methods in the pipeline before any call to the database,
yourDbContext.Database.EnsureCreated();
to create the database in case it doesn't exists and
yourDbContext.Database.Migrate();
to apply migrations (if you use this feature later). Both methods above also have an asynchronous version.
In my solution I have created an static class that I use to initialize the database and seed it with some data. I call the Seed method from the Configure method in the Startup class when some condition is met.

What is a good way to deploy ASP.NET MVC applications to IIS?

My team works on a couple of ASP.NET MVC 2 applications, hosted on IIS 7 with an Oracle database. We do our database migrations manually and publish our projects directly to the web servers using Publish to File System in Visual Studio 2010.
Are there any best practices on how to release to test, stage and production environments directly from TFS? We would love to be able to automate our releases completely, including database migration scripts.
The preferred way to perform deployments these days seems to be WebDeploy. I believe this can be integrated into TFS, although we don't use TFS so no experience with this yet. WebDeploy is fully extendable with it's provider model.
You could use WebDeploy as a build task like TheCodeKing says. It works fine, we do it in our project and deploy to a dev-server and a test-server like that. The build definitions are available in the VS Team Explorer and every team member can push a build to Dev or Test.
For the database you could use the Data Dude features (or another schema compare tool) and run it via a TFS Build task (TFS 2010 supports database projects) or via the command line to compare and upgrade the database. This is of course dependent on you using the database projects.
Yes you will use web deploy for details information and step by step guide see the following post
http://mohamedradwan.wordpress.com/2010/10/23/auto-deploy-your-website-for-qa-with-team-build/
Thanks
M.Radwan

Resources