I want to implement CI and CD for website with database (on Azure).
Tools:
SSDT (project database)
C#
VSTS (Visual studio team services)
EF6 (entity framework 6)
Azure SQL database
The aim is a full Continuous Delivery even with the database (Hardest part).
For the website, CD is pretty much easy with VSTS. But about the database, I can't find a clear way how to proceed.
So by some readings I plan to :
Use SSDT to manage the Database. VSTS build, use dacpac of the database projet to generate by itself by schema comparison to update the database. I'll just write sql script for data motion.
Use EF6 and "reverse POCO code first generator" link
To be 100% Continuous Delivery, I can't stop the service, even during database schema modification.
So I read that database update has to be compatible with previous deploiement (DAL of running website). So all database schema modification will be in to 2 steps, in two deliveries. The Second delivery can be only when the 1 step is delivered.
So rules should be
Rename a table is not allowed
Rename a column is not allowed
Add column
1 Step
Add column in SSDT with default value
Add property to entity class
2 Step
Remove default value on the database
Remove column
1 Step
Remove column on entity
Add default value by SSDT
2 Step
Remove column by SSDT
I'm pretty sur, that I'm reinventing the wheel, but I can't find a complet tutorial.
Am I on the good way ? Is there something out the box solution in microsoft world ? I'm ready to learn. Thank you
You can deploy database to azure through Azure SQL Database Deployment step/task in you build or release. Also, you can deploy your app to Azure through VSTS Build or release.
For example:
Add an Azure Resource Manager
Create a build definition on your VSTS
Add Visual Studio Build step to build database project and it will generate dacpac file.
Add Azure SQL Database Deployment step to deploy database to azure via dacpac file (step 3)
Add Visual Studio Build step to build your app project
(optional) Add Azure App Service Deploy step to deploy your app (web) if needed.
(optional) Go to trigger and check Continuous integration (CI) to queue build for each check-in
There is a related article (follow up its workflow, it uses Azure Classic, you could use Azure Resource Manager).
Related
I am looking for some .Net code sample or any .Net library using which I would like to build a small tool to automate my activities like I can connect to Sql Azure . Once I get connected I would like to deploy my database(mdf & ldf file) to the remote sql azure server .Once the deployment gets completed I would like to create a login and respective user for the deployed databases and assign them required permissions respective to databases . Currently I am doing all these activities from Management Studio but I want to create a tool which would does all these activities on a click of button . I would define a step by step template for all my activities and this tool will execute each step .
I tried looking for libraries but didn't find anything useful . Now I have no idea where to start so Please help me as I am a novice to these type of stuffs.
Visual Studio does all of this via its Database Project template. It will either update the target directly, or generate a script which you can execute. Also remember the OSQL command line version of Management Studio for doing batch script execution.
The Best Solution in this case will be to use Visual Studio Release Management.
In Release Manager you can create workflow to execute Deployment Tasks. If you have a Database project which produces a DACPAC, you can use Azure SQL Database Deployment task in Release Manager to deploy the Database to SQL Azure. More Details can be found here
https://www.visualstudio.com/en-us/docs/release/examples/azure/azure-web-apps-and-sql-db
With Azure, you can't just copy the local mdf file. If you need to migrate schema and data, the easiest way to migration from local Sql Server to Azure, is to export the database to a BACPAC file, and then import that file back into azure. migrate bacppac file.
After you've create your database and populated, use the Azure portal or Sql Management studio to create additional logins.
I have a website built with ASP MVC5.
Also I use Entity Framework 6 with Database First approach and edmx.
On production I already have database with a lot of data.
I'm using TeamCity for CI and would like to perform auto deployments.
I found Web Deployments and also tried to configure Publish profiles.
But 1 have some questions:
1. What about database? how to migrate, upgrade schema and data automatically? Are there any tools for that?
2. Could you describe how publish via Web Deploy works? I see connection string definition, etc. How it copies files to remote box, and how applies DB (schema, data migration?)
3. Also I configured IIS website for FTP upload deployment. How it connected with previous cases?
I want to create a setup file for an application that uses the following tools and technologies:
Microsoft visuals studio 2013
MSSQL server 2012
and I have used winforms and C# to write the program.
My questions are:
If I want to deliver the application to customer without giving out the source code what technique or tool should I use?
How do i supply the database? Should I detach it? How do I provide the database with my application?
I'm assuming you need to deploy the application you've created with Visual Studio rather than deploy Visual Studio itself. In which case you have a variety of options depending on its destination.
You can just copy your executable and required dependencies to a destination without distributing your source. However, there are several tools out there that will subsequently disassemble your assemblies to reveal the source.
The Visual Studio website has a list of options for deploying applications. If you want a tradional Next -> Next -> Finish type of installation, I would suggest using InstallShield Limited Edition.
For SQL deployment it would depend on the Edition you have used and whether the server already exists at the destination. Additionally, it will depend on whether you only need to deploy the schema or populate the database too.
You can distribute SQL Server Express with your application. SQL Server Management Studio will allow you to generate a "CREATE DATABASE" script (right-click database -> Script database as -> CREATE to -> File) from your existing database that can be executed as part of the installation. Alternatively, consider a backup/restore approach as detailed in this article.
I created a WPF C# application and using entity framework to connect to an SQL database, and read write data to it.
My application have multiple library projects and the main project that contains the UI.
I want to build the application in order to sell it. I want to have something similar to a normal application, where you have a main exe executable and .dll diles that represent the other projects and libraries used.
I also need to have a setup file that will setup the application as normal applications do.
How can I do that?
Will I have to do something with the SQL database in order to build with the project or that is done automatically?
If you have VS2010 you can use VS2010 based "Setup and Deployment" project template to create a Setup project and chose any of the given type i.e. CAB with Setup.exe or MSI or web Deployment which is suitable for your distribution. The UI is as below:
You can also try 3 party Installation project i.e. InstallShield etc also.
For SQL DB there are separate ways to distribute the database. If you have SQL Express or SQL CE then you can package it and ship with main project as described here. However for SQL Server, you just need to create a database deployment script and documentation about your data base first and then package it with main distribution. Or it can be done separately.
I have existing project in Visual Studio 2010, ASP.NET MVC 3 with existing database using .mdf (SQL 2008 Express). After doing some googling, I got confused because there are so much resources. Could you help me pointed me out the straightforward tutorial link?
First of all it is large question and you will have to work in parts to get everything done. The following steps are written with understanding that you do have Windows Azure subscription and have basic understanding of ASP.net, MVC, SQL and VS2010.
Step 1: Install Windows Azure SDK 1.6
http://go.microsoft.com/fwlink/?LinkID=234939&clcid=0x409
Step 2: After that, open your MVC3 application and when you right click on solution you will find a new option as "Add Windows Azure Deployment Project", select it.
You will see a new Windows Azure project is created in your solution name your_application_name.Azure (default) is created. At this time if you make Azure project as your "Startup" application and run it, your MVC3 application will run inside Windows Azure Compute Emulator. Lets the SQL server related code intact and your code actually will work with existing SQL server.
Step 3: Verify your code for any problem and fix it. Be sure to test in Compute Emulator and this is the time please learn about Service Configuration and Service Definition with your Windows Azure project.
Step 4: Once you have your MVC3 application working in compute emulator, go ahead and just replace SQL server to SQL Azure. Follow the step by step details here:
http://msdn.microsoft.com/en-us/hh285881
Step 5: Once your SQL Azure is configured you just (ONLY) need to change your Connect String in web.config, pointing to SQL Azure.
http://msdn.microsoft.com/en-us/library/windowsazure/ee336282
Step 6: Now if you run your MVC3 application in Compute Emulator, you can verify that it does connect to SQL Azure and verify all is well.
Step 7: Finally now package your application and deploy to Windows Azure for deployment and final test. The step by step details are located here:
http://msdn.microsoft.com/en-us/spazuretrainingcourse_introtowindowsazurelabvs2010_topic4#_Toc297905245
Step 0: If you have time I would suggest you to finish this exercise first as described in the link below to understand most of the basic information about MVC, ASP.NET Web Role, SQL Azure and Deployment process:
https://www.windowsazure.com/en-us/develop/net/tutorials/web-app-with-sql-azure/