0

I want to know how to configure Jenkins with my live preprod instance server ?

Let me to explain you my process and tell me if I'm right and if that's not the good way to do.

1) I have my project project-1 in a server: /var/www/preprod/project-1, this project is in Magento Cms so it contains many files.

2) I copied this project project-1 in a repo Git, repo = project-1.

3) I cloned this project from this repo Git to my local machine: MAMP/htdocs/project-1.

4) I installed Jenkins, and I configured it with git, So when I do some push, Jenkins do a build automatically.

Now what I want to do is after the build, I want Jenkins to upload these changes to my live preprod server, whether automatically and manually.(I want to know the method to do it manually and automatically).

With this method, I develop in my local server, so when I finish some task and it's done, I push it to Git to have the changes history, and after that my need is to push it to the live server.

So tell me please if I'm using the right method, if it's a good practice and what I miss for this continuous deployment & delivery.

prc
  • 187
  • 2
  • 14

1 Answers1

1

You can push it to the server using the Publish over SSH command if your doing a freestyle job https://wiki.jenkins.io/display/JENKINS/Publish+Over+SSH+Plugin, If you are doing an pipeline then you can do a simple scp command...

you can run this after the build is completed and it will run it automatically for you ...

Manually you will be notified when a build is done then you would copy it into your server using the normal way you would do it i.e.copy and paste...

Jenkins is a automation server. The whole point of using jenkins is to automate things so that you "manual" intervention is not required. So automate it where ever possible.

Hope it helps :)

rohit thomas
  • 2,302
  • 11
  • 23
  • ok, thank you for your reply. so the best is to use a pipe line right ? and with the scp command you mean I copy all files foreach time ? but what I want is to copy just the files that i change and not the all project because my project weights 900 Mo, you image if I copy all this foreach time ! – prc Jun 10 '18 at 09:47
  • Pipeline is the best yes ... Because you have more control ... So just copy the files that you need... So when implementing the pipeline you'll know which files are changed or needed and use scp to copy only those files to the server – rohit thomas Jun 10 '18 at 13:46
  • Okey, thanks, last think: After each push, jenkins do a build cool that what i want but I noticed that he copy the whole project in `/Users/Shared/Jenkins/Home` it's normal ? he don't get just the changed files ! when I checked the first build log, I seen that he did a clone of the project. So at the end : I have the project in : 1 `wamp->htdocs`, 2 `git->repo`, 3 `live server (for the preprod)`, 4 `Jenkins (for the build)` ! is my method good ? – prc Jun 10 '18 at 17:20
  • Yeah that's how it works since in the 2nd step "git->repo" will check out the files from the repo...if you do not want the previous build data, you can use the discard build option--> mentions how many days you would like to keep them.Useful in a situation you which to see the previous build when a build fails :) also the build should happen then pushed into server...I think 3 and 4 should be switched :) – rohit thomas Jun 11 '18 at 03:25