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

Document Ngrok for VA debugging / QA #17306

Closed
4 tasks done
jilladams opened this issue Feb 21, 2024 · 2 comments
Closed
4 tasks done

Document Ngrok for VA debugging / QA #17306

jilladams opened this issue Feb 21, 2024 · 2 comments
Assignees
Labels
Documentation Public Websites Scrum team in the Sitewide crew sitewide Technical debt VA.gov frontend CMS team practice area

Comments

@jilladams
Copy link
Contributor

jilladams commented Feb 21, 2024

Description or Additional Context

NGrok is a tool that provides a URL where folks can reach test instances of code in development for verification. Public Websites uses this a lot, and we could document so others can take advantage.

This could / maybe should become a part of FE dev tools, https://depo-platform-documentation.scrollhelp.site/developer-docs/tools, so write up in ticket is fine, and then let's ask Plat to put it in their site.

Acceptance Criteria

  • Write up "how to ngrok" and include
    • Set up steps
    • Use cases
  • Cut a Plat docs ticket with details they can use to add ngrok docs to their site
@jilladams jilladams added Needs refining Issue status VA.gov frontend CMS team practice area Technical debt Public Websites Scrum team in the Sitewide crew Documentation labels Feb 21, 2024
@FranECross FranECross removed the Needs refining Issue status label Feb 22, 2024
@randimays randimays self-assigned this Apr 5, 2024
@randimays
Copy link
Contributor

randimays commented Apr 8, 2024

How to use ngrok for testing local development builds

What is ngrok?

ngrok (pronounced en-grok) is an environment independent reverse proxy. One of the many conveniences it provides is the ability to demo or share a working build without deploying to a test or staging environment. Put simply: you can use ngrok for testing your code before it is merged to the main branch.

See “What is ngrok?" and "How does ngrok work?” for more detail.

When would I use ngrok?

If there are infrastructure hurdles or environment issues preventing you from sharing your local build, such as:

  1. Review instances not working
  2. Tugboat not working
  3. Recipient does not have SOCKS access
  4. Build must be tested on a mobile device

ngrok can be used as an alternative solution.

Note: A free ngrok account has usage limitations. See the Gotchas section below for more detail.

How do I use ngrok?

Refer to the Quickstart guide for installation instructions. You will need to create an account.

Running the ngrok server

  1. Run your local vets-website build (e.g. yarn watch)
  2. Run your local content-build build (e.g. yarn watch)
  3. Verify that http://localhost:3002 loads successfully in your browser
  4. In a different Terminal tab, run ngrok http 3002 (the port should match your current localhost port)

The ngrok command will produce a unique URL for you to navigate to on any device.

In the below example, the Forwarding address before the -> is what you'll use on the device. You can add any paths (e.g. /health-care) after this address to get where you need to go.

Screenshot 2024-04-08 at 9 47 49 AM

If you make changes to the code locally, you will need to:

  1. Wait for your local vets-website build and content-build build to compile completely
  2. Verify http://localhost:3002 loads successfully in your browser
  3. Stop the ngrok server in your Terminal (ctrl+c / cmd+c)
  4. Run the ngrok http 3002 command again (note: this will give you a new URL)

First time building content-build?

When you build content-build for the first time, it will pull all of the assets from Drupal (images, videos, templates). This can take upwards of 8 hours.

Reach out to the #sitewide-public-websites channel in Slack for some guidance on how to speed up a build (provided you can test your changes without some Drupal assets).

Gotchas

ngrok usage with a free account

Your free ngrok account will be limited in its monthly bandwidth, HTTP requests, tunnels, etc. See ngrok licensing information for specifics.

If at any point you receive an error message to this effect when trying to run ngrok commands, you will have to wait until the first day of following month for your counts to be reset and be able to run ngrok requests again.

Limited capability

  1. ngrok does not work for the injected header/footer scenario.

  2. ngrok does not work when only running vets-website locally (port 3001)

@randimays
Copy link
Contributor

Created a ticket for Platform to review and possibly add our docs to theirs: department-of-veterans-affairs/va.gov-team#80225. Closing as complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Public Websites Scrum team in the Sitewide crew sitewide Technical debt VA.gov frontend CMS team practice area
Projects
None yet
Development

No branches or pull requests

3 participants