Where should I configure the jobs to build the project and to deploy it? - jenkins

I am very new to devops and I could really use some help to understand the concept of this.
So I am trying to develop a continuous integration environment using VirtualBox and Vagrant. I've read some examples of how to build such an environment to pull a maven project from github, build it and deploy to the nexus artefact repository.
I have managed to configure a VM with Ubuntu and installed Tomcat on it.
What I don't understand is where should I configure the Jenkins jobs to build the project and to deploy it to nexus and to make it run in Tomcat Server. On my local machine or in the virtual machine ?
Thanks.

If you are using bridged/hostonly networking for ubuntu, then you can run the jenkins in your host machine. If it is NAT/Private networking, use guest machine to run jenkin jobs.

Related

Deploying a SpringBoot into another server in a docker through Jenkins

I'm new to CI/CD process.
We have a model deploying a spring boot application through jenkins in docker in a same machine.
We was searching in internet how to deploy an application to another server, the only key which we have got is through SSH agent. I hope SSH is only for communicating.
Can we have a complete example how to deploy into another server and what are the other preventive measure to be taken into account.
Kindly guide us
In your Jenkins pipeline you need to define a stage for publishing the docker image and in your infrastructure you need a repository that stores your artifacts and docker images.
Repositories I know are Nexus or JFrog Artifactory.
So your server1, at the end of the pipeline, will upload the stable docker image to Nexus.
To execute the docker images in another server (not using an orchestrator) you may use Ansible.
On the net you can find a lot of sources, for example: https://www.codementor.io/mamytianarakotomalala/how-to-deploy-docker-container-with-ansible-on-debian-8-mavm48kw0

Can Jenkins be used for Docker Swarm deployment?

How to automate Jenkins for Docker Swarm deployment.
I am wondering if there are any plugins available in Jenkins which will help in Docker Swarm deployment or any other alternative way through which we can achieve the automation of Swarm deployment using Jenkins existing plugins?
Fixed this problem by using a plugin called Publish over SSH
Need to install a Jenkins plugins “Publish over SSH”, this plugin will allows us to
Sends files over SSH(SFTP)
Execute commands on a remote server
First step will be to add remote hosts and second will be to add an execution/build step where the commands will be executed
Follow this link for step by step instruction

How to connect jenkins to docker?

I have one jenkins server. There I cannot install docker. So the question is what is the correct way of integrating jenkins with a docker server? Whats the fastest easiest and most convenient way to integrate it?
1.Through a jenkins node with docker installed there
2.Through ssh? And if - how would the configuration look?
3.Only through installed docker on the main jenkins server
4.Other?
that depends on the version of Docker engine you are about to install and the jobs you want to sue it for ( pipeline , freestyle )
basically if your docker engine is no greater then version 1.11 the best way is to use Docker Plugin from Jenkins if you want to simulate containers as slaves.
you can also use workflow docker plugin and even ssh as you said.
it all depends on what you want to achieve from your docker usage

gitlab CI build runs on my local docker container

I've been trying gitlab and its CI workflow these days, but found myself confused when I saw these messages during a build:
gitlab-ci-multi-runner 0.6.2 (3227f0a)
Using Docker executor with image mydocker:latest ...
Running on runner-5498280b-project-20053-concurrent-0 via jls-MacBook-Pro...
I register a project specified runner instead of using the shared ones.
Is gitlab actually running all the CI build process via my own machine? What if other co-workers push to this project while my computer was off? I just thought that gitlab would provide every project with a cloud CI server... So , I don't want to turn my own computer into such a server. Am I missing something on its docs?
See this Gitlab Docs
Is gitlab actually running all the CI build process via my own machine?
--Yes, Because you specified it. If you don't want to run into your machine, Then deploy the docker to other server.
What if other co-workers push to this project while my computer was off?
--Then, no build will going to happen,

Jenkins building on a remote machine

I can only build my system on a FreeBSD 5 machine.
I am looking and introducing gerrit and Jenkins into my team.
I have setup the server running gerrit and Jenkins both on a Debian machine for now.
What is the standard way of dealing with Jenkins building on a remote server?
The standard way would be to install a Jenkins Slave on the remote server. See https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds
You then setup the job that must be built on a FreeBSD 5 machine, to only only run on that slave/node. This is can be achieved within the job configuration by specifying the FreeBSD machine by name.
If you don't want other Jenkin jobs to run on that FreeBSD machine, you can configure the slave to only run jobs that are tied to it. See step 4 in the JENKINS Step by step guide to setup master and slave machines for the config page that you need to do this.

Resources