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

How to build a product version and deploy it with MUP? #56

Open
tomitrescak opened this issue Sep 22, 2015 · 11 comments
Open

How to build a product version and deploy it with MUP? #56

tomitrescak opened this issue Sep 22, 2015 · 11 comments

Comments

@tomitrescak
Copy link

Hi, kudos on having transformation to Meteor 1.2 with 0% problems ;)
I guess this solution will not be using the jsx and ecmascript capabilities of Meteor, but using the webpack ones, right?

Also, how do I deploy my meteor app?
There are prod / dev and build commands, but I'm not sure how they relate to deployment. Do I need to run build prior to packaging my application with MUP from the meteor_core directory?

Thanks!

@AdamBrodzinski
Copy link
Collaborator

I imagine all will be the same with 1.2 with the exception of being able to opt out of Blaze and use the static-html package.

Also, how do I deploy my meteor app?

Ah so this is bit confusing now. Basically you need to run ./prod let it build, then kill the watcher with ctrl-c. You could also modify your .prod script so that it removes the --watch commands and doesn't boot up meteor.

Then you can just meteor deploy or with MUP you can create mup.json in the root, then setup the app directory to point to meteor_core and then from the root just mup setup/deploy.

However if you're using settings.json in the app I think it looks for settings.json in the same directory. If you have multiple environments (staging/prod) you might need to rename the current settings file or symlink them into another folder.

I'm hoping to have some free time this weekend to make a deploy script.

@tomitrescak
Copy link
Author

Adam, good news ;) I'll wait for the script, or if you need help just let me know if I can do something about it. Just so you know, I have almost finished swith of all our uni applications to this solution. The biggest pain was to rewrite the whole frontend to react, but doing so I managed to improve the whole thing tremedously ... and you gotta love the code patching ;) One possible improvement would be, that if change in code cannot be handled by code patching an automatic page refresh could be performed .. but pressing CMD + R is not an issue.

@tomitrescak
Copy link
Author

Hello @AdamBrodzinski Any progress on this? I tried what you proposed, but am getting a blank screen. I need to test the environment variables if they are propaerly set, as with the devel version it's not going well.

@AdamBrodzinski
Copy link
Collaborator

I'm going to try to do this tonight (trying to keep my eyes above water lol). I've deployed to meteor.com and modulus so far with no issues. If you're using MUP then you'll have to configure env vars and package.json a bit differently (it'll look for a file called package.json in the same dir as mup.json)

@AdamBrodzinski
Copy link
Collaborator

@tomitrescak I just pushed PR #59 to add support for modulus, meteor.com, mup (partially) and demeteorizer (for custom/local servers).

Once setup you can just run deploy mup and be done. Mup requires a bit of configuration compared to modulus or meteor.com deploy.

Now when you run build it will just build the web app into meteor_core, then run deploy with an argument to choose the service to deploy to (case statement needs modified for your app name).

For package.json support with MUP they need to be renames and moved into the same dir as the mup.json file, see your other issue to resolve this. Once that is done then mup willl work. So:

  • copy settings/prod.json to settings/production/settings.json
  • cd into settings/production/ and mup intiand setup config
  • mup setup (in settings/production)
  • cd to root and run ./deploy mup

@tomitrescak
Copy link
Author

@AdamBrodzinski looks great! Hopefully the PR will be accepted soon and I'll test it! Thanks for this!

@tomitrescak
Copy link
Author

Hmm, I think you missed a cd command before deploy, otherwise mup cannot find the mup init and all

"mup" )
      echo "Make sure to mup init and mup setup before first deploy"
      # you will also need to move settings/prod.json to settings/prod/settings.json
      # then mup init inside settings/prod/ so that mup uses the new settings.json
      # this will require a settings path change in ./dev script
      cd settings/prod
      mup deploy
    ;;

@rclai
Copy link
Contributor

rclai commented Sep 30, 2015

If you're doing lazy-loading of styles and components, do you need to have a webpack server running on your production server too?

@jedwards1211
Copy link
Owner

@rclai nope, not unless you want hot-reloading in production :)

@jedwards1211
Copy link
Owner

@tomitrescak in the shelljs script now it just goes to meteor_core and calls mup deploy. But I could eventually put the settings.json paths in variables so that it's easier to move things around for mup

@jedwards1211
Copy link
Owner

@rclai I don't know all the details of how lazy loading works, but I'm pretty sure that for an async require (has to be async for code splitting), the Webpack output checks that the chunk containing the required module is loaded, and if not just makes a simple ajax request for that chunk. Once that chunk is loaded it passes it to the async require callback

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

No branches or pull requests

4 participants