Env setup on AWS EC2 and Meteor deploy scripts


#1

I’m trying to do a fresh environment setup and Meteor deployment on a AWS EC2 instance running Ubuntu 14.04 with scripts, and need a hand.


The following script will be used to set up a deployment package:

# build-remote.sh

# build.sh file in root of /workstation-deployment-test

# output of this line is a tr.gz file, the tr.gz is told to reside in /workstation-deployment-test-build dir
meteor build --architecture=os.linux.x86_64 ../workstation-deployment-test-build

#
cp deploy-build.sh ../workstation-deployment-test-build

#
cd ../workstation-deployment-test-build

# secure copy tar meteor build from local host to remote host
# should add a check here to make sure /home/meteor/build exists and create it if it doesn’t
scp -i /Users/username/meteors/penfilename.pem workstation-deployment-test.tar.gz ubuntu@ipaddress:/home/ubuntu

# secure copy build sh
scp -i /Users/username/meteors/penfilename.pem deploy-build.sh ubuntu@ipaddress:/home/ubuntu

#
ssh -i /Users/username/meteors/pendfilename.pem ubuntu@ipaddress "deploy-build.sh”

And once these files are on the instance, the sh will be run remotely:

# deploy-build.sh

#cd ../build

# remove previous bundle 
rm -rf bundle

# unpack the tar ball, unpacks to /bundle dir
tar -zxvf workstation-deployment-test.tar.gz

# go into the new bundle folder
cd bundle

#install dependencies
(cd programs/server && npm install)

How do I open the 80 port? Specify a MONGO_URL or ROOT_URL? Specifying the app name? Any help is greatly appreciated.

What is your take on this strategy?


Great News: Meteor/Apollo Integration Coming in 1.5
Deploying to AWS with Meteor 1.3.5 still using MUP
#2

:slight_smile:

@aadams, lots of questions you have there :wink:

  1. In terms of port 80, it seems you are missing a web server (e.g. nginx or tengine). See our sample config here https://github.com/ramezrafla/meteor-deployment/blob/master/nginx.conf. But this is by no means an easy task, there is a learning curve.
  2. You would use the ubuntu package ufw to open a port in your firewall.
  3. In terms of ROOT_URL, you need to register your domain in your DNS settings, then in our nginx conf point to the meteor instance – typically via reverse proxy (again, in our nginx.conf, we have three instances running on ports 5000, 5001 and 5002, and a load balancer directs to the right instance in a transparent way).
  4. MONGO_URL would point to either a local server (you configure port when you install mongodb – is it a typo in your post, you have mongoldb) or a remote server, in which case you have to setup your passwords and secure authentication and open the port to the outside world with ufw (or even allow only the meteor server to access that port for increased security)
  5. OPLOG is another issue, you would need to setup your mongodb for replication (which you can do with a single instance and it works well, just like the mongodb dev instance that comes with meteor).

Now, this is only the tip of the iceberg … playing sysadmin part-time is a tough job :slight_smile: