Deployment 如何将meteor应用程序部署到我自己的服务器?
如何将meteor应用程序部署到我自己的服务器 风格1:开发和部署服务器相同 风格2:开发服务器是一个(可能是我的本地主机),部署服务器是另一个(可能是云中的VPS) 味道3:我想做一个“流星托管”域名,就像“meteor.com”。可能吗?怎么做 更新:Deployment 如何将meteor应用程序部署到我自己的服务器?,deployment,hosting,meteor,Deployment,Hosting,Meteor,如何将meteor应用程序部署到我自己的服务器 风格1:开发和部署服务器相同 风格2:开发服务器是一个(可能是我的本地主机),部署服务器是另一个(可能是云中的VPS) 味道3:我想做一个“流星托管”域名,就像“meteor.com”。可能吗?怎么做 更新: 我正在运行Ubuntu,我不想“去市场化”应用程序。谢谢。我建议flavor 2使用单独的部署服务器。关注点的分离为您的代码提供了一个更稳定的环境,并且更易于调试 为此,有一个优秀的bash脚本可以帮助您部署到Amazon的EC2或您自己的服
我正在运行Ubuntu,我不想“去市场化”应用程序。谢谢。我建议flavor 2使用单独的部署服务器。关注点的分离为您的代码提供了一个更稳定的环境,并且更易于调试 为此,有一个优秀的bash脚本可以帮助您部署到Amazon的EC2或您自己的服务器上 至于如何推出你自己的meteor.com,我建议你把这个问题分解成它自己的StackOverflow问题,因为这是无关的。另外,我无法回答:)目前说: “[…]您需要提供Node.js 0.8和MongoDB服务器。您可以 然后通过调用节点运行应用程序,指定HTTP端口 用于侦听应用程序和MongoDB端点。“
因此,在安装Node.js的几种方法中,我安装了Node.js并运行了以下程序,基本上是直接在中解包最新版本,该版本已经为Linux编译(在我的例子中是64位):
要安装MongoDB,我只需遵循以下步骤:
服务器已准备好运行Meteor应用程序!对于部署,主要的“问题”是,其中发生了“捆绑”操作。我们需要从应用程序源文件树内部运行
meteor bundle
命令。例如:
cd ~/leaderboard
meteor bundle leaderboard.tar.gz
如果部署将在另一台服务器(Flavor 2)中进行,我们需要使用
sftp
、ftp
或任何其他文件传输方法将bundle tar.gz文件上载到它。一旦文件存在,我们将遵循Meteor文档和自述文件,自述文件神奇地包含在包树的根目录中:
# unpack the bundle
tar -xvzf leaderboard.tar.gz
# discard tar.gz file
rm leaderboard.tar.gz
# rebuild native packages
pushd bundle/programs/server/node_modules
rm -r fibers
npm install fibers@1.0.1
popd
# setup environment variables
export MONGO_URL='mongodb://localhost'
export ROOT_URL='http://example.com'
export PORT=3000
# start the server
node main.js
如果部署将在同一台服务器(Flavor 1)中,那么bundle tar.gz文件已经存在,我们不需要重新编译本机包。(只需跳过上面相应的部分。)
酷!通过这些步骤,我将“排行榜”示例部署到我的自定义服务器上,而不是“meteor.com”。。。(只是为了学习和重视他们的服务!) 我仍然需要让它在端口80()上运行,持久化环境变量,从终端删除start Node.JS等等。。。我知道这是一个“几乎赤裸”的设置。。。只是基础,第一步,基本的基石。 该应用程序已经“手动”部署,没有利用所有的
meteor部署
命令魔法功能。。。我看到人们发表了他们的“”和“”,我也遵循同样的路径。。。创建一个脚本来模拟“单命令部署”功能。。。意识到在不久的将来,所有这些东西将只是流星探险家先驱的一部分,因为它将成长为一个完整的星系!而这些问题中的大多数都将成为过去的陈词滥调
无论如何,我很高兴看到部署的应用程序运行速度如此之快,在几个不同的浏览器中具有令人惊讶的低延迟和几乎即时的同步更新。太棒了
谢谢你 另一种选择是在自己的服务器上开发。 我刚刚创建了一个数字海洋盒子,然后连接了我的Cloud9IDE帐户 现在,我可以在云IDE的机器上进行开发,部署也很简单——只需复制文件 也试试看 有了它,你可以部署到任何Ubuntu服务器上。这在内部使用
meteor build
命令。并且被许多人用于部署生产应用程序
我创建了Meteor Up,以允许开发人员在Galaxy到来之前部署生产质量的Meteor应用程序
我几天前就做完了。我将Meteor应用程序部署到DigitalOcean上我自己的服务器上。我使用这个工具来管理服务器上的部署和Nginx,以便为应用程序提供服务 它使用起来非常简单。应使用以下命令安装meteor up:
npm install -g mup
然后为部署配置创建文件夹并转到创建的目录。然后运行mupinit
命令。它将创建两个配置文件。我们对mup.json
文件感兴趣。它具有部署过程的配置。看起来是这样的:
{
// Server authentication info
"servers": [
{
"host": "hostname",
"username": "root",
"password": "password",
// or pem file (ssh based authentication)
//"pem": "~/.ssh/id_rsa",
// Also, for non-standard ssh port use this
//"sshOptions": { "port" : 49154 },
// server specific environment variables
"env": {}
}
],
// Install MongoDB on the server. Does not destroy the local MongoDB on future setups
"setupMongo": true,
// WARNING: Node.js is required! Only skip if you already have Node.js installed on server.
"setupNode": true,
// WARNING: nodeVersion defaults to 0.10.36 if omitted. Do not use v, just the version number.
"nodeVersion": "0.10.36",
// Install PhantomJS on the server
"setupPhantom": true,
// Show a progress bar during the upload of the bundle to the server.
// Might cause an error in some rare cases if set to true, for instance in Shippable CI
"enableUploadProgressBar": true,
// Application name (no spaces).
"appName": "meteor",
// Location of app (local directory). This can reference '~' as the users home directory.
// i.e., "app": "~/Meteor/my-app",
// This is the same as the line below.
"app": "/Users/arunoda/Meteor/my-app",
// Configure environment
// ROOT_URL must be set to https://YOURDOMAIN.com when using the spiderable package & force SSL
// your NGINX proxy or Cloudflare. When using just Meteor on SSL without spiderable this is not necessary
"env": {
"PORT": 80,
"ROOT_URL": "http://myapp.com",
"MONGO_URL": "mongodb://arunoda:fd8dsjsfh7@hanso.mongohq.com:10023/MyApp",
"MAIL_URL": "smtp://postmaster%40myapp.mailgun.org:adj87sjhd7s@smtp.mailgun.org:587/"
},
// Meteor Up checks if the app comes online just after the deployment.
// Before mup checks that, it will wait for the number of seconds configured below.
"deployCheckWaitTime": 15
}
填充所有数据字段后,可以使用命令mup setup
启动设置过程。它将设置您的服务器
成功安装后,您可以部署应用程序。只需在控制台中键入
mup deploy
。meteor up给我带来了很多麻烦,所以我决定编写自己的部署脚本。我还添加了关于如何设置nginx或mongodb的其他信息。希望有帮助
脚本meteor deploy.sh的作用:
/meteor-deploy.sh
用于暂存,选择/meteor-deploy.sh prod
用于生产)- Ubuntu 14.04.4 LTS
- meteor--版本1.3.2.4
- 节点——版本v0.10.41
- npm—版本3.10.3
npm install -g mup
{
// Server authentication info
"servers": [
{
"host": "hostname",
"username": "root",
"password": "password",
// or pem file (ssh based authentication)
//"pem": "~/.ssh/id_rsa",
// Also, for non-standard ssh port use this
//"sshOptions": { "port" : 49154 },
// server specific environment variables
"env": {}
}
],
// Install MongoDB on the server. Does not destroy the local MongoDB on future setups
"setupMongo": true,
// WARNING: Node.js is required! Only skip if you already have Node.js installed on server.
"setupNode": true,
// WARNING: nodeVersion defaults to 0.10.36 if omitted. Do not use v, just the version number.
"nodeVersion": "0.10.36",
// Install PhantomJS on the server
"setupPhantom": true,
// Show a progress bar during the upload of the bundle to the server.
// Might cause an error in some rare cases if set to true, for instance in Shippable CI
"enableUploadProgressBar": true,
// Application name (no spaces).
"appName": "meteor",
// Location of app (local directory). This can reference '~' as the users home directory.
// i.e., "app": "~/Meteor/my-app",
// This is the same as the line below.
"app": "/Users/arunoda/Meteor/my-app",
// Configure environment
// ROOT_URL must be set to https://YOURDOMAIN.com when using the spiderable package & force SSL
// your NGINX proxy or Cloudflare. When using just Meteor on SSL without spiderable this is not necessary
"env": {
"PORT": 80,
"ROOT_URL": "http://myapp.com",
"MONGO_URL": "mongodb://arunoda:fd8dsjsfh7@hanso.mongohq.com:10023/MyApp",
"MAIL_URL": "smtp://postmaster%40myapp.mailgun.org:adj87sjhd7s@smtp.mailgun.org:587/"
},
// Meteor Up checks if the app comes online just after the deployment.
// Before mup checks that, it will wait for the number of seconds configured below.
"deployCheckWaitTime": 15
}