Continuous deployment of Pollen-built website #60

Open
opened 4 years ago by odanoburu · 4 comments
odanoburu commented 4 years ago (Migrated from github.com)

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:

  • One could adapt this script to deploy the website anywhere (save Github Pages, maybe?) You're not bound to Gitlab Pages;
  • Does anyone have a container image for this purpose already?
  • The container image I built is simple and it works, but maybe we want to have a more official one, that gets deployed to docker hub automatically and is not tied to my name;
  • If you want to change the Pollen or Racket versions of the build environment you must rewrite the Dockerfile and re-upload it to Docker hub (unless we set up a repository with this deployment automatically made)
  • I used a Dockerfile because Gitlab Pages only uses images from Docker Hub (AFAIK), but the image was built with Podman, which is fully open source (unlike Docker)
I'm building a static website that I want to have [continuously deployed](https://en.wikipedia.org/wiki/Continuous_deployment) to a website. I wanted to write up my experience with [Gitlab Pages](https://docs.gitlab.com/ee/user/project/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](https://pages.github.com/), 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](https://hub.docker.com/r/racket/racket/tags). 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](https://gist.github.com/odanoburu/acc7922a8be34e915290acbeb3afcb47) if anyone is interested! --- Some observations and questions: - One could adapt this script to deploy the website anywhere (save Github Pages, maybe?) You're not bound to Gitlab Pages; - Does anyone have a container image for this purpose already? - The container image I built is simple and it works, but maybe we want to have a more official one, that gets deployed to docker hub automatically and is not tied to my name; - If you want to change the Pollen or Racket versions of the build environment you must rewrite the Dockerfile and re-upload it to Docker hub (unless we set up a repository with this deployment automatically made) - I used a Dockerfile because Gitlab Pages only uses images from Docker Hub (AFAIK), but the image was built with [Podman](https://podman.io/), which is fully open source (unlike Docker)
basus commented 4 years ago (Migrated from github.com)

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

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 (Migrated from github.com)

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.

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](https://github.com/netlify/build-image/pull/381) 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](https://github.com/greghendershott/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 (Migrated from github.com)

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.

> 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`][1]`/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. [1]: https://docs.racket-lang.org/pollen/raco-pollen.html#%28part._raco_pollen_publish%29
odanoburu commented 4 years ago (Migrated from github.com)

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!

`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!
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/pollen-users#60
Loading…
There is no content yet.