All that a website deployment requires is a deploy script. Twenty or thirty lines of bash code should do it.  Of course if there is an easy way to do things the complicated method is just around the corner. Jenkins an open-source automation server written in Java. Today’s mission: deploy the Orinoco project in a Xampp environment using Jenkins.

Installation

  • download the Jenkins 2.32.3 windows zip file
  • In it run the msi installer
  • this will create C:\Program Files (x86)\Jenkins

Running Jenkins.exe located here generates an error as it attempts to open a Windows Service Wrapper. Instead the Jenkins webinterface can be accessed directly in the browser as localhost:8080. In the task manager one of the tasks is called the Windows Service Wrapper and in this wrapper Jenkins.exe is executed.

Next:

  • In the setup procedure enter the password with C:\Program Files (x86)\Jenkins\secrets\initialAdminPassword
  • install all the suggested plugins
  • setup the admin user and we are done
  • The language is set by the browser and if this is not desired set the locale
  • Manage jenkins >> manage plugins >> install the locale plugin and opt for Jenkins reboot
  • then: Manage jenkins >> configure system.  In the locale section set Default Language = en_EN and force this language. The interface language is now English

Creating a job

We now have an unbuilt orinoco project and it must be built once to create a workspace. If the build is successfull the console output should be

Started by user me
Building in workspace C:\Program Files (x86)\Jenkins\workspace\orinoco
Finished: SUCCESS

For the actual git project to be deployed,  add to Source Code Management the git url  as above (credentials: none , the repository  is public). The default branch is */master. Build project again: the project is deployed in the project is built in C:\Program Files (x86)\Jenkins\workspace\orinoco

This is not the desired location so the workspace should be changed:

  • in the project configuration select the “advanced” button located after the github project project url
  • check the “use custom workspace” option and enter C:\xampp\htdocs\orinoco.jenkins as the directory
  • In the next build, the project deploys in the xampp environment and the site url orinoco.jenkins.localhost is accessible

The next step is creating the dependencies:

  • In the project configuration do build >> add build step >> Execute shell
  • This will generate a build error:  FATAL: command execution failed
    java.io.IOException: Cannot run program “sh” (in directory “C:\xampp\htdocs\orinoco.jenkins”):
  • Instead use the execute Windows batch command
  • As command enter composer install

In the next build the composer install command is executed. The website is now deployed.

Links

 

 

 

 

 

Advertisements