Search code examples
amazon-web-servicesubuntujenkinscmdjenkins-pipeline

Deploy Jenkins pipeline to AWS server


first, I have two AWS Ubuntu servers that I can access by windows cmd using ssh and pem key. However, I have Jenkins installed on one of them.

I have a task which is to use Jenkins Pipeline from the first server to deploy simple files from GitHub repository into the second server. To clarify, the result in server 2 should be the files output from GitHub that is managed by Jenkins in server 1.

In other words:

Server 1: IP = XXX.XXX.XXX.XXX:8080 that contains Jenkins used to manage the output for server 2.

GitHub: NodeJs and HTML file that outputs "Hello World".

Server 2: IP = YYY.YYY.YYY.YYY should output "Hello World" by just using the IP as URL.

So, I,m new to this and looking for step by step explanation. Thanks!


Solution

  • Step 1: Install nginx server 2, config the nginx and know the location where the static files are served.

    Step 2: Bring the ssh key to server 1, install nodejs, rsync in server 1 and also create a Jenkins pipeline which can pull the source code from Github, install and build that source code, and rsync to the location where the nginx serves content

    I think this is a simple and easy way for you to setup. There are many better ways and you should research how Jenkins and Node work