Create a Git Repository name "deploycode" add README.md file mention description as deploycodetoremoteserver.
Clone the Git repo to local machine.
Create Git branch as "dev" & "test"
Create index.html file for both branches
kannan@kannan-PC:~/deploycode$ ls
index.html README.md
kannan@kannan-PC:~/deploycode$ cat index.html
<h1>Testcode</h1>
<h1>testcode version-1</h1>
<h1>testcode version-2</h1>
kannan@kannan-PC:~/deploycode$ git branch
dev
main
* test
kannan@kannan-PC:~/deploycode$ git checkout dev
Switched to branch 'dev'
kannan@kannan-PC:~/deploycode$ git branch
* dev
main
test
kannan@kannan-PC:~/deploycode$ ls
index.html README.md
kannan@kannan-PC:~/deploycode$ cat index.html
<h1>Devcode </h1>
<h1>dev code version-1</h1>
<h1>dev code version-2</h1>
- Git add . and commit, Push to the Git repo.
Remote server setup
Create a remote server
Do the "apt update" and and "install apache2" on the both server
Do the the "systemctl start, enable, status of the apache service"
Jenkins setup
Go to Jenkins dashboard > Manage Jenkins > Plugins > "publish over SSH"
Manage Jenkins > System > SSH Servers (Add the SSH server details for dev and test)
- Click on advance "Use password authentication" enter the password for the remote server.
- Test run the configuration to check the remote server connectivity.
Jenkins Project for devserver.
Go to Jenkins dashboard > Add items > Freestyle project> ok
Copy the Git repo http url and mention the branch as "dev"
Select Editable e mail Notification, add the email on "Project recipient list"
- Once done it will automatically Build Now and provides the output on Console output.
- verify the output by http://devserver_ip.
Jenkins Project for testserver.
- Follow the same configuration procedure as the above "General, source code management, Build trigger, Post buils action".
- Only need to modify the Build steps to run the "testserver"
- Once done it will automatically Build Now and provides the output on Console output.
- verify the output by http://testserver_ip.
Top comments (0)