Posts

Showing posts with the label devops

Creating code first database delopyment - Migrate.exe and VSTS

Image
Creating database deployment. My case is EF 6 (in core there would be also possibility to create sql script great article here ) It should be so simple. As a developer you just go to Package Management Console and run Update-Database. Everything is just happening. Well not that everything. You have to set default project to project that should be use to find your code first migrations.  You have to set startup project to one that contains config file with database connection string.  And you have to have valid connection string If you don't have the startup project set right you get 'enigmatic' exception, that I will address later. System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, ...

DevOps gibberish

Image
DevOps is like a dirty word in programming world. It supposed to be a bridge between developers world and the IT Pro's world, between creating code and building infrastructure/ deploying code and application. I think first problem here is that developers think of themselves as artists, creators in the pure beautiful way, the way they don't ever have to deploy theirs  solution anywhere.

Set output variable in a Powershell VSTS Build Task

Image
I have value in my artifact files. I set it in  this post . So now I can use it. I will get it almost the same way - using powershell.

VSTS build variable publish as artifact

Image
Powershell is a powerful tool. It's easy to create file in the fly, read from file, call some API. It's easy and flexible. I decided that I want to use all those tree operations in one of my VSTS pipelines. The scenario is: - take variable filled while build queuing - write it's value to text file that will be available as artifact - use artifact file value (read the file) - set Release variable with file content - use release variable for API call (or any other use).

Azure and Java resources shelved for later use

Image
I had a plan to create few posts about Azure related with Java and my work at one clients application. Here is the full Azure and Java story . I've created quite a lot of App Services in a process (it never work the first time I try to record it) and now all those resources are eating my virtual MSDN money! I could delete all of them. But if I wanted to come back some day and continue this story? I decided that I need to archive this structure.

Azure post deployment scripts

Image
Let's do a trick. After deploying application (that was easy with Ftp or Git ) it would be nice to take some action. For example send an email, or write release notes to release page. I will do much fancier thing - I will write some text to console output.

Azure deploy. Local Git Repository

Image
Besides FTP there are other ways to deploy application to App Service. You can read more here . It was not so clear for me from the official explanation. I really thought that it's about the local repository based somewhere in my company's basement. But it turns out that this is repository local to Azure. It's fully functional git repository. You can see the history of my commits as example.

Azure Tomcat 7. Release

Image
Release the Kraken! Finally that I have ready infrastructure and I've shown the internals through Ftp, I can make the release. Release definition you can find here . This is very simple definition because it contains only one task -> copy WAR file to Azure using Ftp.

Azure and Java. The build

Image
Backstory I already told so now some pure devops. The Java Hello World. I found first site that was simple index page with greetings. I forked it and added my own text just to be sure that's the page I'm looking for. You can get the repository here . Creating build definition is very simple because it's almost whole template. The only thing I change is removing restriction on published files types. I want to use .war not .jar in future release definition. Ready definition you can get here , or create it like shown below. Additionally I also created Hello World Asp MVC application and build for it. I will use it as side by side solution to show more options. Repo and build definition .

Unit Tests and VSTS. How to configure team services build with different testing frameworks.

Image
Configuring build just to check if code is compiling - it's boring and obvious, just create build, choose repository and add build solution task. That's it. This kind of build is useful for checking code integrity eg. after automatic merge. But it's much better to have also unit tests and run them, you can be more or less sure that when tests are green then the merge didn't broke anything vital.

Visual Studio Team Services - VSTS in few word

GitHub is great. I have a GitHub account and I'm planning to share all source code for this blog on GitHub, especially that public repoes are free on GitHub. But I also have a Vsts account, well to be honest a few of them for different purposes, but in the end one is my main directory and others are just for fun, experiments or other strange stuff. Why I don't have all in GitHub? Vsts has no capacity restriction on it's content so I can have everything there, and the most important detail is that Vsts is free and it is private. No one not-invited can see my code collection, and not all code should be public. I also store file like old emails that felt right to be archived somewhere, or some documentation file related to very old projects like my master thesis (this really should not be seen by public anymore :D ). This is my private space for all my code at least since 2012.

Azure stories. Azure and Java

There's always a story to tell behind the stage, and this is one of many why I like VSTS ( Visual Studio Team Services ).  Recently I was working with a client trying to find the best cloud architecture for their project.  The small problem was that they we're writing in Java and I am a Microsoft Technology Stack, so the first problem I encountered was how to start because I know 'something' about cloud and azure but I don't know how to proceed with web applications wrote in Java. The easiest way is to Google something... but Googling something isn't enough because you can Google only the source code and you need something up and running ready to show.  The running something is the biggest problem here - how I can build Java, how to test it. So I have some skills in DevOps in VSTS, i love VSTS and i like creating Continuous Integrations on it.