Socket Server in Amazon Elastic Beanstalk - c#

Currently, I have a socket server, that listens to incoming connections on two ports (e.g. 7777 and 7778) and replies to them. The data is stored in an RDS environment, part of a bigger Elastic Beanstalk environment that accesses the same data. The socket server is implemented as a Windows service. So far, so good. It works.
However, I am asking myself, whether it's possible to have the socket server also within the same (or possibly another) Elastic Beanstalk environment, but so far, I haven't found any way to do that.
My goals are
to have a far simpler deployment procedure, as in the productive environment, I need the socket servers to be behind a load balancer and don't want to deploy a windows service on each instance.
to have only one environment to deploy to, so that I won't have to deploy (manually or automatically) each time I have a change in the DAL.
The socket server does not need to be implemented as a Windows service, it just is now.
Everything is implemented in C#. Any help is appreciated.

I think, I got this covered. However, I couldn't deploy the Windows Service without errors stand-alone, but only as part of a Web application. Not a real problem in my scenario, though.
I have two projects for this scenario; a Web Application and a Windows Service application.
On the build server, I create a ZIP file of the Windows Service
executables (using zip.exe)
On the build server, I upload the ZIP file to an S3 bucket (using s3.exe)
On the project of the web application, I create a .ebextensions directory
In the .ebextensions directory, I have a whatever.config file that
Takes the ZIP file from S3 and unpacks it onto the C-Drive in my preferred directory
Calls a batch file (part of the ZIP file) that uninstalls and reinstalls the Windows Service with the InstallUtil.exe utility (part of the .Net framework)
In my nightly builds (of the complete solution), I deploy the web application to Elastic Beanstalk using awsdeploy.exe.
Therefore, I point to a configuration.txt file in a builds directory of my web application.
You can generate such a build file with a manual Elastic Beanstalk deployment from Visual Studio; but they are quite easy after a while.
What happens now, is that in my Nightly Builds the Web application is deployed to the Elastic Beanstalk environment; the deployment will recognize that there is a configuration and will execute the steps mentioned below step 4 above. As the Nightly Build created and uploaded the ZIP file of the Windows Service before that, I am sure that I will install the most recent Windows Service.
My only problem now is that the Windows Service does not always install itself because of the infamous marked for deletion error. But that's another story.
I hope this helps somebody. If anyone has a suggestion to simplify this, he's welcome to add a comment.

Related

In Azure Devops, how can I deploy an exe file to as server as part of release (or something similar)

A solution consists of...:
Web app
Console app ("jobserver", which pulls jobs and processes them)
All is C#, .Net Core 5.
I have continuous deployment set up, so new versions of the web app are deployed to Azure Web App automatically.
However, the console app, I cannot figure out a good way to deploy to a Windows server (or pull). Right now, I go to the server, stop the app if it is not doing anything (otherwise I wait a bit). Then I copy the files over and start it up again. All manually.
I can think of several complicated workarounds, but I am thinking there must be easier way.
What are some ways the deployment of exe file could be handled? How are others handling this?
Ps. The console app cannot run on Azure Web App or as WebJob or similar, because it has requirements that means it has to run on a "real" windows server.
You can use the PowerShell on Target machines or SSH tasks to run commands on a remote machine. Similarly, to copy files, you can use Windows Machine File Copy or Copy Files Over SSH to copy your .exe to the server.

Depoyment of pre-built Azure Web Service via PowerShell

I am completely new to Azure and PowerShell but have been tasked with setting up a build and deploy solution for several app services.
We currently have a build server (Azure VM) that is running CruiseControl.NET to build and test some C# .NET solutions that should be deployed in Azure.
This build server currently handles the following tasks:
Pulling code from source control when commits happen
Building the projects
Running some unit test cases
Copying output/binaries to an output location
However, as it exists now, developers of each of our app services need to 'Publish' their services manually from their development machines by clicking the button in Visual Studio once they have verified that the build and test cases have passed in the test environment on the server.
As I am hoping for a completely automated solution, I expect I need to use something like PowerShell or the Azure Cross Platform CLI (npm) to do this?
I'm extremely confused with the Azure Service Management vs Azure Resource Management versions with the new Azure Powershell 1.0. All of our services appear to be the newer Resource Management versions, not 'classic'.
The eventual goal is to have the build server do the following
Pulling code from source control when commits happen
Building the projects
Running some unit test cases
Copying output/binaries to an output location
If the build and test cases are successful, update the service in azure to the latest build
I am hoping there is a way to set up these projects, or take the existing binaries that result from the builds, and have them be deployed into Web Apps using the new Azure Resource Management Powershell features.
Any advice or resources for more information about how this can be done?
Hopefully this makes some sense. Please let me know if I am going about this completely the wrong way or direct me to a more correct forum.
Thanks!
have you consider to use Azure App Service? where you can get those build infrastructure for free. e.g https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/
Once you setup continues deployment, you will get below three when there is push event (if you are using git)
Pulling code from source control when commits happen
Building the projects
Copying output/binaries to an output location
and to "Running some unit test cases", you can create your own batch or powershell script with post deployment hook https://github.com/projectkudu/kudu/wiki/Post-Deployment-Action-Hooks

Service Fabric deployment in the cloud

