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

[CHORE] Quickstart improvements #4448

Merged

Conversation

Writhe
Copy link
Contributor

@Writhe Writhe commented Nov 15, 2023

This PR introduces a couple of minor improvements to the initial dev set-up. The only real issue was the missing FE build step - all the rest are nitpicks.

Changes:

  • added && yarn deploy to devmode.sh
  • added analogous step to developer.md ("Mostly Manual Steps")
  • rephrased the part about replacing DB_HOST value in oli.env as the value doesn't currently need replacing
  • added information about /dev/sent_emails and default admin credentials to "Notes"
  • replaced "npm" with "yarn" in "Running Tests" section, for consistency's sake (also verified that FE test suite does pass when run by Yarn)
  • in the last line of devmode.sh, replaced process substitution with a temp file approach - I don't think process substitution is supported by the antediluvian Bash version that comes with MacOS... or maybe it's something to do with source - I'm not sure; it throws a syntax error for me, anyway (Bash 3.2.57)

Alternate designs:

  • I considered adding a post-install script to build FE assets, but decided against it. I feel it's more readable to have install and build steps entirely separate.

@@ -7,7 +7,7 @@ echo "## "
if [ ! -f .devmode ]; then
echo "## It looks like this is your first time using devmode. Lets gather some prerequisites..." && sleep 1
mix deps.get
cd assets && yarn
cd assets && yarn && yarn deploy
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think yarn deploy is actually necessary here, these assets will be built when mix phx.server is run

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They weren't accessible for me after I followed the start-up guide. I tried it once with mostly automatic and once with mostly manual setup. Each time I got an unstyled login page and a nice 404 instead of app.css. Once I ran yarn build and restarted the server - it was 👌.

Could it be that the server doesn't serve static assets from directories that weren't present on start-up? It finishes spinning up while frontend stuff is still building, creates an index of static assets before they're all there and then ignores requests for them? If that's the case, it would have been enough for me to simply restart the server 🤔. I'll check.

Copy link
Contributor Author

@Writhe Writhe Nov 28, 2023

Choose a reason for hiding this comment

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

@bitbldr
Alright, so reloading the page does nothing, but restarting the server helps (which lends some credibility to my theory about static assets). I think I prefer running yarn build to telling people to "run mix phx.server, kill it and then run mix phx.server again" ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here's the error (when you run the server for the first time):
Screenshot 2023-11-28 at 18 46 00

And here's the login screen in all its unstyled glory:
Screenshot 2023-11-28 at 18 47 41

@@ -106,6 +107,10 @@ with the Torus server running directly on the host machine.

> In order to sign in, you must use **https** and accept the self-signed cert browser warning to avoid CSRF issues. If you would like to provide your own cert instead of accepting the included one, simply replace `priv/ssl/localhost.crt` -or- use the localhost tunneling method below to generate a public URL with SSL enabled.

> To access email verification message and activate your locally-created account, visit `http://localhost/dev/sent_emails`.

> Default administrator credentials are defined in `oli.env` as `ADMIN_EMAIL` and `ADMIN_PASSWORD`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: These values will only be used to initially seed the database (during mix ecto.setup/ecto.reset) and will not change after

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's what I assumed but yeah - it does need clarifying. Changed. Thank you.

@Writhe Writhe force-pushed the chore/quickstart-improvements branch from 54b4099 to 1f21494 Compare November 28, 2023 17:52
@eliknebel eliknebel merged commit 1320b7b into Simon-Initiative:master Nov 29, 2023
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

Successfully merging this pull request may close these issues.

2 participants