유성 응용 프로그램을 내 서버에 배포하는 방법은 무엇입니까?
유성 응용 프로그램을 내 서버에 배포하는 방법은 무엇입니까?
특징 1 : 개발 및 배포 서버가 동일합니다.
특징 2 : 개발 서버는 하나 (내 로컬 호스트 일 수 있음)이고 배포 서버는 다른 하나 (클라우드의 VPS 일 수 있음)입니다.
맛 3 : "meteor.com"과 같은 "유성 호스팅"도메인을 만들고 싶습니다. 가능할까요? 어떻게?
업데이트 :
나는 우분투를 실행하고 있으며 응용 프로그램을 "경위"하고 싶지 않습니다. 감사합니다.
Meteor 문서는 현재 다음과 같이 말합니다.
"[...] Node.js 0.8과 MongoDB 서버를 제공해야합니다. 그런 다음 노드를 호출하고 애플리케이션이 수신 할 HTTP 포트 및 MongoDB 엔드 포인트를 지정하여 애플리케이션을 실행할 수 있습니다."
그래서, 할 수있는 여러 가지 방법 중 Node.js를 설치 , 나는 그것을하고 다음 실행있어 내가 찾은 최고의 조언 기본적으로 직접에서 사용할 수있는 최신 버전 풀고되는, 공식 Node.js를 웹 사이트 (64 비트를 이미 리눅스 용으로 컴파일을, 나의 경우에는):
# Does NOT need to be root user:
# create directory
mkdir -p ~/.nodes && cd ~/.nodes
# download latest Node.js distribution
curl -O http://nodejs.org/dist/v0.10.13/node-v0.10.13-linux-x64.tar.gz
# unpack it
tar -xzf node-v0.10.13-linux-x64.tar.gz
# discard it
rm node-v0.10.13-linux-x64.tar.gz
# rename unpacked folder
mv node-v0.10.13-linux-x64 0.10.13
# create symlink
ln -s 0.10.13 current
# add path to PATH
export PATH="~/.nodes/current/bin:$PATH"
# check
node --version
npm --version
그리고 MongoDB 를 설치 하기 위해 공식 웹 사이트의 문서 섹션에있는 MongoDB 매뉴얼의 지침을 따랐 습니다 .
# Needs to be root user (apply "sudo" if not at root shell)
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | tee /etc/apt/sources.list.d/10gen.list
apt-get update
apt-get install mongodb-10gen
서버는 Meteor 애플리케이션을 실행할 준비가되었습니다! 배포의 주요 "문제는" 어디 은 " 번들 "작업이 발생합니다. meteor bundle애플리케이션 소스 파일 트리 내에서 명령 을 실행해야합니다 . 예를 들면 :
cd ~/leaderboard
meteor bundle leaderboard.tar.gz
배포가 다른 서버 ( flavor 2 ) 에서 발생 하는 sftp경우 ftp, 또는 기타 파일 전송 방법을 사용하여 번들 tar.gz 파일을 업로드해야합니다 . 파일이 있으면 Meteor 문서 와 번들 트리의 루트에 마법처럼 포함 된 README 파일을 따릅니다 .
# 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 )에있는 경우 번들 tar.gz 파일이 이미 있으며 네이티브 패키지를 다시 컴파일 할 필요가 없습니다. (위의 해당 섹션으로 이동하십시오.)
멋있는! 이 단계를 통해 "meteor.com"이 아닌 사용자 정의 서버에 "Leaderboard"예제를 배포했습니다 ... (서비스를 배우고 가치를 평가하기 위해서만!)
나는 여전히 그것을 포트 80에서 실행해야한다 ( 나는 이것을 위해 NginX를 사용할 계획이다 ), 환경 변수를 유지하고, 터미널에서 분리 된 Node.JS를 시작하는 것 등등… 나는이 설정이 "거의 헐벗은"하나라는 것을 알고있다. .. 기초, 첫 걸음, 기초 기초석.
응용 프로그램은 "수동으로"모두를 활용하지 않고, 배포 된 meteor deploy나는 사람들이 "출판 본 적이 ... 명령 매직 기능 meteor.sh "와 " meteoric.sh를 "내가 동일한 경로를 따라하고 ...를 만들 "단일 명령 배포"기능을 에뮬레이트하는 스크립트 ... 가까운 장래에이 모든 것이 은하계 전체로 성장함에 따라 선구자 Meteor 탐험가의 일부가 될 것임을 인식하십시오! 이러한 문제의 대부분은 과거의 구식이 될 것입니다.
어쨌든, 배포 된 애플리케이션이 놀랍도록 짧은 지연 시간과 여러 개별 브라우저에서 거의 즉각적인 동시 업데이트를 통해 가장 저렴한 VPS 에서 실행되는 속도를 보게되어 매우 기쁩니다 . 환상적입니다!
감사합니다!!!
Meteor Up 도 사용 해보세요
이를 통해 모든 Ubuntu 서버에 배포 할 수 있습니다. 이것은 meteor build내부적으로 명령을 사용합니다 . 많은 사람들이 프로덕션 앱을 배포하는 데 사용합니다.
개발자가 Galaxy가 올 때까지 프로덕션 품질의 Meteor 앱을 배포 할 수 있도록 Meteor Up을 만들었습니다.
별도의 배포 서버가있는 맛 2를 권장합니다. 우려 사항을 분리하면 코드 환경이보다 안정되고 디버깅이 쉬워집니다.
이를 위해 Amazon의 EC2 또는 자체 서버에 배포하는 데 도움이 되는 뛰어난 Meteoric bash 스크립트가 있습니다.
자신의 meteor.com을 롤링하는 방법에 관해서는 관련이 없으므로 자체 StackOverflow 질문으로 나누는 것이 좋습니다. 또한 대답 할 수 없습니다. :)
I done with it few days ago. I deployed my Meteor application to my own server on the DigitalOcean. I used Meteor Up tool for managing deploys and Nginx on the server to serve the app.
It's very simple to use. You should install meteor up with the command:
npm install -g mup
Then create the folder for deployment configuration and go to the created directory. Then run meteor init command. It will created two configuration files. We are have interest for mup.json file. It have configurations for deployment process. It's looks like this:
{
// 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
}
After you fill all data fields you can start the setup process with command mup setup. It will setup your server.
After sucessfull setup you can deploy your app. Just type mup deploy in the console.
Another alternative is to just develop on your own server to start with. I just created a Digital Ocean box and then connected my Cloud9 IDE account.
Now, I can develop right on the machine in a Cloud IDE and deployment is easy--just copying files.
I created a tutorial that shows exactly how my set up works.
I had a lot of trouble with meteor up, so I decided writing my own deploy script. I also added additional info how to set up nginx or mongodb. Hope it helps!
What the script meteor-deploy.sh does:
- Select environment (
./meteor-deploy.shfor staging,./meteor-deploy.sh prodfor production) - Build and bundle production version of the meteor app
- Copy bundle to server
- SSH into server
- Do a mongodump to backup database
- Stop the running app
- Unpack bundle
- Overwrite app files
- Re-install app node package dependencies
- Start the app (uses forever)
Tested for the following server configurations:
- Ubuntu 14.04.4 LTS
- meteor --version 1.3.2.4
- node --version v0.10.41
- npm --version 3.10.3
참고URL : https://stackoverflow.com/questions/17606340/how-to-deploy-a-meteor-application-to-my-own-server
'Nice programing' 카테고리의 다른 글
| `import module`이`from module import function`보다 더 나은 코딩 스타일입니까? (0) | 2020.11.15 |
|---|---|
| 프로덕션에서 CSS / JavaScript 소스 맵을 사용하면 성능에 영향이 있습니까? (0) | 2020.11.15 |
| Kotlin에서 목록을 복제하거나 복사하는 방법 (0) | 2020.11.14 |
| FtpWebRequest 전에 FTP에 파일이 있는지 확인하는 방법 (0) | 2020.11.14 |
| 상단 및 왼쪽 CSS 속성 설정 (0) | 2020.11.14 |