We are switching to an actor based architecture for a subsystem in our product (We use C#), and we are considering either Akka.NET or Service Fabric actors. We have experience with Akka and Akka Clusters (in Scala), but the Service Fabric actors suits our purpose perfectly. It is, however, really difficult to find any material about deployment.
Is it possible at all to deploy on Azure at the moment (or can you join any preview programmes)? I can't find any indications of when a preview will be available, if it is not possible already.
Azure deployment is not available yet. It will be launched as a preview later this year.
Update: Service Fabric is now available in public preview.
Update: Microsoft now provides Service Fabric Continuous Integration documentation
I have continuous delivery running w/the development SDK (all nodes on one VM) like this:
push to github.com
github.com tells Visual Studio Online to trigger a build.
A custom build definition with a custom ‪#PowerShell‬ script step who 7z’s the build artifacts and curl’s the file to the Windows Server 2012 R2 Azure VM instance
IIS is loaded on the VM to host basic auth over TLS, & the WebDav module simply for this upload (easier to configure than FTP or WebRM on Azure, for sure)
I wrote custom open-source code who monitors for a trigger file (https://github.com/corlib/trigger) and invokes a command, configured to invoke a custom deployment script. (very early, but functional for this purpose)
The deployment script decompresses the archive, loads the ServiceFabric application manifest to obtain the application type version. This version is used to deploy the application package to a unique location in the cluster, register it, and then start a monitored application upgrade (w/rollback to previous version on failure)

Deploying a web site to azure as a package

I'm starting an ASP.net web project that will be hosted on Azure, but I'm not certain whether to develop the project as a regular ASP.net application and deploy it as a Web Site on Azure, or to develop it as a Cloud Application with a Web Role.
The project's nature is that of a web site (simple database back-end), but the question is one of deployment. We aim to build versions of the application and then deploy to staging and production environments, meaning the output of a build should result in a single package (similar to what's described in msdn).
There's plenty of information on how to create a service package to publish a cloud service, but articles on publishing a web site to azure follow a 'web deployment' scenario, where deployment is done via Visual Studio (subscription file from Azure etc).
Is there a way to deploy a web site to azure as a package? Or are tools like Visual Studio needed for a web deploy? If so, then is composing the project as a Cloud service with only a web role the correct choice?
I posted a comment under the question, regarding differences between Cloud Service & Web Site, but to answer your question about packaging: Cloud Services & Web Sites take two different approaches to deployment, and there's not really "works for both" packaging:
Web Sites are designed to accept your code deployment from either a source code repository. The idea is that you have a labeled version of your code, and push it out from TFS, git, Bitbucket, etc. You can also push your code up with ftp, or drop it into a dropbox folder. Because Web Sites run in IIS, and because you don't have any control over the VM farm running your Web Sites, you cannot push up startup scripts as you can with Cloud Services; you cannot install registry updates, COM objects, msi's...
Cloud Services are designed around a stateless VM model. Every time you scale out (add instances), a baseline Windows Server VM is spun up, and the contents of your deployment package is copied to the new VM instance and executed. This includes startup scripts, installers, etc. Since you have admin-level access to each VM, you can configure it as you need to, from your startup scripts / OnStart(). Definitions for each role are combined into a single deployment package. To update one or more roles, you need to redeploy the package.
Web Sites have no tooling pre-requisites, while Cloud Services require Visual Studio or Eclipse to help you manage the deployment package. You can also use PowerShell and Visual Studio command line tools to build the package, as #Ben Robinson mentioned in the comments above. You can also use PowerShell to create and administer Web Sites. Both Cloud Services and Web Sites provide Staging and Production slots.
You can't push a deployment package to Web Sites.
David's answer does a great job covering the Cloud Services option. However, I believe the Azure Website option is well-suited to your needs. You don't have to deploy using Visual Studio. Instead, you can create a publish profile in Visual Studio that creates a Web Deploy Package which is simply a ZIP file that can be published at a later time using command-line tools, no Visual Studio required. It also generates a .deploy.cmd file that you can run to deploy to a remote server, and a SetParameters.xml file with parameters such as connection string that you can modify for your target deployment environment. The .deploy.cmd file calls msdeploy.exe which does the actual deployment.
See this for more details on Web Deploy command-line deployment. There's also a ton of information on MSDeploy and its package system on Sayed Ibrahim Hashimi's blog.
If you want to be able to change files directly in the web application then it is best to use an Azure Web App, because you can access those through FTP.
However an Azure Cloud Service does not provide FTP Access, at least not a useful one that would allow you to use an FTP Client to upload files. A Cloud Service is where you do not want to be bothered too much with much of the details of hosting a web application. While an Azure Web App does much of the same thing, it also allows you to have FTP access and direct access to the files post-deployment.

Publishing a c# console application on IIS Server

Is it possible to deploy a console c# application on IIS Server.
I have one .exe file running on a machine which takes data from named pipe and my c# application takes this data from the pipe and send it to the web application running using TCP sockets, I want to know if i can deploy my C# console application on the webserver?
I am new to ASP.net and C#.
You can host an exe file on IIS server, but it is not a common practice to deploy C# console applications,
In this way you don't know if the client machine has proper .NET Framework installed. So the console application may not even launch.
The web browser can simply block the download.
Even if the exe file is downloaded, unless the user launches it locally, it won't run automatically.
Recommended approach by Microsoft is to deploy the client side application using ClickOnce,
http://msdn.microsoft.com/en-us/library/t71a733d%28v=vs.80%29.aspx
You can then host the ClickOnce installer on IIS side. For example, Microsoft CodePlex uses this kind of deployment for its open source projects,
http://codeplex.codeplex.com/wikipage?title=ClickOnce
No, IIS can be used to host only web sites or web applications. You can't host console applications in IIS.

Categories