How can I access my Jenkins dashboard on my remote

2019-08-25 04:43发布

问题:

I'm little confused about Jenkins and was hoping someone could clarify some matter for me. After reading up on Jenkins, both from official docs and various tutorials I get this:

  1. If I wanna set up auto deplyoment or anything Jenkins related, I could just install docker jenkins image, launch it and access it via localhost. That is clear to me.
  2. Then, I just put Jenkinsfile into my repository, so that it knows what and how to build my repo and stuff.

The questions that I have are:

  • It seems to me that Jenkins needs to be running all the time, so that it can watch for all the repo changes and trigger code building, testing and deploying. If that is the case, I'd have to install Jenkins on my droplet server. But how do I then access my dashboard, if all I have is ssh access?
  • If Jenkins doesn't need to be up and running 24/7, then how does it watch for any changes?

I'll try to deploy my backend and front apps on docker-compose file on my server. I'm not sure where does Jenkins integrates in all that.

回答1:

  • How Jenkins can watch for all the repository changes and trigger code building, testing and deploying?
  • If Jenkins doesn't need to be up and running 24/7, then how does it watch for any changes?

    • Jenkins and other automation servers offer two options to watch source code changes:

      • Poll SCM: Download and compare source code at predefined intervals.This is simple but, hardware consumption is elevated and is a little outdated
      • Webhooks: Optimal functionality offered by github, bitbucket, gitlab, etc. in which Github, for example, at any git event, makes an http request to your automation server, sending all the information like branch name, commit author, etc). Here more info about webhooks and jenkins.
    • If you don't want a 24/7 dedicated server, you can use:

      • Some serverless platform or just a simple application able to receive http posts + webhook strategy. For instance, Github will perform a post requet to your app/servlerless and at this point, just execute your build, test or any other commands to deploy your application.
      • https://buddy.works/. It is like a mini-jenkins.
  • If I'd have to install Jenkins on my droplet server. But how do I then access my dashboard, if all I have is ssh access?

    • Yes. Jenkins is an automation server, so it needs its own dedicated server.
    • You can install jenkins manually or use docker in your droplet. Configure 8080 port for your jenkins. If everyting is ok, just access to your droplet public ip offered by digitalocean, like: http://197.154.458.456:8080. This url must load the Jenkins dashboard.