Install Jenkins as a Service or Run it behind Apatche - jenkins

I understand that there are two ways of installing Jenkins:
1) Running Jenkins behind Apache (Using the War file)
2) Installing Jenkins as a Windows Service(using the windows Installer)
I am in the process of creating a CI, Auto-Deployment and Scheduled Automation runs for my project. So in this case which kind of installation should be better. I just do not want to choose the wrong one and end up recreating jobs to the other kind.
I have few questions:
1) If I choose to install as a Windows service( using the windows installer), do I still have to install an web server like IIS or Apatche for accessing my Jenkins URL, or does Jenkins have something inbuilt in it and I do not have to add an web server for accessing Jenkins?
2)If Jenkins as a Windows Service(using the windows Installer) needs IIS, I have steps in my project in which I have to restart IIS manually to generate NCover reports. In such cases, would Jenkins also be down?
3) Jenkins website states the following: "In situations where you have existing web sites on your server, you may find it useful to run Jenkins (or the servlet container that Jenkins runs in) behind Apache, so that you can bind Jenkins to the part of a bigger website that you may have.".
I would be hosting our application locally using IIS, in that case, should I chose to use the WAR installer instead of the windows installer.

I do not run Jenkin's on Windows but I believe its the same as other platforms...
No if you install Jenkins with the installer you will not need IIS or Apache
See the answer to 1, If you don't use IIS to run Jenkins restarting it won't bring down Jenkins
It sounds like you want to run your existing site under IIS and leave Jenkins running on its own. I think the windows installer for Jenkins will do exactly this.

I have run Jenkins on Windows and Unix environment.
Just wanted to add more to Ben's answer:
Windows if you install as windows service you will not need anything and for this following wiki should be more than enough:
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+as+a+Windows+service
To add more to 3rd point:
Normally web sites are hosted behind Apache httpd server. If you are using one then you can configure both IIS web server and Jenkins accordingly.

In my previous company, we was running Jenkins as a service (with the solution proposed by Vinay above).
It worked well and you don't have to install an application server like Apache.
The only thing you have to take care is the user which launch the Windows service.
If your Jenkins server needs to access some ressource on the network, maybe you have to use a LDAP user to launch your service instead of using the "local system account".

Related

Run a gitlab CI pipeline in Docker container

