无法连接到流星android设备上的托管或本地mongo

时间:2020-06-24 02:51:10

标签: android mongodb cordova meteor amazon-ec2

基本上,在meteor run android-device上运行时,我无法使本地或托管的mongo连接到我的应用程序。只需meteor run,本地和托管工作都可以正常工作。我也无法使它在发布的应用程序上运行以测试到Play商店,但是我认为一旦能够在本地运行托管的mongo,我就应该能够将这些修复程序应用于发布的版本。我正在运行Ubuntu 18.04。


在我的Android手机上进行本地测试时连接到本地mongo:
因此,从我在线阅读的内容来看,设备和计算机必须位于同一wifi网络上,并且我需要声明--mobile-server。 我已经将处于飞行模式的手机连接到wifi网络,并插入笔记本电脑进行测试。我不认为这是防火墙问题,因为我有其他硬件要连接到这种方式工作。 这些是我尝试过的各种脚本,但没有用。我完全不知所措!我正在运行最新的流星。我在模拟器上也尝试过用粗体显示的任何内容。

"android-device-local": "MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 192.168.0.102" <-我的笔记本电脑在wifi网络上的IP地址

"android-device-local": "MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 192.168.0.102:3000"

"android-device-local": "MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server locahost:3000"

“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server locahost:27017”

“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 127.0.0.1”

“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 127.0.0.1:27017”

“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 127.0.0.1:3000”

“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 192.168.0.109” <-- ip address of my phone on my wifi network

“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server 192.168.0.109:3000”

“android-device-local”: “MONGO_URL=mongodb://:@localhost:27017/dbName meteor run android-device --mobile-server localhost:12816” <-- chrome’s remote debugging url


连接到我的托管mongo(mongodb.com)
我确实知道--mobile-server是一台托管您的应用程序的在线服务器,但是这让我感到困惑……如果它托管在Play商店中,这到底意味着什么?我有一个个人网站(在Google上注册了域名,在AWS Amplify上托管),我为此目的使用了子域名。

我已经完成了本指南https://sergelobatch.com/beginners-guide-to-deploying-a-meteor-app-to-an-aws-server-with-meteor-up/,并且能够通过ec2公共ipv4地址和子域通过我的网络浏览器访问该应用,并且可以按预期方式从数据库中提取数据。我已经允许我的ec2的公共ipv4访问我的mongodb网络。 (旁注,不是https,有关系吗?)

再次在本地运行,我尝试了这些方法,但仍然没有运气:

“MONGO_URL=<mongodb.net_connection_string> meteor run android-device --mobile-server <ec2_public_ipv4>:80”

“MONGO_URL=<mongodb.net_connection_string> meteor run android-device --mobile-server <ec2_public_ipv4>:3000”

“MONGO_URL=<mongodb.net_connection_string> meteor run android-device --mobile-server http://<ec2_public_ipv4>:80”

^^^我也用ROOT_URL = sub.domain.com尝试了以上所有方法

“MONGO_URL=<mongodb.net_connection_string> meteor run android-device --mobile-server sub.domain.com”

“MONGO_URL=<mongodb.net_connection_string> meteor run android-device --mobile-server sub.domain.com:80”


更新: 我确实看到我找不到一些科尔多瓦资产。即使手动添加了这些软件包之后,它们仍然存在。


I20200624-01:28:29.236(-7)? 06-24 01:28:27.889  6311  6393 W MeteorWebApp: Asset /cordova_plugins.js not found in bundle 7f92647871b290270da17a1a34abfb1f0d9c1cda:file:///android_asset/www/application, no parent bundle

I20200624-01:28:29.236(-7)? 06-24 01:28:27.914  6311  6401 W MeteorWebApp: Asset /plugins/cordova-plugin-splashscreen/www/splashscreen.js not found in bundle 7f92647871b290270da17a1a34abfb1f0d9c1cda:file:///android_asset/www/application, no parent bundle

I20200624-01:28:29.236(-7)? 06-24 01:28:27.914  6311  6404 W MeteorWebApp: Asset /plugins/cordova-plugin-meteor-webapp/www/webapp_local_server.js not found in bundle 7f92647871b290270da17a1a34abfb1f0d9c1cda:file:///android_asset/www/application, no parent bundle

I20200624-01:28:29.236(-7)? 06-24 01:28:27.915  6311  6393 W MeteorWebApp: Asset /plugins/cordova-plugin-statusbar/www/statusbar.js not found in bundle



mobile-config.js

    App.info({
        //
    });
    
    App.icons({
      'android_mdpi': 'resources/icons/icon-48x48.png',
      'android_hdpi': 'resources/icons/icon-72x72.png',
      'android_xhdpi': 'resources/icons/icon-96x96.png',
      'android_xxhdpi': 'resources/icons/icon-148x148.png',
      'android_xxxhdpi': 'resources/icons/icon-192x192.png'
    });
    
    App.launchScreens({
      // Android
      'android_mdpi_portrait': 'resources/splash/splash-320x480.png',
      'android_mdpi_landscape': 'resources/splash/splash-480x320.png',
      'android_hdpi_portrait': 'resources/splash/splash-480x800.png',
      'android_hdpi_landscape': 'resources/splash/splash-800x480.png',
      'android_xhdpi_portrait': 'resources/splash/splash-720x1280.png',
      'android_xhdpi_landscape': 'resources/splash/splash-1280x720.png'
    });
    
    App.accessRule("*");
    App.accessRule("http://")
    App.accessRule("https://")
    App.accessRule("http://localhost:*")
    App.accessRule("http://127.0.0.1:*")
    App.accessRule("http://127.0.0.1")
    App.accessRule('http://localhost:3000/*');
    App.accessRule('http://192.168.1.109:3000/*');
    App.accessRule('http://192.168.1.102:3000/*');
    App.accessRule('http://<subdomain>.<domain>.com/*');
    App.accessRule('http://localhost:3000/*');
    App.accessRule('http://<ec2 public ipv4>/*');
    App.accessRule('http://<ec2 public ipv4>:*');

1 个答案:

答案 0 :(得分:0)

以供将来参考:该修补程序通过https://docs.meteor.com/packages/autoupdate.html添加了自动更新和必要的配置,并使用标志--mobile server <ec2-public-ipv4>:80运行dev,并使用--server <ec2-public-ipv4>:80运行构建