focallocal / fl-maps

The Public Happiness Movement: A platform bringing people and communities together to solve any and all societal issues. BTM branch is a project aiming to solve world involuntary homelessness. PHM brings communities together to create social initiatives for kindness and well-being.
https://publichappinessmovement.com
MIT License
143 stars 95 forks source link

Feature upgrade meteor latest #1153

Closed bogdanrn closed 1 year ago

bogdanrn commented 1 year ago

Upgraded meteor and some packages to latest version in order to make the app run locally.

PS: to make sure you don't have issues, run rm -rf node_modules && meteor npm i

There are more changes to be done, but they have to be done by someone who has all the details of the app and infrastructure.

Some of the remaining changes i noticed:

New file structure of the repo should contain only some root folders like: meteor, config, deployement

bogdanrn commented 1 year ago

Because all files from the folder gets loaded to meteor, i had to create some empty mup-secret.json files as well.

fumbleforce commented 1 year ago

Haha, after seeing the post on /r/meteor, I went to do the same thing as I had a little spare time. The changes you have done here are EXACTLY what I did as well, just 30 minutes earlier. Remove webpack, add fourseven:scss, move import structures, rewrite scss imports, replace package-lock, upgrade node-stubs, add babel etc. So I can vouch for the fact that it works and is the right way to go. Good luck with the project :crossed_fingers:

AndyatFocallocal commented 1 year ago

This is fantastic thank you @bogdanrn @jorgeer @carlos-algms and @rivertam

I think its best to wait for @TLMcNulty to review before merging as he's been through this process before and should have some thoughts on it. You are very welcome to keep discussing and coding here.

AndyatFocallocal commented 1 year ago

@bogdanrn @jorgeer @carlos-algms and @rivertam @Marvelxy

Some others have suggested we add Docker to the app to make it more stable and help users to set up. What are your thoughts, and if its a solution can we also do that?

Marvelxy commented 1 year ago

@bogdanrn @jorgeer @carlos-algms and @rivertam @Marvelxy

Some others have suggested we add Docker to the app to make it more stable and help users to set up. What are your thoughts, and if its a solution can we also do that?

I agree! Dockerizing the project is the first step to solving most of the issues we've been facing. Everyone would have the same environment.

fumbleforce commented 1 year ago

Well.. in my experience, adding more technology/complexity in order to simplify a project can do more harm than good sometimes. Now you have two layers to maintain instead of one, and have to teach new devs to use docker properly in addition to Meteor.

TLMcNulty commented 1 year ago

Well.. in my experience, adding more technology/complexity in order to simplify a project can do more harm than good sometimes. Now you have two layers to maintain instead of one, and have to teach new devs to use docker properly in addition to Meteor.

Agree. Meteor doesn't do exactly what docker does, but it does attempt enough that putting one inside the other is pretty complex and makes a lot either redundant or unnecessary.

It's very attractive to me because of the ease of environment setup/portability, but we don't have any build or deployment infrastructure that depends or could benefit from containerization.

Let's keep it simple. A cleaner and more up to date meteor configuration is a huge step forward in brushing off some cobwebs. I can't check this branch out for validation at the moment but I'll put it together this evening.

TLMcNulty commented 1 year ago

I was able to build this in a few clean environments. Let's see how it builds on merge.

AndyatFocallocal commented 1 year ago

Travis is building PHM! I'll let you know if its running in around 10mins.

@Marvelxy or @TLMcNulty it would be really cool if you could have a little look at deploy-phm as it has some differences to master and i'm not sure where those have come from. It looks to me like PHM-deploy (the live site) hasn't yet received the Meteor update.

AndyatFocallocal commented 1 year ago

Although i can see them here: https://github.com/focallocal/fl-maps/commit/df4805463d5f9e176f90ed2bc0a83236217fac68

AndyatFocallocal commented 1 year ago

Sorry everyone, i posted on the other PR by mistake so most of you probably missed the update. Your kind and excellent work is greatly appreciated and a big step forwards.

There is currently an error or errors preventing Travis from building the updated platform and it would be great if you could all have a look and see if you can find the bug(s), then we'll give it another go.

