Repository navigation
Description
If we look at the Staging branch of ohm-website, we are 1700 commits behind OSM upstream:
https://github.com/OpenHistoricalMap/ohm-website
If we look at the files we have changed since we last caught up with upstream, here's what we've got:
% git diff --name-only f2a386c6b591f9ecf7f21ed1bdb2bd5633b1d2df 11a39b8b05d318357d3a3b284aac2664b58ef721
.gitignore
CODE_OF_CONDUCT.md
Dockerfile
Gemfile
Gemfile.lock
README.md
Vendorfile
app/assets/favicons/ohm_logo.ico
app/assets/images/about/osm copy.png
app/assets/images/attribution_example copy.png
app/assets/images/ohm_logo.png
app/assets/images/ohm_logo.svg
app/assets/images/ohm_logo_256.png
app/assets/images/ohm_logo_30.png
app/assets/javascripts/application.js
app/assets/javascripts/embed.js.erb
app/assets/javascripts/id.js
app/assets/javascripts/index.js
app/assets/javascripts/leaflet.layers.js
app/assets/javascripts/leaflet.map.js
app/assets/javascripts/ohm.style.js
app/assets/javascripts/osm.js.erb
app/assets/javascripts/router.js
app/assets/stylesheets/id.css
app/assets/stylesheets/mapbox-gl-all.scss
app/controllers/users_controller.rb
app/helpers/open_graph_helper.rb
app/mailers/notifier.rb
app/views/export/embed.html.erb
app/views/layouts/_head.html.erb
app/views/layouts/_header.html.erb
app/views/layouts/error.html.erb
app/views/site/about.html.erb
app/views/site/help.html.erb
app/views/site/id.html.erb
app/views/users/terms.html.erb
config/environments/production.rb
config/initializers/action_mailer.rb
config/initializers/assets.rb
config/locales/en.yml
docker-compose.yml
ohm-docker.env.example
public/styles/sprite.json
public/styles/sprite.png
public/styles/[email protected]
public/styles/[email protected]
vendor/assets/iD/iD.js
vendor/assets/iD/iD/locales/en.json
vendor/assets/leaflet/leaflet.osm.js
I am not 100% sure all of those changes are still needed -- for example, changes to iD maybe are no longer relevant, since we're running from a separate iD container? And some, like app/assets/javascripts/ohm.style.js would not have upstream conflicts since they don't exist upstream.
the rest, it seems, would take inspection and then migration to some method of doing these as patches? I'll be hones tthat we've never done that at GreenInfo in any project that I can recall, so it's handwaving on my part.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn Production
Activity
danrademacher commentedon Feb 3, 2021
Wait is it as simple as:
git diff 11a39b8b05d318357d3a3b284aac2664b58ef721 f2a386c6b591f9ecf7f21ed1bdb2bd5633b1d2df > jan2021-ohmwebsite.patchthen the harder part:
Step 3 is probably where it could be 1 hour or 100 hours...
batpad commentedon Apr 25, 2022
Bumping this issue.
We are now further behind upstream and this is beginning to hurt. The really big upstream change that we are missing now is support for JSON in the OSM API. Newer versions of most tools now use the new JSON APIs in some way or another: Tasking Manager, iD, etc. This is going to start hitting us more and more in terms of compatibility with OSM tools.
I really like this patch approach @danrademacher . We have spent some time updating the
osm-websiteversion inosm-seedto latest upstream, so we have a working Dockerfile for some of the updates to the rails pipeline, things like that.Just to reiterate your idea here @danrademacher - we should just checkout latest upstream and apply all the OHM specific changes as a patch. This seems like it would be several hours of work, and most of it is frontend / essentially figuring out applying all the same frontend changes to an "updated" version of the osm-website code. I'm not sure how much the frontend code on osm-website has changed, so I am not sure how much work this would be, but this would be my ideal / preferred approach. The
patchfile that we develop can also then be maintained separately, in theory making future updates to upstream also much easier.Of course, if the frontend code has changed a lot, this could be a bit of a rabbit hole - I still believe this is the correct approach, even if it means having to re-wire bits of the frontend.
@danrademacher @jeffreyameyer is it possible to bump the priority of this? Happy to help in any way, though most of the heavy lifting here seems to be on @danrademacher and team, since our changes are mostly frontend.
cc @geohacker @Rub21 @willemarcel
batpad commentedon Apr 25, 2022
Just also on this
patchapproach: it doesn't necessarily need to involve anything fancy - with that list of files, it seems like one could also manually just go through each file / replace with the OHM forked version / see what breaks, etc. It maybe interesting to think through the approach / tooling to do this merge - we will need to get a bit creative, but I feel like our changes are contained enough and just being able to see "the file as it was on osm-website before we forked", "the file in our fork", "the file in current osm-website" and diffs between the three somewhat nicely, should make this doable. Of course, this is all contingent on osm-website not having completely changed their frontend, but I don't believe that they have.willemarcel commentedon Apr 25, 2022
@batpad I saw that Andy Alan added bootstrap to the frontend around 2020. In terms of JS code, I don't believe we have too many changes.
What if, instead of a PATCH file, we always rebase the repository with upstream and squash our changes in order to have all our changes in only one commit on top of upstream?
danrademacher commentedon Apr 25, 2022
Wille, that sounds promising!
Regarding patches, I'm not sure the thinking in this issue was really all that fleshed out. I am happy to bump this up priority list, and I think there's going to be work here for both DevSeed and GreenInfo
We have this unfinished PR from Sajjad from Nov 2021: OpenHistoricalMap/ohm-website#63, but I think that we would not use.
To take the patch approach, we would run this updated diff command into a patch file:
git diff 11a39b8b05d318357d3a3b284aac2664b58ef721 356ac0a13739888073804b190c533494f8742f1d > apr2022ohm-website-upstream.patchThe main benefit of the patch approach as I understand it is we are focused on just getting all our code applied to the latest OSM code, not actually trying to preserve the commit history that got us where we are.
That said, I realize I am not quite sure about the precise next steps:
I tried these steps using
Checked out current OHM-staging and did:
Then switched to OpenHistoricalMap/ohm-website#63 which is the same as OpenHistoricalMap/ohm-website@staging...openstreetmap:master
And did
After that, I see no commits, which is expected since per the docs,
git patchdoesn't actually generate commits. But I also don't see any modified files. The errors above seem to be saying "patch does not apply" even in cases like this where we know we need changes (loading timeline JS):batpad commentedon Apr 25, 2022
@danrademacher So, what I did:
Created a new branch from
ohm-websitestaging. Merged in upstream changes to that branch, but always resolving git conflicts to take "our" changes:Created a PR against
staging: OpenHistoricalMap/ohm-website#87Also created a patch file, with this branch compared to
openstreetmap/openstreetmap-websitelatest with:ourpatch.txt - this should represent the "delta" between our changes and openstreetmap-website master. There's a bunch of stuff on the Gemfiles and Dockerfile and some other config stuff that I'm pretty sure we should be able to resolve (@Rub21 let's go over these when you have some time).
And then there's a bunch of conflicts in the frontend code, which don't seem to me to be too severe.
Yes - when we are running against latest upstream, we will need some changes to the Dockerfile to make everything work. What I'd recommend here possibly as a workflow:
danrademacher commentedon Apr 26, 2022
That sounds like a good plan!
To make sure I'm clear -- we wouldn't try to apply the patch in any automated way, right? We would pick through manually and resolve conflicts, favoring our OHM code only where we actually made changes to it.
I wonder, after this, could could start pulling in upstream say several times a year and it would be alight lift each time. I think we have been saying that since we first forked!
batpad commentedon Apr 26, 2022
That's correct. Would just require going through each file, seeing what's changed upstream, and if we need to incorporate any of those changes. From a brief look at the frontend conflicts, it seems to me like not that much has changed upstream and the changes should be mostly okay to manage (still a bunch of manual work).
It would be a good idea to have some sort of "cron" Github Action that would just create a pull request with the latest upstream changes every 2 weeks or so that we deal with.
Rub21 commentedon May 11, 2022
@batpad @danrademacher , I went through files and made some updates in the ohm-website branch https://github.com/OpenHistoricalMap/ohm-website/tree/merge-osm-website. according to lates the upstream changes, also made updates in ohm-deploy OpenHistoricalMap/ohm-deploy#137 to build the contianer for these changes, Dockerfile works fine for openstreetmap latest version , but there are some issues in ohm-website https://gist.github.com/Rub21/d898480c04822b1fd9b2443856d56744 , all related to the frontend and javascript dependencies, It may take still some time to figure out more about those issues, maybe someone from the frontend could help us on it.
danrademacher commentedon May 12, 2022
Sorry for the slow reply on this! We can look into the front end issues for sure.
I want to be sure we have fully gotten to same local dev stopping point that you have. Here's what I did:
docker-compose buildand this seemed to work as usualdocker-compose up-- I thought maybe here I would get similar outputs to yours. Instead, I'm getting an error like this:I see this file that seems similar but slightly different name:
https://github.com/OpenHistoricalMap/ohm-website/blob/merge-osm-website/config/docker.database.yml
Full output of
docker-compose upis here:https://gist.github.com/danrademacher/58e0f2201a6530d80a94533a709b4f88
@Rub21 I assume you didn't get this error?
I was running in the background this command as usual, which is how we normally connect to database for local dev:
kubectl port-forward service/staging-db 5435:5432 -n default6 remaining items
Rub21 commentedon May 18, 2022
@danrademacher , I can prepare a guide to make the container a development environment, basically redirect some container volumes to a ohm-website. it may help to you test easily the changes.
Rub21 commentedon May 18, 2022
@danrademacher @batpad ,I wrote a guide to test the ohm-website in the docker environment,without compiling every change https://github.com/OpenHistoricalMap/ohm-deploy/tree/new_web_version/images#setting-up-ohm-website-for-development-mode
danrademacher commentedon May 20, 2022
Took a while, but I have gotten this to the point of simple application errors in browser console, as has @batpad
@batpad picking up from Slack, I am now up to
Uncaught TypeError: L.OSM.CyclOSMis not a constructor but I had to do the following:bundle installin the container -- this should probably be added to the documentation, but I wish I knew why Yarn was getting GL installed for Sanjay but not for me.The Ruby GEM method is what we were doing before, so seems reasonable to stick with that, at least until we jump to MapLibre.
danrademacher commentedon May 20, 2022
I have moved the app error fixing over into its own issue. We can keep this issue for the "patch" process, or close it ot in favor of new issues if that's preferred.
danrademacher commentedon Aug 10, 2022
danrademacher commentedon Aug 16, 2022
danrademacher commentedon Aug 16, 2022
I realize I let this ticket stray a bit from its original purpose: Focusing on a patch approach to
ohm-websiteparticularly and not all the service dependencies. I will move those to a new issue.Back to the patch approach, here's a command to make the diff between current upstream and our latest commit
git diff 31eb7cc11a524427ca11491fe1e9c98d7afbd2b8 6a279be9df074ce2d26d9f7ee23a44796e681c10 > 20220816upstream.patchNot quite sure which should be a and which b, but in this case, upstream is the base and we're diffing from that.
That produces a 500K line diff file:
20220816upstream.patch.zip
that cover 538 files.
Of those, 281 are iD-related, which we would ideally overwrite with our own iD when the Rails vendorfile processes.
96 are locales files, which have meaningful changes in them for EN and EN-GB and eventually other languages. But upstream can also include new translation keys, so these are a bit hard to manage.
Then we have ~160 other files.
geohacker commentedon Jan 31, 2023
I tried to use a GH action that would create a PR but that fails, among many reasons because of the conflicts. This action is in this branch https://github.com/OpenHistoricalMap/ohm-website/blob/fork-sync/.github/workflows/sync-fork.yml. I think we should next revisit the patch idea and see if that can be combined with a GH action for regular syncing.
danrademacher commentedon Mar 26, 2024
This idea of patch approach is a bit stale. Closing this out