How to deploy to shared hosting?

Hi there!

I’m just getting started with converting my first Jekyll site and am trying to figure out what the best way is to deploy the site once I have it complete locally and ready to go. I have my own hosting, and have been trying to dig up the best options. Here’s what I’ve found for choices:

  1. Create a copy of the git repo on the server, and then use .htaccess to redirect the root to the _site folder.
  2. Use a sparse checkout to just check out the _site folder on the server, but still use git to deploy
  3. Build the site on the server whenever changes are pulled into specific branch.
  4. Push just the static files as their own repository, and have a second repository for the source.

I’d like to try to build locally, just to experience being very independent of the server, but only as long as that seems like as rational a choice.

Any thoughts or resources about evaluating which among these choices makes the most sense?

Thank you!

I go with option 5 - use S3 for hosting along with S3_website gem to publish. I have an existing web server I could use to host, but S3 is easier, more bulletproof, easier ssl, easy redirects… and it is practically free for normalish sites. I do think it is slightly slower than if I hosted on my server directly though - I think there is a little more latency on S3 than there should be but it isn’t an issue.

of your choices, # 3 requires jekyll to run on the server - have you tested that yet? seems like a potential pain point.

It sounds like you are committing the _site folder to git, if that is the case and and you can do a hook (?) on the server to pull your latest commits as needed then I probably would go with #1 or # 2. I don’t know how to do that so you are likely way ahead of me on git stuff. Or would you login to the server to do a pull?

I think you could also deploy with gulp and rsync maybe.

If #3 is something you are looking forward to, I would suggest to give a try to Caddy web server. It is a super-cool piece of technology featuring amazing stuff, like listen to an individual Git repository for changes and trigger custom actions (like executing bash script or running build command of your favorite static site generator) whenever the change is detected.

Moreover, Caddy features native integration with LetsEncrypt which is mind blowing.

Hope that would give your project a step in the right direction.

Thank you so much for the thoughts, I appreciate it! I ran into the issue of Jekyll taking a very long time to build each time I made a change (I had 200 posts and it took about 10 seconds), so I started looking at other static site builders and am currently experimenting with Hugo, which seems quite a bit faster. The options you listed are still relevant, though, so thank you!

Good luck! By the way Caddy has already a plugin for Hugo, so you might actually enjoy a very nice bundle to build & run your blog seamlessly.