Here's the error logs:

Node.js: 16.7.0 temp.txt

and Node.js: 8.11.1 temp2.txt

bogdanrn commented 1 year ago

For second log, looks like travis is not configured to use the min required node version. Check here https://docs.meteor.com/install.html#prereqs-node

Node.js version >= 10 and <= 14 is required.

But overall, from the logs, it seems you're using mup for deployment. You would have to update the mup config to use a newer docker image.

Something like

    dockerImage: "zodern/meteor:0.7.0",

    //optional
    docker: {
      imagePort: MUP_CONFIG.APP_PORT,
    },

https://github.com/focallocal/fl-maps/blob/554333384be59638064e7b574cb103618ba93d99/deployment/publichappinessmovement/mup.js#L15

https://github.com/focallocal/fl-maps/blob/ea6c71a1a1d24440f1be493d88a9c4e681203708/deployment/testing/mup.js#L13

https://github.com/focallocal/fl-maps/blob/ea6c71a1a1d24440f1be493d88a9c4e681203708/deployment/brightertomorrowmap/mup.js#L15

AndyatFocallocal commented 1 year ago

That seems to tie in with my line of research. The eventual solution to our platform being down for over a year after using the auto-migration tool from mLab to MongoDB, was to set the node version to 2.014 or earlier.

Do you think we can update both together, or is that too likely to add complications?

This is what its currently set to, but it should be using an earlier version. I guess MongoDB picked up our changes and tried to match them.

image

bogdanrn commented 1 year ago

Do the updates one after another if possible, this way you at least know what broke it. Using later versions of mongodb should not give any errors and even if it does, there's nothing that can't be fixed.

Important: Make sure you do your backups before attempting anything.

PS: on atlas, that setting in the screenshot does nothing, it just shows you a quick tutorial on how to connect using diferent versions of the driver. If the app works, it's already connected.

bogdanrn commented 1 year ago

Btw, looking at the mup.js file, it looks outdated. Make sure you use the correct options for it as well: https://meteor-up.com/docs.html

Marvelxy commented 1 year ago

@bogdanrn , could you test this out and open a PR?

AndyatFocallocal commented 1 year ago

Any updates on the mup.js fix anyone?

I have some good news on this fix. One of the new devs who joined our team was able to use it to get localhost running, so we are definitely on the right path. Here's their post with how they got it running: https://publichappinessmovement.com/t/topic/1589/49

and their earlier message with the issues they were having and how they solved them:

I finally fixed all the errors! They were ALL due to versions being incompatible - especially sass, node-sass, sass-loader, webpack… I ended up using a website called https://www.npmpeer.dev/ to find compatible versions.

TLMcNulty commented 1 year ago

The meteor version in the mup file is a good find. That file is encrypted, you can read about the implementation of sops here.

I have the key with me but don't even have sops installed in this environment so I'll get cracking on decoding that file and re-encrypting. I went through settings.json and mup.js prior to the upgrade merge but didn't look for/pay attention to versions.

TLMcNulty commented 1 year ago

Luckily that's not actually an encrypted file. I'll have changes for node-12-base shortly.

AndyatFocallocal commented 1 year ago

Making progress but still not building I'm afraid.

Here's the latest update, can anyone see what's causing the issue?

https://github.com/focallocal/fl-maps/pull/1166#issuecomment-1507699911

We also have a Dev who's working on upgrading React to the latest version over on PHM. Perhaps that's helpful to the Meteor upgrade?

@bogdanrn you said you wanted to give a month to getting this project running smoothly (unless I've got messages/people mixed up). Would it be ok to onboard you to our main site and show you around a bit, then talk about other tasks you could work on once this update is running smoothly. Either via chat and messages, or a video call whichever you prefer.

Everyone is very, very welcome to join in longer term. Either actively coding, or being available to offer advice and guide others. Especially as a lot of our Devs are just starting out and join in this project to gain experience. We also run r/webdevjobs and feature portfolios helping our projects. If any of you are looking for work let me know as I'd love to help and add you to next month's sticky post.