Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for processing / Makefile / etc #1

Open
schollz opened this issue Mar 21, 2024 · 4 comments
Open

support for processing / Makefile / etc #1

schollz opened this issue Mar 21, 2024 · 4 comments

Comments

@schollz
Copy link

schollz commented Mar 21, 2024

I often use Hugo or Jekyll for static sites. is there a way to include a hook to tell disco to build the static site? or would the solution be to include a Dockerfile that builds the site and binds it to a volume (might be better in case of Jekyll which had dependency nightmares sometimes)?

@antoineleclair
Copy link
Member

antoineleclair commented Mar 21, 2024

Hey @schollz!

Thanks for the question and feedback.

It's definitely in the plans to have something specifically for that.

The plan would be to still rely on Docker and a Dockerfile to have all the dependencies, and then define a command that would run when deploying.

Just drafting, a disco.json file could look like that:

{
    "version": "1.0",
    "services": {
        "web": {
            "type": "static",
            "publicPath": "/dist"
            "buildCommand": "jekyll build",
            "volumes": [{
                "sourcePath": "/src",
                "destinationPath": "/src"
            },{
                "sourcePath": "/dist",
                "destinationPath": "/dist"
            }]
        }
    }
}

For now, two ways to work around the fact that it's not directly possible yet would be to build and commit to either the same repo, or a separate "deployment repo", or instead of trying to let Disco serve the static files, you could run the server in your app. For the second option, have a look at this other example (Django) that has a "pre deploy" command: https://github.com/letsdiscodev/example-django-site/blob/4028c926b9a85efd2800b9362c6d2c10c67d1ff4/disco.json#L9-L14

I'm leaving this issue open since we'll be working on this soon.

@gregsadetsky
Copy link
Member

gregsadetsky commented Mar 21, 2024

some comparison notes below


render does it like this for reference:

https://docs.render.com/deploy-hugo

they run a pre-installed hugo which is both convenient but not great since then the hugo version can't be controlled for instance. there's a thread on this topic here:

https://community.render.com/t/how-to-define-hugo-version/390/9

(they go through the manual hugo installation steps in that thread)


fly is heavier since you're defining everything with dockerfiles, and need to handle the caddy installation:

https://fly.io/blog/hugo-s-there-flying-with-hugo-and-caddy/

they end up using this docker image


for github pages, there's this github actions that takes care of installing hugo

@gregsadetsky
Copy link
Member

gregsadetsky commented Mar 23, 2024

hey @schollz , @antoineleclair worked his usual magic and we now fully support static-sites-with-build-steps!

hugo docs are here: https://docs.letsdisco.dev/tldr-guides/deploying-a-hugo-static-site
example hugo repo is here: https://github.com/letsdiscodev/example-hugo-site

all of the good stuff happens in that repo's disco.json -> we pull the floryn90/hugo docker image, and, as its entrypoint is the hugo binary, we pass in the disco.json command the build instructions + directory destination

deployments are ......... scarily fast. I'm very honestly not used to cloud deployments this fast. I recorded this video where I make a small change to the example hugo site and continuously wget+grep the site. it takes 3 seconds from git push to the site being built + made live. 3!!!. 3!!!!!!!!!!! :-)

let us know what you think / if this works!! cheers

p.s. jekyll's coming too! DONE! see below

@gregsadetsky
Copy link
Member

... and Jekyll works now too!

docs: https://docs.letsdisco.dev/tldr-guides/deploying-a-jekyll-site
example repo: https://github.com/letsdiscodev/example-jekyll-site

let us know!! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants