Skip to content

feat: add 'back/front end' in curriculum#42596

Merged
moT01 merged 21 commits intomainfrom
wip/certification-rename
Aug 14, 2021
Merged

feat: add 'back/front end' in curriculum#42596
moT01 merged 21 commits intomainfrom
wip/certification-rename

Conversation

@ShaunSHamilton
Copy link
Member

Checklist:

  • I have read freeCodeCamp's contribution guidelines.
  • My pull request has a descriptive title (not a vague title like Update index.md)
  • My pull request targets the main branch of freeCodeCamp.
  • I have tested these changes either locally on my machine, or GitPod.

Closes #42502
Closes #42444

@ShaunSHamilton ShaunSHamilton requested review from a team June 22, 2021 12:16
@gitpod-io
Copy link

gitpod-io bot commented Jun 22, 2021

@github-actions github-actions bot added platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. scope: i18n language translation/internationalization. Often combined with language type label scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. labels Jun 22, 2021
@ShaunSHamilton ShaunSHamilton marked this pull request as draft June 22, 2021 12:17
@ShaunSHamilton
Copy link
Member Author

Comment:

With this current change, old challenge links will 404:

- /learn/apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice
+ /learn/back-end-development-and-apis/back-end-development-and-apis-projects/file-metadata-microservice

Mrugesh mentioned the possibility to re-route: https://github.com/freeCodeCamp/client-config/blob/master/serve.json

However, this change can be reverted. CC @ojeytonwilliams


Also, if this re-route is accepted, I will change the links in the READMEs throughout the codebase. By 'I', I mean create an issue, and get help

@raisedadead
Copy link
Member

raisedadead commented Jun 22, 2021

Mrugesh mentioned the possibility to re-route

@ojeytonwilliams

Just to add if implemented that would still be a temporary patch until we can manage redirection with the webserver (NGINX Configs???) that would sit on top of the static client applications when we move an S3-Minio-NGINX based setup.

@majestic-owl448
Copy link
Contributor

majestic-owl448 commented Jun 22, 2021

All the links in the Guide are to be changed? Please ping if rerouting is a no go, and I will work on it

@raisedadead
Copy link
Member

The idea is no-one (especially backlinks, including links in Guide) should be affected each time we change URLs. There should be systems in place to handle all this.

@ShaunSHamilton
Copy link
Member Author

Re-pinging @ojeytonwilliams for thoughts

@ojeytonwilliams
Copy link
Contributor

Sorry for not getting back to you - I need to manage my notifications better.

As for redirections, I'm heavily in favour of using the existing URLs. My rationale is as follows: every time we create a special case we're making a maintenance headache for our future selves. We also increase the chances that we accidentally break the backlinks whenever we change the infrastructure. They're just one more set of things to potentially forget.

We could handle this via serve, but I don't like that for two reasons. Firstly, we're planning to replace serve somewhat immanently. Secondly, separation of concerns - we already have a reverse proxy (NGINX), so it would be better to let it handle all the redirection logic.

If we're going to do it all, I'd say handle it via NGINX, but I'd prefer to leave the urls as they are.

@ShaunSHamilton
Copy link
Member Author

I'd prefer to leave the urls as they are.

@ojeytonwilliams In that case, we are ok with the file name and title divergence?

@ojeytonwilliams
Copy link
Contributor

we are ok with the file name and title divergence?

Well, unless there's a third option I'm missing, we have to be.

@raisedadead any further thoughts on this?

@raisedadead
Copy link
Member

In that case, we are ok with the file name and title divergence?

That's a hard no.

That would mean someone (particularly some innocent contributor) will end up getting confused.

As I understand this migration needs a form of automatic redirection handling, which we can handle several places, including but not limited to the web server, the reverse proxy, client app etc.

In theory, you want to redirect a user at the first interaction, ideally on the proxy. However, as I see now it the fix needs to be done much deeper than the app server (my previous proposal), i.e within the client app bundle.

Here is a plugin that we should investigate on implementing (alongside its counterpart for picking up the meta): https://www.gatsbyjs.com/plugins/gatsby-redirect-from

@ojeytonwilliams
Copy link
Contributor

That would mean someone (particularly some innocent contributor) will end up getting confused.

They'll get more confused if we mess up a migration down the line and break things. Also, they'll only get confused if they actually read the url which I doubt many people do.

