Skip to content

Instantly share code, notes, and snippets.

Last active September 15, 2023 07:29
  • Star 39 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save fightingtheboss/5432059 to your computer and use it in GitHub Desktop.
An Amazon Elastic Beanstalk configuration file for a Meteor project. This file needs to be saved in the .ebconfiguration/ directory at the root of your project. Deployed with `git aws.push`. Replace MONGO_URL with the URL to your MongoDB instance (I use MongoHQ).
git: []
mode: "000755"
user: root
group: root
encoding: plain
content: |
#!/usr/bin/env bash
echo !!! Setting up METEOR dependencies
export PATH=$PATH:/usr/local/bin
echo !!! Set PATH: $PATH
ln -s /opt/elasticbeanstalk/node-install/node-v0.8.21-linux-x64/bin/node /usr/local/bin/node
ln -s /opt/elasticbeanstalk/node-install/node-v0.8.21-linux-x64/bin/node-waf /usr/local/bin/node-waf
ln -s /opt/elasticbeanstalk/node-install/node-v0.8.21-linux-x64/bin/npm /usr/local/bin/npm
echo !!! Installing Meteor
export HOME=/home/ec2-user
curl | sh
echo !!! Installing Meteorite
npm install -g meteorite
echo !!! Creating app bundle
cd /tmp/deployment/application
mrt bundle bundle.tgz
tar xfz bundle.tgz
rm -rf bundle.tgz
cd /usr/local/bin
rm mrt npm node-waf node
command: "sed -i 's/^\s*\(worker_processes\s*\)\d*.*$/\14;/' /tmp/deployment/config/#etc#nginx#nginx.conf"
command: "sed -i '/^\(\(\s*\)worker_processes\s*\)\d*.*$/a worker_rlimit_nofile 8192;' /tmp/deployment/config/#etc#nginx#nginx.conf"
command: "sed -i 's/^\(\s*worker_connections\s*\)\d*.*$/\14096;/' /tmp/deployment/config/#etc#nginx#nginx.conf"
command: "sed 's/^\(\s*keepalive_timeout\s*\)\d*.*$/\130;/' /tmp/deployment/config/#etc#nginx#nginx.conf"
command: |
sed '/upstream/i \
gzip on;\
gzip_comp_level 6;\
gzip_vary on;\
gzip_min_length 1000;\
gzip_proxied any;\
gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;\
gzip_buffers 16 8k;\
' /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf
command: |
sed '/\s*location\s*\/.*/i \
location ~ ^/(images/|img/|javascript/|js/|css/|stylesheets/|font/|fonts/|flash/|media/|static/|robots.txt|humans.txt|favicon.ico) {\
root /var/app/current/bundle/static;\
access_log off;\
expires max;\
location ~* \.(js|css)$ {\
root /var/app/current/bundle/static_cacheable;\
access_log off;\
expires max;\
' /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf
- option_name: ROOT_URL
- option_name: MONGO_URL
value: mongodb://<user>:<password>@<mongo-server:port>/<db-name>
- namespace: aws:elasticbeanstalk:container:nodejs
option_name: NodeCommand
value: node bundle/main.js
- namespace: aws:elasticbeanstalk:container:nodejs
option_name: NodeVersion
value: 0.8.21
- namespace: aws:elasticbeanstalk:container:nodejs
option_name: GzipCompression
value: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment