Cloud Foundry
Dotnet Core Entity Framework Migrations on Cloud Foundry
Run database migrations on Cloud Foundry using a task to ensure that migrations are only done once on deployment (and not during app start up!) for dotnet core applications. This post assumes you are deploying built applications and not raw source code.
Instead of depending on dotnet tooling (dotnet-ef
), leverage the built-in migration capability of the DataContext. Interrupt the startup procedure when a special argument is passed in, instead of starting the web application, run the migrations and then exit.
So here we go, to start we need a DbContext:
Let's talk containers
A recent talk by one of my buddies at ITQ sparked something and I thought I’d share that with you. It’s about containers and where they sit in a software developer point of view.
The platform stack
The thing that caused the spark was this image:
Here we have a rough outline of the platform abstractions we currently see in the wild. Let’s start at the bottom.
Cloud Foundry configuration with SteelToe
I’ve been playing around with the SteelToe framework for .net apps on Cloud Foundry a bit and it’s been nice overall (I’ll probably write a few more posts about it at some point 😊). While playing around with it the configuration part of it I wasn’t really liking the way settings can be read from the main configuration.
Let’s start with a really short primer on how the configuration system works. Cloud Foundry apps can be bound to services, doing so adds a reference to the bound service in the environment variables of the app that was bound. You can take a look at what is provided to an applications environment by running
ASP.NET Core logging on Cloud Foundry
All apps I’ve ever worked on have some sort of logging going on for various reasons, mostly to keep track of whats going on or debugging, but it’s all the same. Logs are needed to see what your code is up to.
Cloud Foundry is very explicit about how an app should write its logs. As you can see in the documentation, apps must write to stdout
or stderr
.
For C# that means we can use the static methods on the Console
to write our logs. Couldn’t be easier. But… now our code is littered with these Console.Write...
lines all over the place!
Pivotal Cloud Foundry Certified Developer
With all the knowledge built up for my CFCD exam I did earlier I took another Cloud Foundry exam. The Pivotal flavor this time.
Not as involved as the other Cloud Foundry exam I did but still a wide variety of questions. I’m not sure if I screwed up all the Metrics questions, or that there was only 1 that I got incorrect.
Still really happy with the result.
Cloud Foundry Certified Developer
Hey look, I got certified in something :-)
After a good few nights of self-paced training and practice over at Pivotal I felt confident enough and took the CFCD exam. As you can see above, I passed!
RabbitMQ with NodeJS on Cloud Foundry
I’ve been having some more fun with Cloud Foundry deploying Node apps and wanted the apps to communicate in a more disconnected way. A messaging system is a good fit for such a requirement and lucky for me, (Pivotal) Cloud Foundry has RabbitMQ-as-a-Service for me to use.
So what are we working with? The code is Javascript running on Node, RabbitMQ for the messages and Cloud Foundry is hosting it all.
My first ASP.NET Core app on Cloud Foundry
Today I tried to deploy a .NET Core web app to a Pivotal Cloud Foundry platform that my ITQ buddy Ruurd set up for us to tinker with. The app itself is a very basic ASP.NET MVC app built with the new ASP.NET Core framework to make it cross-platform. It being cross platform makes it very easy to deploy on something like Cloud Foundry since there is no dependency on Windows or the full .NET Framework anymore.
Cloud Foundry Summit 2015 Berlin
On the 2nd and 3rd November in 2015, the Cloud Foundry Foundation held the Cloud Foundry Summit in Berlin. The focus of this conference is on Cloud Foundry itself and the community around it.
ITQ (my employer) is focussing on Cloud Native apps and let a small group including myself attend the conference. After a canceled flight due to fog and a 650km roadtrip with my co-workers Ronald and Ruurd we arrived at the hotel at 2am in morning just in time for the first workshop.