Automatically building a Jekyll blog on Hostwinds VPS?

How can I do this? I would like it to build the site like it does on Github Pages whenever a change is made.

Thanks

You can probably do this with Github webhooks, although the detail depend a lot on the server-side stack. More info:

I’m not sure how this would work. Can I not set up the server to build the site?

Thanks

I think that is what he is saying the webhook helps with. How are you going to do changes on the server? by committing code to GH? or by making changes on the server directly?

Via FTP into the server

ah - maybe gulp could be running to monitor that folder and on change it rebuilds the site.

I use gulp in development to do this very thing, works great.

Maybe this will help - mostly about using gulp for asset processing, but the gulp task itself would do what you want I think:

https://rdyar.github.io/2017/10/01/speed-up-jekyll-by-using-gulp-for-sass-and-other-assets/

Thanks, I’ll take a look!

course it assumes your vps allows you to install things and do that. Which may not be the case.

Sorry, I though you already had your server setup to build the site and just wanted advice on automating the process. Here is the full setup you would need in summary:

  • Setup server with necessary tools to update and build site (git, ruby, jekyll, etc.)
  • Clone the site repo to the server (optionally do manual test builds with Jekyll)
  • Add a webhook end-point script (written in CGI, PHP, or whatnot) to receive a POST from Github and then update and build the site (i.e. basically running something like git pull && jekyll build)
  • Setup a webhook on Github to post to the end-point on server.

After that, a push to Github will trigger the end-point script on the server causing it to pull new changes from Github and rebuild the site. Of course, there are many detail that depend on the specifics of the VPS’s OS, web server, etc.

1 Like