Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement Continuous Delivery with DNX and ASP.NET 5

I have been working on .net platform for few years now and I must say I am very impressed by how Microsoft is making .net cross-platform compatible.

I spent hours trying to run a small hello world application built using CoreCLR on a mac. And it worked. While There are still a lot of UNKNOWNS I am still trying to understand, there is this one question I was not able to find answer of on google.

How do you automate the deployment a dnx application. I mean, do you compile your aspnet 5 app into a nuget package and then restore it on your linux server (I have never used linux so not sure how nuget works there), and run dnx command ? Or just zip it and push it to the server directly ?

Sorry this is all very new to me and so my questions might sound stupid. I just want to know what's the best way I can implement continuous delivery for my asp.net 5 applications. My ultimate goal is to host my apps on linux containers.

like image 890
Bilal Fazlani Avatar asked Dec 09 '15 08:12

Bilal Fazlani


1 Answers

You can use dnu publish --runtime <name of runtime> --no-source. That creates a folder that has your application, its dependencies, and the runtime. Then, all you have to do is get that folder on your server.

How you move files around really depends on your scenario... It could be FTP, Storage, Kudu (if you're on Azure WebSites), etc.

Another alternative is to do the restore on the server. While this reduces the size of the application when you publish, you will have to restore packages on the server which can be insecure and it can also lead to application breaks because there might be newer, incompatible packages on the feeds.

While there's no right answer to fit all, I found that if you want to most reliable and consistent results, you should publish with everything, test locally and then just copy the bundle on your server.

For docker, I recommend the same thing. Publish with runtime and no sources and create a container that has the resulting folder.

like image 53
Victor Hurdugaci Avatar answered Sep 28 '22 16:09

Victor Hurdugaci