流星可以在不依赖外部服务的情况下运行

Can meteor run without dependencies on external services?

本文关键字:服务 情况下 运行 外部 依赖 流星      更新时间:2023-09-26

我正在尝试使用流星为本地专用网络(无法访问web)构建一个应用程序。从我的研究来看,我似乎找不到一种方法来让流星100%"离线",即不依赖于web服务来构建/运行。

我看了以下链接-Meteor应用程序如何离线工作?在这里-https://groups.google.com/forum/#!主题/流星谈话/tGto0cSvXA然而,这两条线索都没有明确回答是否可能以及如何制定方法。

我希望有人能为我如何删除在线服务的流星框架依赖性提供指导。如果这不可能,我们将非常感谢为本地专用网络应用程序提供的其他框架建议。

如果我说得对,您希望构建一个部署在本地网络上的Web应用程序。

如果确实是这样,那么答案是

一个示例设置是:

  1. 带有linux的服务器计算机(例如:Ubuntu服务器)
  2. 安装在其上的node0.10.290.8.3流星应用程序所必需的-请参阅:https://askubuntu.com/questions/49390/how-do-i-install-the-latest-version-of-node-js)
  3. mongodb已安装并作为服务运行
  4. 然后在你的开发机器上运行

    meteor bundle --directory /your/independent/app
    
  5. 将应用程序文件夹复制到目标计算机
  6. 虽然你会在捆绑的README中找到更多信息(见下文),但我使用以下bash脚本来启动我的应用

    rm -rf programs/server/node_modules/fibers
    npm install ~/.meteor/tools/latest/lib/node_modules/fibers/
    # npm install fibers@1.0.1
    export MONGO_URL='mongodb://localhost/survey'
    export PORT=3000
    export ROOT_URL='http://127.0.0.1'
    ~/bin/node main.js
    

仅此而已。通过这些步骤,您可以在任何机器上部署流星创建的应用程序。唯一的依赖项是node(特定版本)和mongodb。

自述文件(由meteor bundle生成)

This is a Meteor application bundle. It has only one dependency:
Node.js 0.10.29 or newer, plus the 'fibers' and 'bcrypt' modules.
To run the application:
  $ rm -r programs/server/node_modules/fibers
  $ rm -r programs/server/node_modules/bcrypt
  $ npm install fibers@1.0.1
  $ npm install bcrypt@0.7.7
  $ export MONGO_URL='mongodb://user:password@host:port/databasename'
  $ export ROOT_URL='http://example.com'
  $ export MAIL_URL='smtp://user:password@mailhost:port/'
  $ node main.js
Use the PORT environment variable to set the port where the
application will listen. The default is 80, but that will require
root on most systems.
Find out more about Meteor at meteor.com.