From e4cf18366512c4dda28fe92a7ee01a5efd8b34cc Mon Sep 17 00:00:00 2001 From: Pepijn Schoen Date: Tue, 11 Oct 2016 08:57:36 +0200 Subject: [PATCH] Add solution. --- WebRole.sln => DockerWebWorkerRole.sln | 12 ++ Dockerfile.web | 14 ++ Dockerfile.worker | 14 ++ Jobs/ComplexFactory.cs | 15 ++ Jobs/ComplexObject.cs | 9 ++ Jobs/IMessageDispatcher.cs | 9 ++ Jobs/IQueueListener.cs | 6 + Jobs/IQueueSender.cs | 9 ++ Jobs/Jobs.xproj | 21 +++ Jobs/MessageDispatcher.cs | 40 +++++ Jobs/Properties/AssemblyInfo.cs | 19 +++ Jobs/QueueConnection.cs | 98 ++++++++++++ Jobs/QueueListener.cs | 68 +++++++++ Jobs/QueueMessage.cs | 33 ++++ Jobs/QueueSender.cs | 48 ++++++ Jobs/project.json | 15 ++ WebRole/Controllers/MessageController.cs | 25 +++ WebRole/Controllers/ValuesController.cs | 44 ------ WebRole/Program.cs | 1 + WebRole/Project_Readme.html | 187 ----------------------- WebRole/Properties/launchSettings.json | 7 +- WebRole/Startup.cs | 9 +- WebRole/project.json | 5 +- WorkerRole/Program.cs | 44 ++++++ WorkerRole/Properties/AssemblyInfo.cs | 19 +++ WorkerRole/WorkerRole.xproj | 21 +++ WorkerRole/project.json | 21 +++ docker-compose.yml | 25 +++ 28 files changed, 597 insertions(+), 241 deletions(-) rename WebRole.sln => DockerWebWorkerRole.sln (50%) create mode 100644 Dockerfile.web create mode 100644 Dockerfile.worker create mode 100644 Jobs/ComplexFactory.cs create mode 100644 Jobs/ComplexObject.cs create mode 100644 Jobs/IMessageDispatcher.cs create mode 100644 Jobs/IQueueListener.cs create mode 100644 Jobs/IQueueSender.cs create mode 100644 Jobs/Jobs.xproj create mode 100644 Jobs/MessageDispatcher.cs create mode 100644 Jobs/Properties/AssemblyInfo.cs create mode 100644 Jobs/QueueConnection.cs create mode 100644 Jobs/QueueListener.cs create mode 100644 Jobs/QueueMessage.cs create mode 100644 Jobs/QueueSender.cs create mode 100644 Jobs/project.json create mode 100644 WebRole/Controllers/MessageController.cs delete mode 100644 WebRole/Controllers/ValuesController.cs delete mode 100644 WebRole/Project_Readme.html create mode 100644 WorkerRole/Program.cs create mode 100644 WorkerRole/Properties/AssemblyInfo.cs create mode 100644 WorkerRole/WorkerRole.xproj create mode 100644 WorkerRole/project.json create mode 100644 docker-compose.yml diff --git a/WebRole.sln b/DockerWebWorkerRole.sln similarity index 50% rename from WebRole.sln rename to DockerWebWorkerRole.sln index ef2b263..9803246 100644 --- a/WebRole.sln +++ b/DockerWebWorkerRole.sln @@ -5,6 +5,10 @@ VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WebRole", "WebRole\WebRole.xproj", "{8866C8B2-C92B-4CDA-B1B0-3590882DEF73}" EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WorkerRole", "WorkerRole\WorkerRole.xproj", "{8C8A9176-0DD2-4AE5-9FD7-DE2416AF50E2}" +EndProject +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Jobs", "Jobs\Jobs.xproj", "{149FB2F0-E14B-4561-B88A-A2F590A63AA3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +19,14 @@ Global {8866C8B2-C92B-4CDA-B1B0-3590882DEF73}.Debug|Any CPU.Build.0 = Debug|Any CPU {8866C8B2-C92B-4CDA-B1B0-3590882DEF73}.Release|Any CPU.ActiveCfg = Release|Any CPU {8866C8B2-C92B-4CDA-B1B0-3590882DEF73}.Release|Any CPU.Build.0 = Release|Any CPU + {8C8A9176-0DD2-4AE5-9FD7-DE2416AF50E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8C8A9176-0DD2-4AE5-9FD7-DE2416AF50E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8C8A9176-0DD2-4AE5-9FD7-DE2416AF50E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8C8A9176-0DD2-4AE5-9FD7-DE2416AF50E2}.Release|Any CPU.Build.0 = Release|Any CPU + {149FB2F0-E14B-4561-B88A-A2F590A63AA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {149FB2F0-E14B-4561-B88A-A2F590A63AA3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {149FB2F0-E14B-4561-B88A-A2F590A63AA3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {149FB2F0-E14B-4561-B88A-A2F590A63AA3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Dockerfile.web b/Dockerfile.web new file mode 100644 index 0000000..5255396 --- /dev/null +++ b/Dockerfile.web @@ -0,0 +1,14 @@ +FROM microsoft/dotnet + +COPY / /app +WORKDIR /app + +RUN dotnet restore Jobs +RUN dotnet build Jobs + +RUN dotnet restore WebRole +RUN dotnet build WebRole + +WORKDIR /app/WebRole + +ENTRYPOINT ["dotnet", "run"] diff --git a/Dockerfile.worker b/Dockerfile.worker new file mode 100644 index 0000000..c812352 --- /dev/null +++ b/Dockerfile.worker @@ -0,0 +1,14 @@ +FROM microsoft/dotnet + +COPY / /app +WORKDIR /app + +RUN dotnet restore Jobs +RUN dotnet build Jobs + +RUN dotnet restore WorkerRole +RUN dotnet build WorkerRole + +WORKDIR /app/WorkerRole + +ENTRYPOINT ["dotnet", "run"] diff --git a/Jobs/ComplexFactory.cs b/Jobs/ComplexFactory.cs new file mode 100644 index 0000000..2d5bf0d --- /dev/null +++ b/Jobs/ComplexFactory.cs @@ -0,0 +1,15 @@ +using System.Threading.Tasks; + +namespace Jobs +{ + public class ComplexFactory + { + public Task CreateSomethingComplicated(string name) + { + return Task.FromResult(new ComplexObject() + { + Name = name + }); + } + } +} diff --git a/Jobs/ComplexObject.cs b/Jobs/ComplexObject.cs new file mode 100644 index 0000000..1213554 --- /dev/null +++ b/Jobs/ComplexObject.cs @@ -0,0 +1,9 @@ +namespace Jobs +{ + public class ComplexObject + { + public int Whistles { get; set; } = 4; + public int Bells { get; set; } = 10; + public string Name { get; set; } = string.Empty; + } +} diff --git a/Jobs/IMessageDispatcher.cs b/Jobs/IMessageDispatcher.cs new file mode 100644 index 0000000..47c44a6 --- /dev/null +++ b/Jobs/IMessageDispatcher.cs @@ -0,0 +1,9 @@ +using System.Threading.Tasks; + +namespace Jobs +{ + public interface IMessageDispatcher + { + Task Dispatch(QueueMessage message); + } +} \ No newline at end of file diff --git a/Jobs/IQueueListener.cs b/Jobs/IQueueListener.cs new file mode 100644 index 0000000..80ed976 --- /dev/null +++ b/Jobs/IQueueListener.cs @@ -0,0 +1,6 @@ +namespace Jobs +{ + public interface IQueueListener + { + } +} \ No newline at end of file diff --git a/Jobs/IQueueSender.cs b/Jobs/IQueueSender.cs new file mode 100644 index 0000000..f432448 --- /dev/null +++ b/Jobs/IQueueSender.cs @@ -0,0 +1,9 @@ +using System.Threading.Tasks; + +namespace Jobs +{ + public interface IQueueSender + { + Task SendAsync(QueueMessage queueMessage); + } +} \ No newline at end of file diff --git a/Jobs/Jobs.xproj b/Jobs/Jobs.xproj new file mode 100644 index 0000000..b79b2b4 --- /dev/null +++ b/Jobs/Jobs.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + 149fb2f0-e14b-4561-b88a-a2f590a63aa3 + Jobs + .\obj + .\bin\ + v4.5.2 + + + + 2.0 + + + diff --git a/Jobs/MessageDispatcher.cs b/Jobs/MessageDispatcher.cs new file mode 100644 index 0000000..bfe949c --- /dev/null +++ b/Jobs/MessageDispatcher.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Jobs +{ + public class MessageDispatcher : IMessageDispatcher + { + private readonly IQueueSender client; + + public MessageDispatcher(IQueueSender client) { + this.client = client; + } + + public async Task Dispatch(QueueMessage message) + { + if (message.Topic == "web") + { + var body = message.GetBody(); + + Console.WriteLine($"[{DateTime.UtcNow.ToString("dd/MM/yyyy HH:mm:ss")}] -> received message from web: {body}"); + + var complexObject = await new ComplexFactory().CreateSomethingComplicated(body); + + await client.SendAsync(new QueueMessage("worker", complexObject)); + } + else if (message.Topic == "worker") + { + var body = message.GetBody(); + + Console.WriteLine($"[{DateTime.UtcNow.ToString("dd/MM/yyyy HH:mm:ss")}] -> received message from worker: {body.Name} with {body.Bells} bells and {body.Whistles} whistles."); + } + else + { + throw new Exception($"Unexpected message {message.Topic}"); + } + } + } +} diff --git a/Jobs/Properties/AssemblyInfo.cs b/Jobs/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ca3dab0 --- /dev/null +++ b/Jobs/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Jobs")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("149fb2f0-e14b-4561-b88a-a2f590a63aa3")] diff --git a/Jobs/QueueConnection.cs b/Jobs/QueueConnection.cs new file mode 100644 index 0000000..31ac5da --- /dev/null +++ b/Jobs/QueueConnection.cs @@ -0,0 +1,98 @@ +using Amqp; +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace Jobs +{ + public abstract class QueueConnection : IDisposable + { + private Session oldSession; + private Connection oldConnection; + + private Session session; + private Connection connection; + + private CancellationTokenSource cancellationTokenSource; + + private readonly Address address; + + protected abstract void Renew(Session session); + + protected QueueConnection() + { + address = new Address(Environment.GetEnvironmentVariable("SERVICE_BUS_URL"), + 5671, + Environment.GetEnvironmentVariable("SERVICE_BUS_SAK_POLICYNAME"), + Environment.GetEnvironmentVariable("SERVICE_BUS_SAK_SHAREDSECRET")); + + cancellationTokenSource = new CancellationTokenSource(); + + renewSession(); + } + private void renewSession() + { + oldConnection = connection; + oldSession = session; + + connection = new Connection(address); + session = new Session(connection); + + Renew(session); + + if (oldSession != null) + { + oldSession.Close(); + oldSession = null; + } + + if (oldConnection != null) + { + oldConnection.Close(); + oldConnection = null; + } + + startRenewTimer(); + } + + private void startRenewTimer() + { + delayedRenewSession(cancellationTokenSource.Token); + } + + private async Task delayedRenewSession(CancellationToken token) + { + await Task.Delay(5 * 60 * 1000, token); + + if (!token.IsCancellationRequested) + renewSession(); + } + + public void Dispose() + { + cancellationTokenSource.Cancel(); + + if (oldSession != null) + { + oldSession.Close(); + } + + if (oldConnection != null) + { + oldConnection.Close(); + } + + if (session != null) + { + session.Close(); + } + + if (connection != null) + { + connection.Close(); + } + + cancellationTokenSource.Dispose(); + } + } +} \ No newline at end of file diff --git a/Jobs/QueueListener.cs b/Jobs/QueueListener.cs new file mode 100644 index 0000000..216c170 --- /dev/null +++ b/Jobs/QueueListener.cs @@ -0,0 +1,68 @@ +using Amqp; +using Newtonsoft.Json; +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace Jobs +{ + public class QueueListener : QueueConnection, IQueueListener, IDisposable + { + private ReceiverLink oldReceiver; + private ReceiverLink receiver; + + public Action OnMessage { get; set; } + + public QueueListener(Action onMessage) + { + OnMessage = onMessage; + } + + protected override void Renew(Session session) + { + oldReceiver = receiver; + + receiver = new ReceiverLink(session, "receiver", Environment.GetEnvironmentVariable("SERVICE_BUS_NAME")); + + receiver.Start(20, (receiver, message) => + { + Console.WriteLine($"[{DateTime.UtcNow.ToString("dd/MM/yyyy HH:mm:ss")}] -> received message"); + + try + { + var queueMessage = JsonConvert.DeserializeObject(message.GetBody()); + + OnMessage(queueMessage); + + receiver.Accept(message); + } + catch (Exception e) + { + Console.WriteLine($"[{DateTime.UtcNow.ToString("dd/MM/yyyy HH:mm:ss")}] -> message threw an exception: {e.Message}"); + + receiver.Reject(message); + } + }); + + if (oldReceiver != null) + { + oldReceiver.Close(); + oldReceiver = null; + } + } + public new void Dispose() + { + if (oldReceiver != null) + { + oldReceiver.Close(); + } + + if (receiver != null) + { + receiver.Close(); + } + + base.Dispose(); + } + } +} diff --git a/Jobs/QueueMessage.cs b/Jobs/QueueMessage.cs new file mode 100644 index 0000000..a163d7d --- /dev/null +++ b/Jobs/QueueMessage.cs @@ -0,0 +1,33 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Jobs +{ + public class QueueMessage + { + public QueueMessage() { } + + public QueueMessage(string topic, object body) + : this() + { + Topic = topic; + Body = JsonConvert.SerializeObject(body); + } + + public string Topic { get; set; } + public string Body { get; set; } + + public T GetBody() + { + return JsonConvert.DeserializeObject(Body); + } + + public void SetBody(T body) + { + Body = JsonConvert.SerializeObject(body); + } + } +} diff --git a/Jobs/QueueSender.cs b/Jobs/QueueSender.cs new file mode 100644 index 0000000..509f881 --- /dev/null +++ b/Jobs/QueueSender.cs @@ -0,0 +1,48 @@ +using Amqp; +using Newtonsoft.Json; +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace Jobs +{ + public class QueueSender : QueueConnection, IQueueSender, IDisposable + { + private SenderLink oldSender; + private SenderLink sender; + + public async Task SendAsync(QueueMessage queueMessage) + { + await sender.SendAsync(new Message(JsonConvert.SerializeObject(queueMessage))); + } + + protected override void Renew(Session session) + { + oldSender = sender; + + sender = new SenderLink(session, "sender", Environment.GetEnvironmentVariable("SERVICE_BUS_NAME")); + + if (oldSender != null) + { + oldSender.Close(); + oldSender = null; + } + } + + public new void Dispose() + { + if (oldSender != null) + { + oldSender.Close(); + } + + if (sender != null) + { + sender.Close(); + } + + base.Dispose(); + } + + } +} \ No newline at end of file diff --git a/Jobs/project.json b/Jobs/project.json new file mode 100644 index 0000000..fac1fbe --- /dev/null +++ b/Jobs/project.json @@ -0,0 +1,15 @@ +{ + "version": "1.0.0-*", + + "dependencies": { + "NETStandard.Library": "1.6.0", + "Newtonsoft.Json": "9.0.1", + "AMQPNetLite": "1.2.1" + }, + + "frameworks": { + "netstandard1.6": { + "imports": "dnxcore50" + } + } +} diff --git a/WebRole/Controllers/MessageController.cs b/WebRole/Controllers/MessageController.cs new file mode 100644 index 0000000..fdfe2da --- /dev/null +++ b/WebRole/Controllers/MessageController.cs @@ -0,0 +1,25 @@ +using Amqp; +using Jobs; +using Microsoft.AspNetCore.Mvc; + +namespace WebRole.Controllers +{ + [Route("messages")] + public class MessageController : Controller + { + private readonly IQueueSender queueClient; + + public MessageController(IQueueSender queueClient) + { + this.queueClient = queueClient; + } + + [HttpGet] + public void Schedule(string message) + { + var queueMessage = new QueueMessage("web", message); + + queueClient.SendAsync(queueMessage); + } + } +} diff --git a/WebRole/Controllers/ValuesController.cs b/WebRole/Controllers/ValuesController.cs deleted file mode 100644 index 8e2d09d..0000000 --- a/WebRole/Controllers/ValuesController.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; - -namespace WebRole.Controllers -{ - [Route("api/[controller]")] - public class ValuesController : Controller - { - // GET api/values - [HttpGet] - public IEnumerable Get() - { - return new string[] { "value1", "value2" }; - } - - // GET api/values/5 - [HttpGet("{id}")] - public string Get(int id) - { - return "value"; - } - - // POST api/values - [HttpPost] - public void Post([FromBody]string value) - { - } - - // PUT api/values/5 - [HttpPut("{id}")] - public void Put(int id, [FromBody]string value) - { - } - - // DELETE api/values/5 - [HttpDelete("{id}")] - public void Delete(int id) - { - } - } -} diff --git a/WebRole/Program.cs b/WebRole/Program.cs index 13c4733..c4c698c 100644 --- a/WebRole/Program.cs +++ b/WebRole/Program.cs @@ -14,6 +14,7 @@ public static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() + .UseUrls("http://*:5000/") .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup() diff --git a/WebRole/Project_Readme.html b/WebRole/Project_Readme.html deleted file mode 100644 index 1a0f5b5..0000000 --- a/WebRole/Project_Readme.html +++ /dev/null @@ -1,187 +0,0 @@ - - - - - Welcome to ASP.NET Core - - - - - - - - - - diff --git a/WebRole/Properties/launchSettings.json b/WebRole/Properties/launchSettings.json index b368379..2c944a7 100644 --- a/WebRole/Properties/launchSettings.json +++ b/WebRole/Properties/launchSettings.json @@ -11,16 +11,17 @@ "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, - "launchUrl": "api/values", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "WebRole": { "commandName": "Project", - "launchBrowser": true, - "launchUrl": "http://localhost:5000/api/values", "environmentVariables": { + "SERVICE_BUS_URL": ".servicebus.windows.net", + "SERVICE_BUS_SAK_SHAREDSECRET": "", + "SERVICE_BUS_SAK_POLICYNAME": "", + "SERVICE_BUS_NAME": "", "ASPNETCORE_ENVIRONMENT": "Development" } } diff --git a/WebRole/Startup.cs b/WebRole/Startup.cs index f2bb463..c7296ba 100644 --- a/WebRole/Startup.cs +++ b/WebRole/Startup.cs @@ -1,12 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using Jobs; namespace WebRole { @@ -29,6 +26,8 @@ public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); + + services.AddSingleton(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/WebRole/project.json b/WebRole/project.json index af6281b..2bd7b69 100644 --- a/WebRole/project.json +++ b/WebRole/project.json @@ -1,4 +1,4 @@ -{ +{ "dependencies": { "Microsoft.NETCore.App": { "version": "1.0.0", @@ -13,7 +13,8 @@ "Microsoft.Extensions.Logging": "1.0.0", "Microsoft.Extensions.Logging.Console": "1.0.0", "Microsoft.Extensions.Logging.Debug": "1.0.0", - "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0" + "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", + "Jobs": "1.0.0-*" }, "tools": { diff --git a/WorkerRole/Program.cs b/WorkerRole/Program.cs new file mode 100644 index 0000000..6cf02e8 --- /dev/null +++ b/WorkerRole/Program.cs @@ -0,0 +1,44 @@ +using Jobs; +using Microsoft.Extensions.DependencyInjection; +using System; +using System.Threading; + +namespace WorkerRole +{ + public class Program + { + static ManualResetEvent _quitEvent = new ManualResetEvent(false); + + public static void Main(string[] args) + { + var services = new ServiceCollection(); + + services.AddScoped(); + services.AddSingleton(); + services.AddSingleton((provider) => + { + return new QueueListener(async (message) => + { + var dispatcher = provider.GetService(); + + await dispatcher.Dispatch(message); + }); + }); + + var serviceProvider = services.BuildServiceProvider(); + + Console.WriteLine($"[{DateTime.UtcNow.ToString("dd/MM/yyyy HH:mm:ss")}] -> Worker role started"); + + var listener = serviceProvider.GetService(); + + Console.CancelKeyPress += (sender, eArgs) => { + Console.WriteLine($"[{DateTime.UtcNow.ToString("dd/MM/yyyy HH:mm:ss")}] -> Worker role finished"); + + _quitEvent.Set(); + eArgs.Cancel = true; + }; + + _quitEvent.WaitOne(); + } + } +} diff --git a/WorkerRole/Properties/AssemblyInfo.cs b/WorkerRole/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ae199c4 --- /dev/null +++ b/WorkerRole/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WorkerRole")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("8c8a9176-0dd2-4ae5-9fd7-de2416af50e2")] diff --git a/WorkerRole/WorkerRole.xproj b/WorkerRole/WorkerRole.xproj new file mode 100644 index 0000000..4d004b5 --- /dev/null +++ b/WorkerRole/WorkerRole.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + 8c8a9176-0dd2-4ae5-9fd7-de2416af50e2 + WorkerRole + .\obj + .\bin\ + v4.5.2 + + + + 2.0 + + + diff --git a/WorkerRole/project.json b/WorkerRole/project.json new file mode 100644 index 0000000..fb039d2 --- /dev/null +++ b/WorkerRole/project.json @@ -0,0 +1,21 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "emitEntryPoint": true + }, + + "dependencies": { + "Microsoft.Extensions.DependencyInjection": "1.0.0", + "Jobs": "1.0.0-*", + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + }, + + "frameworks": { + "netcoreapp1.0": { + "imports": "dnxcore50" + } + } +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..80a1deb --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +version: '2' + +services: + worker: + build: + context: . + dockerfile: Dockerfile.worker + environment: + - ASPNETCORE_ENVIRONMENT=Production + - SERVICE_BUS_URL=.servicebus.windows.net + - SERVICE_BUS_NAME= + - SERVICE_BUS_SAK_POLICYNAME= + - SERVICE_BUS_SAK_SHAREDSECRET= + web: + build: + context: . + dockerfile: Dockerfile.web + ports: + - "5000:5000" + environment: + - ASPNETCORE_ENVIRONMENT=Production + - SERVICE_BUS_URL=.servicebus.windows.net + - SERVICE_BUS_NAME= + - SERVICE_BUS_SAK_POLICYNAME= + - SERVICE_BUS_SAK_SHAREDSECRET=