Skip to content

Instantly share code, notes, and snippets.

@adamgins
Last active February 25, 2016 11:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save adamgins/f99635447a1239289460 to your computer and use it in GitHub Desktop.
Save adamgins/f99635447a1239289460 to your computer and use it in GitHub Desktop.
Some steps on deploying a Meteor app to AWS Elastic Beanstalk
option_settings:
- option_name: AWS_SECRET_KEY
value: <SOMESECRET>
- option_name: AWS_ACCESS_KEY_ID
value: <SOMEKEY>
- option_name: PORT
value: 8081
- option_name: ROOT_URL
value: <SOMEURL>
- option_name: MONGO_URL
value: <SOMEMONGOURL>
- option_name: MONGO_OPLOG_URL
value: <SOMEMONGOURL>
- namespace: aws:elasticbeanstalk:container:nodejs
option_name: ProxyServer
value: nginx
option_name: GzipCompression
value: true
- namespace: aws:elasticbeanstalk:container:nodejs:staticfiles
option_name: /public
value: /public
container_commands:
01_nginx_static:
command: |
sed -i '/\s*proxy_set_header\s*Connection/c \
proxy_set_header Upgrade $http_upgrade;\
proxy_set_header Connection "upgrade";\
' /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf
@gb96
Copy link

gb96 commented Dec 18, 2014

I have put this in /.ebextensions/config1.yaml for my meteor project, however when I do meteor build ../my-build-dir the resulting build does not appear to contain the .ebextensions directory nor the config1.yaml.

Do I need to copy my .ebextensions into /bundle of the built package, or somewhere else?

@JackAdams
Copy link

I copy the .ebextensions folder into /bundle each time I do a new build.

@akreienbring
Copy link

Hi, I also have trouble using nginx on beanstalk with websockets. Without nginx it's working as expected. Like you I tried the following approach with configuring nginx via a .config file in .ebextensions with something like:

files:
"/etc/nginx/conf.d/proxy.conf" :
    mode: "000755"
    owner: root
    group: root
    content: |
        proxy_set_header        Upgrade         $http_upgrade;
        proxy_set_header        Connection      "upgrade";

But it is still not working, although others earlier reported that this solution solved it for them. As soon as I try a different solution with something like:

location /wsapp/ {
    proxy_pass http://wsbackend;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}

beanstalk tells me that 'location' is not allowed in this configuration section. Also 'proxy_pass' seems to be disallowed.

So, what (the f...) is the correct way to configure nginx on beanstalk to support websockets on a reliable and enduring basis?
Are you saying that AWS Support told you to use

files:
 01_nginx_static:
command: |
    sed -i '/\s*proxy_set_header\s*Connection/c \
    proxy_set_header Upgrade $http_upgrade;\
    proxy_set_header Connection "upgrade";\
    ' /tmp/deployment/config/#etc#nginx#conf.d#00_elastic_beanstalk_proxy.conf 

instead of the above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment