Skip to content

Change Netlify to deploy both UI and website #6167

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

Closed
wants to merge 31 commits into from

Conversation

backspace
Copy link
Contributor

@backspace backspace commented Aug 20, 2019

This makes Netlify build both ui/ and website/. I’ve extracted the
build steps to their own script, as it was getting unwieldy to have
it all jammed into a single line in netlify.toml.

The redirects are dynamic based on whether the branch being deployed
is determined to be for the UI. When that’s the case, visiting /
will automatically forward you to /ui, which was the behaviour before
this PR. For all other PRs, visiting / will show the documentation
root and you’ll have to manually append /ui to see the UI.

Netlify deployments with this scheme are taking significantly longer
as it appears that caching of dependencies isn’t supported for
subdirectories, so the gems and npm packages are being fetched and
rebuilt every time. Some background here:
netlify/build-image#196

@backspace backspace requested a review from a team August 21, 2019 17:00
@backspace backspace marked this pull request as ready for review August 21, 2019 17:01
@backspace
Copy link
Contributor Author

Re the conditional redirection, you can see it in action by visiting the deployment for this branch vs the one for this branch, which I named to follow the UI pattern. The latter jumps directly to /ui.

This may at least permit the caching of gems, which seems
like the slower step.
ugh… the deployment is timing out but I think if I can get
the cache happening for gems, it’ll work…?
This is redundant due to caching, I suppose!
I think this will time out 😞
@backspace backspace removed the request for review from a team August 21, 2019 21:13
@backspace
Copy link
Contributor Author

I’d return this to draft if I could; deployments are now timing out due to exceeding a 15-minute limit. I’ve written to Netlify support.

Copy link
Contributor

@DingoEatingFuzz DingoEatingFuzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! Copying the UI build into the website build to serve both sites is a clever solution to this issue.

The only blocking things are the comment that I think can be improved and then it looks like you have a handful of test commits that can be tidied and squashed.

#!/usr/bin/env bash

# Build the static web site in website/build
# bundle install should be cached???
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you got to the bottom of this in finding netlify/build-image#196

Can you update the comment to speak to this netlify issue?


# Build the static web site in website/build
# bundle install should be cached???
bundle exec middleman build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure this is fine, and I don't know what the equivalent would be if we were to use the docker container setup, but this difference between local development and netlify build gives me pause.

[[redirects]]
from = "/*"
to = "/ui/index.html"
status = 200
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's nice that netlify also offers the _redirects file option.

@backspace
Copy link
Contributor Author

Hey, @DingoEatingFuzz, I’m sorry to have requested review apparently too soon, as someone from Netlify let me know that it’s actually possible to have two different deployments for the same repository. I think that’ll be a better approach as each deployment can proceed from the relevant subdirectory, which will preserve caching. I attempted to retract the review request but I guess it didn’t take! So I’ll look into this option today, I have high hopes 🤞

@DingoEatingFuzz
Copy link
Contributor

Oooooh, awesome!

IT TURNS OUT that there can be multiple Netlify sites for
a repository. They need to be configured via their UI vs
this file, as the file overrides what’s set in the UI.
Since the UI and website don’t need to share a deployment,
this file is unnecessary.
Hopefully this will cause nomad-website to stop showing UI
deployments?
This is decomposed into the web UI configuration of each
of the two Netlify sites.
This isn’t needed since there won’t be anything at / anymore.
@backspace
Copy link
Contributor Author

Closing in favour of #6194.

@backspace backspace closed this Aug 22, 2019
@github-actions
Copy link

github-actions bot commented Apr 9, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants