I have a static website that I would like to deploy to my Apache2 server using Jenkins. I think of 2 solutions:
- Should I change the workspace dir of Jenkins to /var/www/?
- Or should I copy all files in workspace to /var/www in post build?
DevOps Stack Exchange is a question and answer site for software engineers working on automated testing, continuous delivery, service integration and monitoring, and building SDLC infrastructure. It only takes a minute to sign up.Sign up to join this community
As mentioned, there are many ways to accomplish the final goal of exposing a site built from a Jenkins job to public traffic.
Both ideas could work, but here are some tweaks.
The decision depends on the requirements of the site. If it is static with no promise of up-time, a symlink will work fine, however if the Jenkins job breaks and breaks the workspace version of the site, the actual site will be down. I would recommend using rsync and adding a validation step between the build and rsync to ensure the site stays up.
Final note, using git or other scm provides backups which can be tagged. If the current build breaks, rolling back would be easy. However, if there is no scm (not recommended), keep some segregation between the build and live site to ensure it is not broken for an extended amount of time.