Skip to content

Instantly share code, notes, and snippets.

@adamalex
Created October 28, 2013 00:01
Show Gist options
  • Select an option

  • Save adamalex/7189405 to your computer and use it in GitHub Desktop.

Select an option

Save adamalex/7189405 to your computer and use it in GitHub Desktop.

Revisions

  1. adamalex created this gist Oct 28, 2013.
    14 changes: 14 additions & 0 deletions .ebextensions--eb.config
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    packages:
    yum:
    git: []
    gcc: []
    make: []
    openssl-devel: []
    commands:
    00-add-home-variable:
    command: sed -i 's/function error_exit/export HOME=\/root\n\nfunction error_exit/' /opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh
    container_commands:
    00-install-grunt:
    command: $NODE_HOME/bin/npm install -g grunt-cli
    10-run-grunt:
    command: $NODE_HOME/bin/node $NODE_HOME/bin/grunt build
    5 changes: 5 additions & 0 deletions .elasticbeanstalk--config
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    [global]
    ApplicationName=my-app-name
    DevToolsEndpoint=git.elasticbeanstalk.us-east-1.amazonaws.com
    EnvironmentName=my-environment-name
    Region=us-east-1
    24 changes: 24 additions & 0 deletions scripts--deploy.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    #!/bin/bash

    CREDENTIAL_FILE=~/.elasticbeanstalk/aws_credential_file

    # Download the Elastic Beanstalk CLI
    curl -o /tmp/aws.zip https://s3.amazonaws.com/elasticbeanstalk/cli/AWS-ElasticBeanstalk-CLI-2.5.1.zip
    unzip /tmp/aws.zip -d /tmp/aws

    # Configure the Git repository for Beanstalk
    /tmp/aws/AWS-ElasticBeanstalk-CLI-2.5.1/AWSDevTools/Linux/AWSDevTools-RepositorySetup.sh

    # Create the Beanstalk credential file
    if [ ! -f $CREDENTIAL_FILE ]; then
    mkdir -p ~/.elasticbeanstalk
    echo AWSAccessKeyId=$AWS_ACCESS_KEY > $CREDENTIAL_FILE
    echo AWSSecretKey=$AWS_SECRET_KEY >> $CREDENTIAL_FILE
    fi

    # Deploy
    git aws.push

    # Clean up
    rm $CREDENTIAL_FILE
    rm -rf /tmp/aws*