That aside, why would we need to handle this in the client? We really should consolidate this in one place, including moving the current redirects which serve is handling (https://github.com/freeCodeCamp/client-config/blob/master/serve.json). Given that NGINX is the only single place that can handle all of our redirection, I think we should let NGINX handle it.

@raisedadead
Copy link
Member

IMHO, being in the field of ever-evolving tech education, we are in the business of migrations.

We will introduce and remove certifications (and break things) all the time, and we should embrace that change is part of the game (it's never going to be a smooth ride).

This current migration is a need of an SEO indication. The stakeholders most affected by these migrations are currently active users, followed by our currently active contributors.

For example, earlier today, I had someone in the chat confused about "zipline" challenges. We still support a legacy challenge in the codebase and DB because users have claimed certifications in the past. All of it still works. Not many of our currently active users do not know or care about it.

That's how migrations should work. Yes - it's a pain for maintainers, but like it or not, that is the job.

Let me establish the goals real quick:

  1. A change in cert names, URLs, etc., meets the signals given to us via the SEO parameters.

    This is already established and should be uniform and avoid all confusion when a non-maintainer looks at them.

  2. All secondary needs like backlinks, legacy implementations, etc., should keep working by employing 'smart' systems viz. automatic redirects.

  3. Designing such systems (where systems are ideas, concerns, workflows) without being married to any particular technology or tool (that is, avoid bias). We should be working on self-contained systems that can be rearranged for reliability and scale.

The idea is to achieve the goals in the order above and be innovative where we can.

Now coming to the intent, we want to decouple things as gracefully as possible to get close to the "separations of concerns" philosophy.

Here is what I think of it:

  1. NGINX is one piece of the puzzle that we have been abusing because it is a swiss army knife. We have been throwing redirect maps and setting headers on it because we can - not because we should.

  2. The goal for the proxy layer is to become a pure "transparent" proxy layer in our stack for our load balancing and blue-green release requirements. The job of the transparent proxy is to be dumb to the layers below it.

  3. The cert name re-mapping is a logical change in the curriculum. We offer this as a client (here, client means a SPA built with Gatsby). And logic states it should be the concern of the client.

So, where should we handle application logic? Where should we isolate the concerns of the client redirections? Where can we keep a history of the migrations that affected the curriculum that would not confuse future contributors?

I believe it should be in the client & curriculum code.

Yes - intercepting bits at the proxy layer will let us redirect users at will and is even fast and cheap. But not long term. As the usage of older URLs tapers off, the NGINX maps are all looked up on each request due to their static nature. An example of this is 1000+ line guide article URLs. Luckily they are on a subdomain that is not in much use.

Marrying our client app logic to both Gatsby and NGINX leaves us less flexible for future scalability and expansions. It's certainly not being self-contained, at the very least.

By having all logic on the client, we introduce a dynamic redirect only for the user requesting a legacy path, essentially at the same cost of maintenance.

Those are my two cents.


As for moving forward with this PR:

  • We should ensure that the slug, file pathname, filename and challenge name have parity.
  • Come up with a way that tries to keep one application's logic as close-knit as possible.

I will defer to both of you on this, not against any ideas and whatever is the best approach in your opinion works for me.

@ojeytonwilliams
Copy link
Contributor

A change in cert names, URLs, etc., meets the signals given to us via the SEO parameters.

Just to clarify, you mean the URL should match the content of the page as closely as possible? i.e. it's a bad SEO signal to have the url be /apples if we've changed the content to be about pears.

I wrote a small essay before I realised the source of our disagreement. I see "directing requests to the client" as being a separate concern from the client itself (whose concern is basically handling those requests) and it sounds like you don't.

With that in mind (and because we're trying to avoid over-using NGINX) my preference would be to use serve to handle redirection. In my head that's a sensible separation of concerns. I appreciate that we're not going to use serve forever, but it's trivial to implement (also we can use Cypress to guard against breaking of backlinks).

If we have to handle it inside Gatsby, we can, but it ain't pretty. To the best of my knowledge, we have two okayish options

  1. Add <Redirect from="page-a" to="page-b" /> components to 404.tsx
  2. Add in <meta http-equiv="Refresh" content="0; url=page-b" /> to page-a, presumably via https://github.com/nsresulta/gatsby-plugin-meta-redirect

The issue with 1. is that we're further abusing the 404 page and returning 404s for those links. 2. might be okay, but the browser support is iffy: https://caniuse.com/mdn-html_elements_meta_http-equiv_refresh it's also generally recommended to use a 301 redirect if you can. Also, the Gatsby plugin didn't work for me, though it should be easy enough to roll our own.

@raisedadead
Copy link
Member

I am mostly in agreement with you here, having known the codebase and its evolution I understand how the nuances and decisions we made in the past could be limiting us here.

As I said in my earlier proposal (not happy, but will work), to go with a config for serve and keep this PR moving while we work on the tooling that will address our requirements better.

Moving the logic into Gatsby's routing would be the most ideal because at the end of the day the client is a SPA. I am not sure how involved it is, but Gatsby has come through a few iterations from when we started, and I have no clue if there is a way to hook into something either at build time or at run time to achieve the desired result.

The app logic related changes we throw in on NGINX should be a last resort type thing, to give us the most flexibility and scalability (if we want to be able to do multi-region, shared deployments, etc.) in future.

@ojeytonwilliams
Copy link
Contributor

As I said in my earlier proposal (not happy, but will work), to go with a config for serve and keep this PR moving while we work on the tooling that will address our requirements better.

I think that's probably the easiest short term solution. Before I do that, I'll write some tests for this, since we want these routes to exist forever and survive us changing our minds/tooling.

Gatsby has come through a few iterations from when we started, and I have no clue if there is a way to hook into something either at build time or at run time to achieve the desired result.

It should be possible to use a build hook to add that meta tag. I can look into creating a plugin that works for our use case.

The app logic related changes we throw in on NGINX should be a last resort type thing, to give us the most flexibility and scalability (if we want to be able to do multi-region, shared deployments, etc.) in future.

Righto. I'm definitely guilty of using NGINX as a first resort, but I see that I'm too keen to reach for it.

@ShaunSHamilton
Copy link
Member Author

Just final clarification: Are we redirecting certification URLs?

That is, should the certSlug change from apis-and-microservices to back-end-development-and-apis?

@github-actions github-actions bot added platform: api Server application that needs familiarity with Express, Fastify, MongoDB etc. scope: docs labels Jul 7, 2021
@ojeytonwilliams
Copy link
Contributor

Just final clarification: Are we redirecting certification URLs?

If we're gonna change some things, we'd best change the rest. If anything's going to be confusing, it'll be inconsistency.

@raisedadead
Copy link
Member

I might be mistaken, but we will need to do some form resetting/purging on Crowdin as well before/after we merge this.

@ShaunSHamilton ShaunSHamilton marked this pull request as ready for review July 8, 2021 12:34
@ojeytonwilliams
Copy link
Contributor

@raisedadead which backlinks do we want to maintain? The certifications, obviously, but what about https://www.freecodecamp.org/learn/front-end-libraries/ and sub-paths and https://www.freecodecamp.org/learn/apis-and-microservices/ and sub-paths?

@raisedadead
Copy link
Member

raisedadead commented Jul 8, 2021

which backlinks do we want to maintain?

Any and all links that are navigable/shareable at some point need to be preserved. If I am able to share a link in the wild, it needs to be made reachable via its current equivalent.

@raisedadead raisedadead removed the MERGE CONFLICT! To be applied to PR's that have a merge conflict and need updating label Aug 11, 2021
Copy link
Member

@naomi-lgbt naomi-lgbt left a comment

Choose a reason for hiding this comment

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

Need to change the download directory too.

Co-authored-by: Nicholas Carrigan (he/him) <nhcarrigan@gmail.com>
@ojeytonwilliams
Copy link
Contributor

@raisedadead

The deployment sequence for this will need to be

  1. merge feat: redirect to new curriculum paths client-config#4
  2. restart tests on this PR
  3. deploy to production
  4. change the client-config in production

That way all the tests should pass, but the redirects start happening until the new routes exist.

Does that make sense?

@freeCodeCamp freeCodeCamp deleted a comment from github-actions bot Aug 13, 2021
@freeCodeCamp freeCodeCamp deleted a comment from github-actions bot Aug 13, 2021
@freeCodeCamp freeCodeCamp deleted a comment from github-actions bot Aug 13, 2021
@freeCodeCamp freeCodeCamp deleted a comment from github-actions bot Aug 13, 2021
@freeCodeCamp freeCodeCamp deleted a comment from github-actions bot Aug 13, 2021
@freeCodeCamp freeCodeCamp deleted a comment from github-actions bot Aug 13, 2021
@freeCodeCamp freeCodeCamp deleted a comment from github-actions bot Aug 13, 2021
@freeCodeCamp freeCodeCamp deleted a comment from github-actions bot Aug 13, 2021
@github-actions
Copy link
Contributor

Thanks for your pull-request.

We are no longer accepting changes to the non-English versions of files in parts of this codebase. This pull-request seems to change some of those. Please visit our contributing guidelines to learn more about translating freeCodeCamp's resources.

As always, we value all of your contributions.

Happy contributing!


Note: This message was automatically generated by a bot. If you feel this message is in error or would like help resolving it, feel free to reach us in our contributor chat.

Nicholas Carrigan added 2 commits August 13, 2021 18:15
Okay so I literally have no idea why this one particular challenge
fails in Cypress Firefox ONLY. Tom and I paired and spun a full build
instance and confirmed in Firefox the page loads and redirects as
expected. Changing to another bootstrap challenge passes Cypress firefox
locally. Absolutely boggled by this.

AAAAAAAAAAAAAAA
Okay apparently the test does not work unless we separate it into
a different `it` statement.

>:( >:( >:( >:(
@github-actions
Copy link
Contributor

Thanks for your pull-request.

We are no longer accepting changes to the non-English versions of files in parts of this codebase. This pull-request seems to change some of those. Please visit our contributing guidelines to learn more about translating freeCodeCamp's resources.

As always, we value all of your contributions.

Happy contributing!


Note: This message was automatically generated by a bot. If you feel this message is in error or would like help resolving it, feel free to reach us in our contributor chat.

Copy link
Member

@moT01 moT01 left a comment

Choose a reason for hiding this comment

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

🎉 LGTM 🎉

@moT01 moT01 merged commit c2a11ad into main Aug 14, 2021
@moT01 moT01 deleted the wip/certification-rename branch August 14, 2021 02:57
@naomi-lgbt naomi-lgbt mentioned this pull request Aug 14, 2021
4 tasks
@moT01 moT01 mentioned this pull request Aug 27, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: api Server application that needs familiarity with Express, Fastify, MongoDB etc. platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. scope: i18n language translation/internationalization. Often combined with language type label scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change cert name to "Front End Development Libraries" on settings page Rename APIs and Microservices to include "Backend"

8 participants