Mupx cordova build

Hi,
I have short question about mupx deploy. I used to do mup deploy and then build the cordova apps separately with meteor build mobileapps --server=xyz.us-west-2.compute.amazonaws.com. However, I recently saw in my .meteor folder under local/cordova-build/platforms/ios the xcode project generated while running mupx deploy. Same applies of course for Android. But when I am using this xcode/apk the apps seems not to connect to the server. My questions:

  • Do I need to run meteor build in addition to mupx deploy
  • If no, where can I specify the server URL for mupx? I mean of course I defined it in mup.json with
    "env": {
    “ROOT_URL”: “http://xyz.us-west-2.compute.amazonaws.com”,
    “PORT”: 80
    },
    But do I need to specify it somewhere else? (e.g. mupx deploy --server=… or somewhere in settings.json)?

mupx deploy uses meteor build under the hood, but looking at the source it seems to hard code --server as http://localhost:3000.

So you’ll either have to submit a pull request to change that or continue to use meteor build separately.

Also, Meteor 1.3 introduces a --server-only option that actually skips building the mobile apps. That may make sense for a mupx deploy command, because it saves time and doesn’t require you to have the iOS and Android SDKs installed.

Thanks for explaining. For now I will continue with my solution to run meteor build separately.

Another option is to not check-in the “added” platform. Only add the platform when you are building. It’s not awesome, but it’s a workaround.

E.g. iosSumulator.sh

#!/bin/bash
source ../env.sh
export BUILDFOR=dev

# add/remove platform ios
meteor add-platform ios
trap ctrl_c INT
function ctrl_c() {
  # this will run when you press ctrl-c to exit
  meteor remove-platform ios
}

# run.  this should open xcode
meteor run ios \
  --settings settings.json \
  --verbose

@michaelcole: Note that removing the ios and android platforms means the project won’t be built for Cordova, which breaks hot code push. So I would recommend using --server-only.

Hey Marti,

That’s interesting but I don’t understand it.

Are you saying that I have to have ios and android builds setup to deploy and get updates? That makes developing on linux a non-starter. The only platform I could develop on would be MacOS.

I could swear I was getting updates pushed to my phone (1.2), but I haven’t specifically tested it recently.

Maybe I’m misunderstanding. Could you explain more?

Meteor will only build a bundle for the web.cordova architecture if either the ios or the android platform has been added. Without it, there won’t be anything to hot code push. You don’t need to build iOS or Android apps (so you don’t need to install the SDKs or worry about the OS you are running on), but you’ll have to use meteor build --server-only to avoid errors in this case.

Hey Marti, thanks, I’ll let MUPX know.

@martijnwalraven, @michaelcole The hardcoding of localhost:3000 seems to break my mobile deploys with mupx.
I can build an app standalone, install it and it will access my production server.

However, if I then do a mup deploy, the hot code push will work, but the app will be hosed on subsequent restarts. Given that this is all a bit new and arcane, I thought I’d ask here if I’ve got this right before I raise a bug on mupx.
cheers
Mike

1 Like