Hello evryone, I’m having a problem with meteor + passenger.
actually I’m trying to build the application but the hotpush code does not work at all, but it does when I test it locally.
#locally
as far as I know locally I do this:
meteor build /Users/Prince/Projects/BUILD/ --server http://192.168.137.158:4321
then I sign the application etc etc etc and I get my APK on ‘…/BUILD/android/my.apk’ right?
meteor run --settings settings/settings-local.json --mobile-server http://192.168.137.158:4321
192.168.137.158 is my LAN IP, and my phone is connected to that LAN and the port 4321 is a random port that I use (to see if the problem was the port 3000).
so as you can see I’m using a settings file and this is the content of that file:
{
"private": {
"type": "development",
"url": "http://192.168.137.158:4321",
"port": 433,
"webServiceUrl": "http://10.10.10.242:8080/ayamobi/services/rest/1.0/",
}
}
and then on the start up I do this:
Meteor.startup(function () {
var theURL = Meteor.settings.private.url;
Meteor.absoluteUrl.defaultOptions.rootUrl = theURL;
process.env.ROOT_URL = theURL;
process.env.MOBILE_ROOT_URL = theURL;
process.env.MOBILE_DDP_URL = theURL;
process.env.PORT = Meteor.settings.private.port;
process.env.DDP_DEFAULT_CONNECTION_URL = theURL;
console.log(process.env);
});
with this, my hotpush code works on my LAN network, I install the application and then I do changes on the code and my application flashes and it has the changes as I want, perfect right?
#production
the problem comes when I want to deploy the application on my server which is using passenger and I run the build throught jenkins, so in order to do it we have this:
ssh root@$2 "cd /var/www/meteor/ayamobi/bundle/programs/server && npm install --production && npm install --save simple-oauth2"
ssh root@$2 "passenger-config restart-app /var/www/meteor/ayamobi/bundle "
then we have
export ANDROID_HOME="/var/sdk/android-sdk-linux"
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export ROOT_URL="$protocol://$server"
export DDP_DEFAULT_CONNECTION_URL="$protocol://$server:$port"
export PORT="$port"
export MOBILE_ROOT_URL="$protocol://$server:$port"
export MOBILE_DDP_URL="$protocol://$server:$port"
METEOR_SETTINGS="passenger_env_var METEOR_SETTINGS '"
cat /var/mobile/$buildenv/src/settings/$settings
“’;”’
and then I build the APK
usr/local/bin/meteor npm install --save simple-oauth2
/usr/local/bin/meteor build --directory /var/mobile/build/$buildenv/ --server="$protocol://$server:$port" --mobile-settings settings/$settings
where:
$protocol = https
$server = my.domain.com (this is for example)
$port = 443
and the settings passed to that file are:
{
"private": {
"type": "development",
"url": "https://my.domain.com:443,
"port": 433,
"webServiceUrl": "http://10.10.10.242:8080/ayamobi/services/rest/1.0/",
}
}
this should do the trick right? now, going deeper I found the index.html of the BUILD and check what I have on my meteor.runtime
DDP_DEFAULT_CONNECTION_URL:"https://my.domain.com:443/"
ROOT_URL:"https://my.domain.com:443/"
ROOT_URL_PATH_PREFIX:""
appId:"1jt099an8obv216wcrhd"
autoupdateVersionCordova:"43928ee2d7a20a75c3254f963ce4fdf992139dd7"
NODE_ENV:"production"
TEST_METADATA:"{}"
meteorRelease:"METEOR@1.3.3.1"
now, what is happening here? when I first install the application it works, I show the Meteor.connection.status() on the mobile and the web view and they are connected BUT when I do the build again (even without changes or with changes) the web app still works and takes the changes if they were made and the mobile app stops working, it doesnt connect to the server, it says in the status connection : WAITING connected: false.
could it be the way that we are deploying the app? this is so weird… anybody has an idea?
Thanks!