Skip to content
This repository has been archived by the owner on Jul 21, 2019. It is now read-only.

Deprecate weburl key in config.toml #455

Closed
mattstratton opened this issue Mar 30, 2017 · 11 comments
Closed

Deprecate weburl key in config.toml #455

mattstratton opened this issue Mar 30, 2017 · 11 comments
Assignees
Labels
Milestone

Comments

@mattstratton
Copy link
Member

Expected behavior

We should be using the Hugo standard patterns of baseURL along with absURL and relURL to generate URLs.

Actual behavior

Instead, we have this wonky weburl key, which makes testing certain things challenging with deploy previews.

Reproduction Steps

No reproduction steps

The overall issue is solved in the netlify.toml section, through judicious use of URL and DEPLOY_PRIME_URL environment variables in the build contexts. That is to say, the baseURL for production should be URL, but for deploy previews it should be DEPLOY_PRIME_URL.

@mattstratton
Copy link
Member Author

This might be super tricky because of the use of the scripts in bin.

@mattstratton
Copy link
Member Author

OK, so the command section supports chaining commands with &&.

So we could change netlify.toml to look like this:

# Production context: All deploys to the main
# repository branch will inherit these settings.
[context.production]
   command = "ln -s /opt/build/repo /opt/build/devopsdays-theme && cd exampleSite && hugo_0.19 --theme=devopsdays-theme --buildDrafts=false --baseURL=URL && gulp --cwd ."
   publish = "exampleSite/dist/"

...

@mattstratton
Copy link
Member Author

This is WAY easier than I thought.

Per some folks at Netlify, you don't use the build variable in the netlify.toml, but they are environment variables that the shell scripts can use.

So this: https://github.com/devopsdays/devopsdays-theme/blob/master/bin/netlify-production.sh#L3

becomes hugo_0.19 --theme=devopsdays-theme --buildDrafts=false --baseURL="$URL"

and this: https://github.com/devopsdays/devopsdays-theme/blob/master/bin/netlify.sh#L3

becomes hugo_0.19 --theme=devopsdays-theme --buildDrafts=false --baseURL="$DEPLOY_PRIME_URL"

This is super messy though, because the value for $URL begins with http and not https, because of netlify reasons, and I can't fix that. So our baseurl will always have http, which will redirect to https in cloudflare, but meh.

@mattstratton
Copy link
Member Author

for this to work, we would need to disable the cloudflare acceleration: https://www.netlify.com/docs/ssl/

Although those same docs say we can use our own cert, which we can get from cloudflare, but the netlify config page doesn't show that option anymore.

@mattstratton
Copy link
Member Author

We aren't the cloudflare CDN in a meaningful way (or at least not in a way that netlify doesn't replace) so it's possible that we could use cloudflare for DNS only. I'm experimenting doing this first on test.devopsdays.org and then I'll try it on dev for a while before considering it in prod.

@mattstratton
Copy link
Member Author

I fixed the netlify scripts in #459; bear in mind that since this is outside of the deployed theme, we will need to do this in devopsdays-web at some point as well before we "fix" this ticket.

@mattstratton
Copy link
Member Author

This depends upon devopsdays/devopsdays-web#2218 being fixed first.

@mattstratton
Copy link
Member Author

OK, so based upon some experimenting with mattstratton/castanet, this won't quite work yet. There's a bug in Netlify where the $DEPLOY_PRIME_URL doesn't match the URL that gets passed over to the PR, so deploy previews get all wonky.

@mattstratton mattstratton modified the milestone: Next Tasks May 11, 2017
@bridgetkromhout
Copy link
Contributor

We aren't the cloudflare CDN in a meaningful way (or at least not in a way that netlify doesn't replace) so it's possible that we could use cloudflare for DNS only.

Per our discussion I'd prefer to remove the cloudflare dependency entirely.

@mattstratton
Copy link
Member Author

It's already gone.

@mattstratton
Copy link
Member Author

Also, Netlify alledgedly fixed the $DEPLOY_PRIME_URL bug, which I'll test when I try to fix this issue.

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

No branches or pull requests

2 participants