Monday, August 08, 2016

Pitfalls of Continuous Delivery - Austin .Net Users Group

Jeffrey Palermo, founder of ClearMeasure.com, spoke to 35 people at the August .Net User's Group (adnug.org).






ClearMeasure has a sample solution: 
 https://github.com/ClearMeasureLabs/ClearMeasureBootcamp

My notes:
Do not set up a shared database server for the team.  It's the same as a global variable that can get hammered.
Use independent non-shared databases created from a script in source control.
To facilitate continuous delivery with no downtime, add columns to a database so older and newer version of your code can run. 
If using a database table as a shared API between systems, use a separate sharable table.
Do not put more than on application in one solution because branching and versioning are coupled.
Share code between teams via a nuget package.
Do not let a build remain broken - fixing the build is everyone top priority.
Put server configuration into version control.
Do not clone virtual machines to create a new test machine, use versioned scripts.
Everything should go in source control - except passwords.  This makes continuous delivery possible.

You should have at least three Continuous Delivery Environments
Dev environment, only used by dev team
Customer test
Production

Do not add security patches to your live servers.  Instead spin up new server, add security patches, install your software and deploy.

Puts lots of disk space in build servers so you can keep old builds for testing and redeployment.

Use SpecFlow to automate Gherkin language tests ("When I log in","When I am on the site")

PhantomJS is a headless browser that can be used so IE doesn't pop up all the time.

















Thursday, July 28, 2016

How To Export A Sql Table As A Series Of INSERT Commands in Sql Server 2012

Occasionally as developers we need to copy the contents of a database table to another remote sql server that we cannot access.  We can export an Excel spreadsheet and email that to our counter parts at the remote machine.  Another option is to create a file of SQL insert commands that will transfer the data. 
In Sql Server Management Studio right click on the database containing your table,
Select "Tasks/Generate Scripts"

 
 Skip the intro screen and then select the table to export
 

Click "Next"
 Then select "Advanced" and set "Types of data to script" to be "Schema and data" (or only "Data" depending on your needs).

 Select "OK" in the panel.  Then enter a "File  name:" and then "Next>".



Then select "Next>"

And then "Finish".
And now in your export file "~/Documents/scripts.sql" are the commands to create and fill your table.



USE [MyPets]
GO
/****** Object:  Table [dbo].[MYPETS]    Script Date: 7/28/2016 1:51:31 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[MYPETS](
    [Age] [int] NOT NULL,
    [Animal] [char](10) NOT NULL,
    [Name] [varchar](30) NOT NULL
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
INSERT [dbo].[MYPETS] ([Age], [Animal], [Name]) VALUES (1, N'Dog       ', N'Rover               ')
INSERT [dbo].[MYPETS] ([Age], [Animal], [Name]) VALUES (82, N'Turtle    ', N'Yurtle              ')
INSERT [dbo].[MYPETS] ([Age], [Animal], [Name]) VALUES (5, N'Llama     ', N'Rama                ')



Enjoy.