Permalink
Browse files

Added support for clr20 and clr40 runtimes. Bump to 1.8.0

  • Loading branch information...
1 parent 0d9763d commit 2c351801ebd4963f45302842c827131638d3723e @lukebakken lukebakken committed Sep 20, 2012
View
15 .gitattributes
@@ -0,0 +1,15 @@
+# Set default behaviour, in case users don't have core.autocrlf set.
+* text=auto
+
+# Explicitly declare text files we want to always be normalized and converted
+# to native line endings on checkout.
+*.cs text
+
+# Declare files that will always have CRLF line endings on checkout.
+*.csproj text eol=crlf
+*.sln text eol=crlf
+
+# Denote all files that are truly binary and should not be modified.
+*.exe binary
+*.png binary
+*.jpg binary
View
100 build.bat
@@ -1,50 +1,50 @@
-@echo off
-
-setlocal
-
-set VCVARSALL="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
-
-set SLN="%~dp0\IronFoundry.sln"
-set VERSION=1.7.1.0
-
-set NOCLEAN=0
-if /i "%1"=="NOCLEAN" set NOCLEAN=1
-
-if not exist %VCVARSALL% (
- echo Required file %VCVARSALL% not found.
- exit 1
-)
-
-if not exist %SLN% (
- echo Required file %SLN% not found.
- exit 1
-)
-
-rem Prevent this from being run multiple times on a dev machine
-if "%DevEnvDir%"=="" (
- call %VCVARSALL% x86
-)
-
-if %NOCLEAN% equ 0 (
- echo CLEANING...
- powershell -nologo -file clean.ps1
- echo DONE.
-)
-
-msbuild /v:n /t:build /p:Configuration=Debug /p:Platform=x86 %SLN%
-if ERRORLEVEL 1 goto build_failed
-
-msbuild /v:n /t:build /p:Configuration=Debug /p:Platform=x64 %SLN%
-if ERRORLEVEL 1 goto build_failed
-
-msbuild /v:n /t:build /p:Configuration=Release /p:Platform=x86 /p:WixValues="VERSION=%VERSION%" %SLN%
-if ERRORLEVEL 1 goto build_failed
-
-msbuild /v:n /t:build /p:Configuration=Release /p:Platform=x64 /p:WixValues="VERSION=%VERSION%" %SLN%
-if ERRORLEVEL 1 goto build_failed
-
-exit /b %ERRORLEVEL%
-
-:build_failed
-echo Build failed!
-exit /b 1
+@echo off
+
+setlocal
+
+set VCVARSALL="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
+
+set SLN="%~dp0\IronFoundry.sln"
+set VERSION=1.8.0
+
+set NOCLEAN=0
+if /i "%1"=="NOCLEAN" set NOCLEAN=1
+
+if not exist %VCVARSALL% (
+ echo Required file %VCVARSALL% not found.
+ exit 1
+)
+
+if not exist %SLN% (
+ echo Required file %SLN% not found.
+ exit 1
+)
+
+rem Prevent this from being run multiple times on a dev machine
+if "%DevEnvDir%"=="" (
+ call %VCVARSALL% x86
+)
+
+if %NOCLEAN% equ 0 (
+ echo CLEANING...
+ powershell -noprofile -nologo -file clean.ps1
+ echo DONE.
+)
+
+msbuild /v:n /t:build /p:Configuration=Debug /p:Platform=x86 %SLN%
+if ERRORLEVEL 1 goto build_failed
+
+msbuild /v:n /t:build /p:Configuration=Debug /p:Platform=x64 %SLN%
+if ERRORLEVEL 1 goto build_failed
+
+msbuild /v:n /t:build /p:Configuration=Release /p:Platform=x86 /p:WixValues="VERSION=%VERSION%" %SLN%
+if ERRORLEVEL 1 goto build_failed
+
+msbuild /v:n /t:build /p:Configuration=Release /p:Platform=x64 /p:WixValues="VERSION=%VERSION%" %SLN%
+if ERRORLEVEL 1 goto build_failed
+
+exit /b %ERRORLEVEL%
+
+:build_failed
+echo Build failed!
+exit /b 1
View
2 src/IronFoundry.Dea.Service/App.config
@@ -11,7 +11,7 @@
Set localRoute to a value other than 127.0.0.1 if you have multiple NICs and are not sending the correct IP to the Nats Host (unlikely)
natsUser and natsPassword attributes must be present even if empty for installer to work.
-->
- <ironFoundryDea natsHost="192.168.171.129"
+ <ironFoundryDea natsHost="10.91.2.37"
natsPort="4222"
natsUser="nats"
natsPassword="nats"
View
4 src/IronFoundry.Dea/Agent/Agent.cs
@@ -199,7 +199,7 @@ private void ProcessDeaStart(string message, string reply)
if (filesManager.Stage(droplet, instance))
{
WebServerAdministrationBinding binding = webServerProvider.InstallWebApp(
- filesManager.GetApplicationPathFor(instance), instance.Staged);
+ filesManager.GetApplicationPathFor(instance), instance.Staged, instance.ManagedRuntimeVersion);
if (null == binding)
{
log.Error(Resources.Agent_ProcessDeaStartNoBindingAvailable, instance.Staged);
@@ -277,7 +277,7 @@ private void ProcessDeaDiscover(string message, string reply)
log.Debug(Resources.Agent_ProcessDeaDiscover_Fmt, message, reply);
Discover discover = Message.FromJson<Discover>(message);
- if (discover.Runtime == Constants.SupportedRuntime)
+ if (Constants.IsSupportedRuntime(discover.Runtime))
{
uint delay = 0;
dropletManager.ForAllInstances(discover.DropletID, (instance) =>
View
42 src/IronFoundry.Dea/Constants.cs
@@ -1,24 +1,60 @@
namespace IronFoundry.Dea
{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
using System.Net;
public static class Constants
{
public const string FilesServiceNamespace = @"http://ironfoundry.org/dea/filesservice";
public const string MonitoringServiceNamespace = @"http://ironfoundry.org/dea/monitoringservice";
- public const string SupportedFramework = "aspdotnet";
- public const string SupportedRuntime = "aspdotnet40";
-
public static readonly IPAddress LocalhostIP;
public static int[] MemoryLimits = new int[6] { 64, 128, 256, 512, 1024, 2048 };
private const string localhostStr = "127.0.0.1";
+ private const string aspDotNetFramework = "aspdotnet";
+ private static readonly IDictionary<string, ushort> runtimeMap = new Dictionary<string, ushort>
+ {
+ { "aspdotnet40", 4 },
+ { "clr20", 2 },
+ { "clr40", 4 },
+ };
+ private static readonly string[] supportedFrameworks = new[] { aspDotNetFramework };
+
static Constants()
{
IPAddress.TryParse(localhostStr, out LocalhostIP);
}
+
+ public static bool IsSupportedRuntime(string runtime)
+ {
+ return (! String.IsNullOrWhiteSpace(runtime)) && runtimeMap.ContainsKey(runtime);
+ }
+
+ public static bool IsSupportedFramework(string framework)
+ {
+ return (! String.IsNullOrWhiteSpace(framework)) && supportedFrameworks.Contains(framework);
+ }
+
+ public static string[] SupportedRuntimes
+ {
+ get { return runtimeMap.Keys.ToArray(); }
+ }
+
+ public static bool IsAspNet(string framework)
+ {
+ return aspDotNetFramework == framework;
+ }
+
+ public static ushort GetManagedRuntimeVersion(string runtime)
+ {
+ ushort rv = 0;
+ runtimeMap.TryGetValue(runtime, out rv);
+ return rv;
+ }
}
}
View
9 src/IronFoundry.Dea/Properties/Resources.Designer.cs
@@ -645,5 +645,14 @@ internal class Resources {
return ResourceManager.GetString("WebServerAdministrationProvider_AppCmdFailed_Fmt", resourceCulture);
}
}
+
+ /// <summary>
+ /// Looks up a localized string similar to Invalid managed runtime version: {0}.
+ /// </summary>
+ internal static string WebServerAdministrationProvider_InvalidManagedRuntimeVersion_Fmt {
+ get {
+ return ResourceManager.GetString("WebServerAdministrationProvider_InvalidManagedRuntimeVersion_Fmt", resourceCulture);
+ }
+ }
}
}
View
3 src/IronFoundry.Dea/Properties/Resources.resx
@@ -313,4 +313,7 @@
<data name="WebServerAdministrationProvider_AppCmdFailed_Fmt" xml:space="preserve">
<value>'appcmd.exe {0}' failed: {1}</value>
</data>
+ <data name="WebServerAdministrationProvider_InvalidManagedRuntimeVersion_Fmt" xml:space="preserve">
+ <value>Invalid managed runtime version: {0}</value>
+ </data>
</root>
View
3 src/IronFoundry.Dea/Providers/IWebServerAdministrationProvider.cs
@@ -19,7 +19,8 @@ public class WebServerAdministrationBinding
public interface IWebServerAdministrationProvider
{
- WebServerAdministrationBinding InstallWebApp(string localDirectory, string applicationInstanceName);
+ WebServerAdministrationBinding InstallWebApp(
+ string localDirectory, string applicationInstanceName, ushort managedRuntimeVersion);
void UninstallWebApp(string applicationInstanceName);
ApplicationInstanceStatus GetApplicationStatus(string applicationInstanceName);
IDictionary<string, IList<int>> GetIIsWorkerProcesses();
View
13 src/IronFoundry.Dea/Providers/WebServerAdministrationProvider.cs
@@ -40,10 +40,17 @@ public WebServerAdministrationProvider(ILog log, IConfig config, IFirewallServic
UnlockLogging();
}
- public WebServerAdministrationBinding InstallWebApp(string localDirectory, string applicationInstanceName)
+ public WebServerAdministrationBinding InstallWebApp(
+ string localDirectory, string applicationInstanceName, ushort managedRuntimeVersion)
{
WebServerAdministrationBinding rv = null;
+ if (managedRuntimeVersion != 2 && managedRuntimeVersion != 4)
+ {
+ throw new ArgumentException(
+ String.Format(Resources.WebServerAdministrationProvider_InvalidManagedRuntimeVersion_Fmt, managedRuntimeVersion), "managedRuntimeVersion");
+ }
+
try
{
ushort applicationPort = 0;
@@ -66,8 +73,8 @@ public WebServerAdministrationBinding InstallWebApp(string localDirectory, strin
}
cmd = String.Format(
- "set apppool {0} /autoStart:true /managedRuntimeVersion:v4.0 /managedPipelineMode:Integrated /processModel.loadUserProfile:true",
- applicationInstanceName);
+ "set apppool {0} /autoStart:true /managedRuntimeVersion:v{1}.0 /managedPipelineMode:Integrated /processModel.loadUserProfile:true",
+ applicationInstanceName, managedRuntimeVersion);
rslt = ExecAppcmd(cmd, 5, twoSeconds);
if (false == rslt.Success)
{
View
4 src/IronFoundry.Dea/Types/Advertise.cs
@@ -6,8 +6,6 @@
public class Advertise : Message
{
- private static readonly string[] runtimes = new[] { Constants.SupportedRuntime };
-
private const string publishSubject = "dea.advertise";
[JsonIgnore]
@@ -31,7 +29,7 @@ public override string PublishSubject
[JsonProperty(PropertyName = "runtimes")]
public string[] Runtimes
{
- get { return runtimes; }
+ get { return Constants.SupportedRuntimes; }
}
public Advertise(Guid id, uint availableMemory, ushort currentlyPending, bool ready)
View
3 src/IronFoundry.Dea/Types/Droplet.cs
@@ -1,6 +1,5 @@
namespace IronFoundry.Dea.Types
{
- using System;
using Newtonsoft.Json;
public class Droplet : EntityBase
@@ -50,7 +49,7 @@ public class Droplet : EntityBase
[JsonIgnore]
public bool FrameworkSupported
{
- get { return false == String.IsNullOrWhiteSpace(Framework) && Framework == Constants.SupportedFramework; }
+ get { return Constants.IsSupportedFramework(Framework); }
}
}
}
View
6 src/IronFoundry.Dea/Types/Instance.cs
@@ -111,6 +111,12 @@ public DateTime StartDate
[JsonProperty(PropertyName = "runtime")]
public string Runtime { get; set; }
+ [JsonIgnore]
+ public ushort ManagedRuntimeVersion
+ {
+ get { return Constants.GetManagedRuntimeVersion(Runtime); }
+ }
+
[JsonProperty(PropertyName = "framework")]
public string Framework { get; set; }
View
4 src/shared/CommonAssemblyInfo.cs
@@ -8,5 +8,5 @@
[assembly: AssemblyDescription("https://github.com/IronFoundry/ironfoundry")]
[assembly: AssemblyProduct("Iron Foundry")]
[assembly: AssemblyTrademark("Iron Foundry")]
-[assembly: AssemblyFileVersion("1.7.1.0")]
-[assembly: AssemblyVersion("1.7.1.0")]
+[assembly: AssemblyFileVersion("1.8.0.0")]
+[assembly: AssemblyVersion("1.8.0.0")]
View
29 tools/stop-apps.rb
@@ -0,0 +1,29 @@
+require 'json'
+
+file = ARGV[0]
+unless not file.nil? and File.exists?(file)
+ STDERR.puts("File '#{file}' does not exist.")
+ exit 1
+end
+
+j = JSON.load(File.open(file, 'rb:bom|utf-8'))
+
+pids = []
+
+j.each do |user|
+ email = user['email']
+ apps = user['apps']
+ unless apps.nil? or apps.empty?
+ apps.each do |app|
+ app_name = app['name']
+ puts "Stopping user '#{email}' app '#{app_name}' ...\n\n"
+ STDOUT.flush
+ pid = Process.spawn("vmc -u #{email} stop #{app_name}")
+ pids << pid
+ if pids.length >= 10
+ Process.waitall()
+ pids = []
+ end
+ end
+ end
+end
View
BIN tools/users.json
Binary file not shown.

0 comments on commit 2c35180

Please sign in to comment.