Absolute beginner in DevOps here. I have a Gitlab repo that I would like to build and run its tests in the Gitlab pipeline CI.
So far, I'm only testing locally on my machine with a specific runner. There's a lot information out there and I'm starting to get lost with what to use and how to use it.
How would I go about creating a container with the tools that I need ? (VS compiler, cmake, git, etc...)
My application contains an SDK that only works on windows, so I'm not sure building on another platform would work at all, so how do I select a windows based container?
How would I use that container in the yml file in gitlab so that I can build my solution and run my tests?
Any specific documentation links or suggestions are welcomed and appreciated.
How would I go about creating a container with the tools that I need ? (VS compiler, cmake, git, etc...)
you can install those tools before the pipeline script runs. I usually do this in before_script.
If there's large-ish packages that need to be installed on every pipeline run, I'd recommend that you make yourown image, with all the required build dependencies, push it to GitLab and then just use it as your job image.
My application contains an SDK that only works on windows, so I'm not sure building on another platform would work at all, so how do I select a windows based container?
If you're using gitlab.com - Windows runners are currently in beta, but available for use.
SaaS runners on Windows are in beta and shouldn’t be used for production workloads.
During this beta period, the shared runner quota for CI/CD minutes applies for groups and projects in the same manner as Linux runners. This may change when the beta period ends, as discussed in this related issue.
If you're self-hosting - setup your own runner on Windows.
How would I use that container in the yml file in gitlab so that I can build my solution and run my tests?
This really depends on:
previous parts (you're using GL.com / self hosted)
how your application is built
what infrastructure you have access to
What I'm trying to say is that I feel like I can't give you a good answer without quite some more information

Deploy an Application on Server using Jenkins

I'm new to Jenkins, i've build the dotnet application in jenkins using microsft publish command now i want to move the exe of the application from local system (where jenkins is installed) to a actual server. how to do it? how can i move code from my local system to server. Can anyone please guide me.
One way is to zip the exe and manually deploy it on server i want to automate it.
I believe you're looking to:
Deploy your application to an Azure Virtual machine
And also automate the process
For #1: I would highly recommend using Visual Studio to publish your app to the Azure VM from your local machine for ad-hoc deployments, unless you have a hard dependency on using Jenkins.
For #2: There are a few ways in which you can do this. Here are some great resources to refer:
Deploy to a Windows Virtual Machine
Migrate an ASP.NET Web application to an Azure Virtual Machine
Deploy your ASP.NET app to Azure virtual machines by using Azure DevOps Starter
Here is another detailed blog that walks one through the CI/CD setup using Azure DevOps.

How do I get Jenkins running on Linux to communicate with Windows servers?

How do I get Jenkins running on Linux to communicate with Windows servers?
Currently Jenkins running in Linux and WebSphere running on windows and both are on prem not in cloud
i need to deploy War file which generated by Linux Jenkins to windows WebSphere, and client not agreeing for 3rd party tools like open-ssh and pscp
so , pls let me know if any one have idea to implement this ..
Thanks

Docker to deploy java web application with frequent configuration changes in wildfly server

I am new to DevOps. Recently I practiced the Docker examples. I have one usecase in my current project. Here it is
This is java project. It contains one war project that depends on jar project. Build tool is maven.
We are using Jboss Wildfly server.
DataBase is mysql 5.7.
We are using testng framework for the unit test cases.
sonarqube for code analysis. Selenium for testing.
So in any linux box the infrastructure we need is java8, wildfly server and mysql 5.7.
Consider we have 2 boxes. one is dev and another is test. Developer works on his local windows machine.
Sometimes we need some configurations required in jboss folder. Suppose we changed one xml in wildfly configuration folder in this release. How to communicate same to dev and test boxes as local machine. Another case is for dev box we need different configuration in xml and for test box it is different from dev box(SSL information in standalone.xml and user properties). How to handle this?
I would suggest to run all required stack (wildfly and mysql) via docker-compose. Also you can extend official wildfly image to provide your custom configuration so you should build 2 different images, one with tag 'dev' and second with tag 'test'.

Using TFS Build to run .bat files on remote server

The project I am on is using TFS Build in conjunction with Web Deploy to handle the deployments of the web site and service to the servers. We also have a windows service that needs to be deployed to the server as well.
My question is: Is there a way to deploy the Windows Service to the Web Server from the TFS Build server?
The other issue I have is that the service needs to be stopped before it can be deployed. I have tried to modify the Build Configuration file, but could not manage to get it to work.
Thanks.
Options:
If you install TFSBuildagent service on the web server and grant the user which runs the service Admin rights on the web server, then you can create a new build definition just for the deployment/installation. This is fairly simple and straight forward, but this would only work when you have limited number of web servers (who wants to install TFS BUild agent on all 2000 servers) and only work in the non-prod environment. This is how we are doing it for non-prod deployments, I have created a build definition which is just for deployment, which takes care of all the things like stopping services etc.
If the user which runs the TFSBuild Service on the build server have enough rights on the web server then you can use psexec or powershell to run your commands remotely. Read the below links: 1. PSEXEC
Powershell Remote commands
What did you do to stop the service in your build configuration file? Does the user have enough rights?
There is no inbuilt activity/process which can help you run scripts on remote machines in TFS build workflow.
Step 1 for you is to identify how you are going to run scripts on the remote machine, as mentioned above you can either use PSEXEC or Powershell (though running PowerShell on remote computers may be a little more complicated to set up).
Step2, write the actual scripts to do the work, stop services, install MSI etc.
Step3, Edit your current build defintion - create a new custom activity or make use of InvokeProcess activity from within your build definition to invoke the script that you have created in Step 2. InvokeProcess Activity

Resources