mbutterick / pollen-users

please use https://forums.matthewbutterick.com/c/typesetting/ instead
https://forums.matthewbutterick.com/c/typesetting/
52 stars 0 forks source link

Continuous deployment of Pollen-built website #60

Open odanoburu opened 4 years ago

odanoburu commented 4 years ago

I'm building a static website that I want to have continuously deployed to a website. I wanted to write up my experience with Gitlab Pages here in case it helps anybody (since this repository has helped me so much I should at least try to give back!)

Because Gitlab Pages is very similar to Github Pages, it shouldn't be too hard to adapt this to work with it.

To deploy a website to Gitlab Pages we need to write a script specifying the environment used to build the website files and how to build them (see the documentation linked above for the details). Gitlab Pages allows you to use a container image from Docker Hub as your environment, so I grabbed Racket's container image. To speed up the build I tried caching the pollen installation (so that it wouldn't reinstall it at every build), but alas I was taking too long to figure out how to do it so I created a new container image. This new image is built on top of the Racket one, and simply specifies an additional step of installing pollen.

The build/deploy script is very simple, it just calls pollen render and moves the output files to a special directory that gets deployed by Gitlab Pages (does pollen render have an option to specify an output directory? it would simplify things!)

The deploy script and the Dockerfile that build the container image are in this gist if anyone is interested!


Some observations and questions:

basus commented 4 years ago

That's very cool! My personal approach is to build everything locally and rsync only the output HTML files to my server.

otherjoel commented 4 years ago

Timely thread. I’ve used plain old rsync before now as well, but I’ve been looking into repo-based auto-deploy as well.

Netlify is sitting on a PR that would add Racket support and dependency caching. I’ve been hoping they would approve it for a couple of months now.

It looks like it should be possible to use Travis CI for this, deploying to an S3 bucket. Greg Hendershott has travis-racket for this. I was planning to try this out and write up a how-to sometime soon, but if anyone else does so first I definitely won’t be mad.

otherjoel commented 4 years ago

does pollen render have an option to specify an output directory? it would simplify things!

You can follow up a raco pollen render with raco pollen publish/project/folder /path/to/output. The output folder will contain the contents of the project folder minus any pollen sources or cache files. So there could be additional files in there that you might want to remove but that will get you very close.

odanoburu commented 4 years ago

rsync seems like a great solution if you have a server available! if you set up a git hook so that it runs at every commit or push, I'd say it might even be better than the CD approach

Netlify is sitting on a PR

I've added my thumbs up if that helps anything, I don't see why they'd take so long… we could try the same thing for gitlab (does github have this option of creating new custom images too?)

You can follow up a raco pollen render with raco pollen publish/project/folder /path/to/output

thank you :) that should do it!