Due to the hardware requirements that each cluster must have a minimum of 3 servers I'd like to use that hardware to support multiple branches/environments. Specifically we generally have 3 Dev and 3 Test branches running simultaneously for an application to support multiple parallel development project. After we release to production the code gets merged back into the other braches.
I understand I can create multiple instances of an Application Type, but what I think I really need is to have multiple versions of an Application Type on the same cluster. Its very possible that development could be happening in the A and B branches at the same time. We would want to test and deploy both branches to the Dev Cluster.
Similarly I would like to use the same cluster to expose a test environment endpoint. So as the code gets promoted I could deploy a TestB version of the application, if bug fixes happen those would be fixed and deployed in the DevB Version of that Application Type.
To handle the WebAPI endpoints Port issues we are planning on having the build script chose the environment specific WEBAPI Service manifest because it contains the port number that exposes the Service Fabric application to calling applications. So i'll have a ServiceManifest-DevB.xml file that gets renamed as plain old ServiceManifest.xml and packaged up with the DevB build when it goes out. Then ServiceManifest-TestB.xml will do the same but have a different port. Another option here is Tokenizer.
But I'm struggling on how can I have different versions of the same Application Type running on the cluster? Can I override Application Type in the parameter files or something along those lines? I am really hoping I don't need to build 6 clusters for this? That's a ton of hardware which won't fly.
Please help and thanks in advance,
Greg
I had this question a year ago and had put this down. Now its back so this time I will document it!!!
I am using one cluster for both my Dev and Test environments and we use two branches for these. I needed to be able to deploy the application for these two branches under different application names.
To figure this out I followed the ps1 trail. First you look at Deploy-FabricApplication.ps1 which just passed the PublishProfile to Publish-NewServiceFabricApplication.ps1. This guy uses a method in the Utilities.ps1 called Get-ApplicationNameFromApplicationParameterFile. All this does is open the environment specific application parameter file and read it off the top:
Use this is my Dev Application Paramter file:
<Application xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="fabric:/MyAppDEVA" xmlns="http://schemas.microsoft.com/2011/01/fabric">
Use this in my Test Application Paramter file"
<Application xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="fabric:/MyAppTEST" xmlns="http://schemas.microsoft.com/2011/01/fabric">
Easy breezy when you know, and knowing is half the battle.
You can pass the desired version of an application when you create the application instance via New-ServiceFabricApplication. Just copy, register, and then new-up the application types and versions you need.
Related
I have an issue with a service worker, I have two different projects that are in the same server but in different folders, and I want to precache the files on project number 2 using my service worker (My service worker is already working on project number 1). My question is, is it possible to do this? is there any other way I can attack this? Any help is very much appreciated.
In general, yes, as long as the service worker is hosted at a URL that is at the same level (or "higher") than the root of each of those projects. That would ensure that each project will be within scope of the service worker.
I'm assuming that one of the challenges you're asking about relates to creating a precache manifest within that service worker that contains build artifacts from both projects. There are a few different ways to tackle that, but I think the most straightforward would be to ensure that you always run the build process for each project at the same time, and then when you use Workbox's build tooling to create the precache manifest, you ensure that you grab all the assets that were output by each of the projects.
The specifics of configuring that build process depends on what you're currently using. You mention that there's a service worker (presumably using Workbox's precaching) already in place for the first project, so I think just using the same build setup, with tweaks to pick up the additional assets, would be easiest.
I am not clear enough yet how Service Fabric allows deployment.
From the applications being created in a single VS solution, let me try to ask with file formats for better understanding.
In a single Visual Studio solution, there are
a single .sln
a single .sfproj
multiple .csproj(s)
As I see these files, multiple services (.csproj files) are bound to a single Service Fabric application (.sfproj file), which is under single solution file (.sln file).
Can I individually deploy a .csproj project to the Service Fabric cluster, or are these now bound to a .sfproj so that I have to deploy multiple services (each created with .csproj and bound to .sfproj) together?
The answer to your question is yes and no at the same time. Let me explain it in detail.
Can I individually deploy .csproj project to the Service Fabric cluster
The answer is no you can't deploy a service - in term of Service Fabric the minimal unit of deployment is the application (the .sfproj one). So no matter what changes you have you still need to deploy the application.
But as we all understand performing a full deployment of all application services is very hard, consumes lots of time and causes lots of disturbance to the cluster. To avoid this massive update, all Service Fabric components have their own versions (you can take a closer look at ServiceManifest.xml and ApplicationManifest.xml). So each time application is deployed to the cluster, Service Fabric goes through all services included in the application and updates only components that have been changed (i.e. have different version).
This approach allows you to perform updates of very high granularity i.e. you can update only <Config /> package of the single service.
I have introduced branching/merging to my team and have talked before about how it would be great to automatically build and deploy code checked into the staging/master branches, but I'm a junior dev, not very ops-y.
The trouble I'm having, is that we create intranet applications and store them on our own VM's which we have access to, but we also have load balancing which is causing me grief!
I can get a build to automate (well, I haven't got all the bugs figured out but I'm working my way through them) - and I can even get the build to automatically create a zip file ready for deployment.
Is it possible to configure several servers for deployment?
I.E
1) I check in some code to stage
***Automatically***
2) Code builds
3) Build completes, Unit tests run and they complete
4) Code is packaged into a .zip
5) .Zip is deployed across the three load balancing servers (all with the same file path).
***
Maybe worth noting we currently have our TFS server running Visual Studio so the code is built on the same server it is all stored, but this is not the server we run live code from.
Any help or tutorials specific to my setup would be GREATLY appreciated, I really want to turn this departments releasing strategies around!
I am going to address only the deployment aspect. There are a lot of different ways that this can be handled, such as:
Customizing the build template
Writing custom .Net code and inserting it into the build template (which would also involve customizing the template)
Creating a Batch or Powershell script set to run after the build completes
Using a separate tool such as OctoDeploy or Release Manager to handle the deployments
The first thing you need to do is separate the build and deployment steps in your head. While they are tightly coupled in your model, they are two totally different tasks that need to be handled different ways.
The second thing is to stop thinking like a developer when it comes to the deployment portion. While there will likely be a programmatic solution, you'll need to identify the manual steps first.
You stated that you're not very ops-y, by which I assume you mean you're more Developer and not Systems Analyst. If that is the case, then the third thing you'll need to do is get someone who is involved, such as your current release team.
There are 3 major things that need to be done then:
EVERYTHING needs to be standardized. If you can't standardize something, then standardize the way that it's non-standard (example: You have a bulk list of servers you need to deploy to, and you need to figure out which ones to deploy to based on their name, which can be anything. In that case, a rule needs to be put in place that all QA servers need to have QA in their name, User Acceptance servers need UAT, Production need PROD, etc.).
Figure out how you're going to communicate from the build to the deployment, which builds are going to deployed, to which servers, and where the code is going to be picked up from
You need to document every manual step, and every exception to those steps, and every exception to those exceptions.
Once you have all those pieces in place, you need to then go through each manual step and automate it, whether that's through Batch, Powershell, or a custom-built application. Once you have all the steps automated, you'll have both the build and deploy pieces complete.
After you're able to execute a single "manual" automatic deployment to a single environment, you're then ready to figure out how you want to run it for multiple environments. This can be as complex as an XML file that is iterated through, to simply calling the same command multiple times with different parameters.
A quick summary of how I've done this at my current job (where using a third-party deployment tool was not an option):
Created a tool using .Net WinForms to allow us to "manually" run automated builds (We use the interface to determine the input parameters, and the custom classes under the hood do all the heavy lifting. These custom classes are in a separate project that builds to their own dll. This also allows us to test tweaks and changes to the process in a testing environment before we roll it out to our production build server)
Set up an XML file for each set of environment (QA, UAT, Prod, etc.) that contains all of the servers that need to be deployed to in that environment, including destination paths, scheduled tasks, and Windows Services
Customize the TFS build template and include the custom classes created for the custom tool, which will read the XML file and iterate through each server entry to perform the deployments
I'm more than happy to help with more specific examples and assistance, I look at things a bit different than most people and it helps when it comes to release management.
I have a question regarding azure deploys. My specific scenario is that I would like to deploy N projects on the same WebRole / WebSite.
The solution (don't think only as a visual studio way of organizing projects) will involve 1 web service (that could be scaled-out later) and N web sites (that also could be scaled-out later)
Because right now my traffic is very low I was planning to deploy the web app on port 80 (of course) and the web services on say port 5000 of the same instance to save some money.
What i can't figure out right now is how to do this... in the end i have 2 questions:
-1: Can I deploy multiple projects in a single instance? (this question is similar but is not straighfoward... I was hoping for a more direct answer...)
-2: How?
EDIT: Don't get this question wrong! I do not want to create a azure web role project in VS 2012 and "Add" the 2 minor projects... i want to create 2 projects completaly independent... 2 separated solutions... separated deploys (ex: I want to correct a bug in the service without updating the web-site!)
Am I being clear? if not just say and I will re-explain...
Based on the edits to your question, the short answer is no, you can't have two completely different solutions that deploy to the same instance without overwriting the other. For Azure one role is the smallest unit of deployment.
You might be able to write your own auto updating code, but you'd be on your own there, there's nothing baked into the service to help you with this.
I am trying to use maven profiles and filtering in order to produce two different versions of a given web archive (war):
A first one for local deployment to my local machine on localhost
A second one for remote deployment to cloudfoundry
There are a number of properties that differ according to whether the app is deployed to my local machine or to cloudfoundry.
Of course the difficult bit is that I am trying to do all this from STS/Eclipse and deploy from Eclipse to my local tomcat and to cloudfoundry...
Can anyone please provide advice, tips or suggestions?
If you are using Spring versioning 3.1+ the "profile" attribute for <beans> in the spring bean configuration xml would be the best choice. Take a look at the doc here: http://docs.cloudfoundry.com/frameworks/java/spring/spring.html#using-spring-profiles-to-conditionalize-cloud-foundry-configuration
Basically you need to specify at least 2 elements. One for your local properties (profile="default") and one for the properties when deployed to CF. The latter one should be defined as <beans profile="cloud">. When running locally the properties within "cloud" would be ignored and properties in "default" will take effect. When pushed to CF, CF will detect the profile named "cloud" and, which is better, inject corresponding datasource connection info of the services provisioned by CF itself. You can find the detailed CF-specified properties in that doc as well.
For more information about the profile attribute, see the doc here: http://blog.springsource.com/2011/02/11/spring-framework-3-1-m1-released/
Consider having a single project per artifact generated. Hence one project generating your local deployment and one project generating your cloudfoundry deployment.
Overlays (http://maven.apache.org/plugins/maven-war-plugin/overlays.html) is the officially sanctioned way to bake in extra files in an existing WAR file, giving a new WAR artifact. Very useful but may be too slow for comfort while developing.