Surge CDN for Deployment

Just wondering really if anyone has started using Surge CDN into their workflow when creating Kirby sites. I don’t know a great deal about this stuff but thought others might benefit from it.

http://surge.sh

Ok, maybe I jumped the gun here. I’ve been trying to get it to work. It seems fine uploading to my own server but if I upload to the default surge.sh it doesn’t work. I have a feeling it won’t work with .php files on the surge.sh domain.

Helpful though adding it to a gulp workflow I guess to upload to your own server :smile: although a git hook would probably be more beneficial.

Surge.sh is for static files. If you’re building a web app with a static files build, either perfectly autonomous or getting data from a webservice, it’s a viable hosting solution. It’s not for PHP (or any other server-side process), hence not for Kirby.

If you want to go fully static, you could have:

  • a staging server with a Kirby instance and access to the Kirby panel etc. (hosted on something as limited as shared hosting, one one side)
  • a PHP script that outputs static HTML files for every page of this Kirby website, and perhaps copies over the necessary static content (images, audio and video, pdf, etc.) on the staging server as well
  • a deploy script that puts all the generated and copied over static content to Surge.sh, or any host for that matter

Bastian recently talked about a big project using that kind of setup (a more complex one actually).