-
Notifications
You must be signed in to change notification settings - Fork 5
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
Switch frontend app bundler #457
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking really good! I had a few comments, but the main thing I'm uncertain about is whether neighborhood images are working or not, and how to check. When I view the map page, I get several 404
errors in the console looking for http://localhost:9966/assets/neighborhoods/02203_town_square.jpg
in order to display the neighborhood thumbnails.
Under mastarm, the neighborhood thumbnails are downloaded by running ./neighborhood_data/update_data.sh
and then (I think?) manually copying the images to the assets folder. We are planning to migrate neighborhood info to the database so that it can be managed via the Django API, so I think we should avoid making major changes to the neighborhood data management process (because they'll just get thrown away in a few sprints), but we should make sure that we don't break the existing neighborhood images.
abb81db
to
a879f6b
Compare
@ddohler good find on the bug that the neighborhood image thumbnails not showing up. I fixed it in this commit: 16dfc1d . It was simply because If you still have those thumbnails lying around in the This gets me thinking:
|
I am aware of the merge conflicts, and I plan to address them before merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! I had one further question about how environment variables are being injected, but I think this is ready to go once we've got that sorted out and the merge conflicts are resolved.
Could you share a bit more about your vision of having [neighborhood] images in DB? What would the schema be like for such a table? Does it mean all neighborhood JSON data will be in a new table too? Should they be stored as bytes or base64 encoded string? Because I think this might be a better approach than 1 and also 2 above.
Yes, we're going to migrate all the data that's currently in the neighborhoods.json
and neighborhood_bounds.json
files into database fields. For the neighborhood images specifically, I'm not exactly sure how we'll handle them -- I think storing them as binary blobs in the database could work since they're relatively small, or maybe it would be better to upload them to S3. But either way, we should allow admins to edit the images from the Django admin page, similar to this: https://github.com/azavea/cac-tripplanner/blob/develop/python/cac_tripplanner/cms/models.py#L96 . That way the admins can change the photos or add new neighborhoods if they need to. How does that sound?
@ddohler, you are right about how env vars are read in through the way you suggested, I made the change here: 14ca820 Regarding your vision of how neighborhood data will be stored and managed, yes it sounds good and makes sense to me. Somehow I was seeing issues fetching json from those cloudfront URLs again. Did you see that from your end when doing the re-review? |
|
14ca820
to
a4ad4cb
Compare
Update docker-compose: - to have a `app` service that replaces `taui` - to mount the frontend/build to backend/static so that django renders the app at domain:port/ Switch bundler, update dir structure: - remove mastarm - add webpack and babel as dev deps - add configs for the above 2 dev deps - hard-code redux store init vals - read env vars from dotenv - update task runner scripts in package.json - move taui into src and rename to src/frontend - update some imports in the JS code Update webpack config Remove mock Add eslint and its related; Add prettier-eslint Add style lint scripts Update webpack config Run yarn fixlint-js: these are automatic fixes Add prettier. Run format script with prettier Added eslint rules to deal with later Do not check style files in /build dir Update cibuild script Install frontend dep before running tests Add node 12 base image for frontend Update node image Update scripts, docker-compose, and dockerfile Update env var frontend config Update per request Update the way to read in env vars Update how neighborhood thumbnail is downloaded and read Address PR comments: - update how process.env is read - add url to issue for todo in cibuild - remove console.log
* Update bootstrap script to pull down dotenv * Add bootstrap step to CI to load dotenv * Improve logging of steps in cibuild * Add format script for frontend app * Update build context for Django service * Update PR template to suggest running format script Co-authored-by: Derek Dohler <[email protected]>
ec6a4e1
to
fc7b807
Compare
Overview
This PR has made the following changes as a result of switching away from
mastarm
:taui
and rename tosrc/frontend
mastarm
and its related config from./taui/configurations
docker-compose
forapp
anddjango
servicesstore.yml
.env
on frontendpackage.json
Demo
App served from Django root
![Screen Shot 2022-04-26 at 6 18 40 PM](https://user-images.githubusercontent.com/16109558/165402022-d7b1eb8e-be15-4a55-8388-6820194acf89.png)
App in the map view
![Screen Shot 2022-04-26 at 6 18 56 PM](https://user-images.githubusercontent.com/16109558/165402055-b4c88fde-4abb-4d24-9b2d-6f7f864e2419.png)
Notes
Testing Instructions
cp ./src/frontend/.env.template .env
. Then fill in the fields in.env
by the one stored on lastpass./scripts/update
, which will build the frontend and backend, install frontend deps, create a static build of the frontend to be used by django, and run django manage scripts./scripts/server
, which will bring both frontend and backend up and running. Navigate tohttp://localhost:9966
to access app frontend. If you make changes to frontend code, module hot reloading should work. Navigate tohttp://localhost:8085
to access the static frontend app served from django.Resolves #376