简体   繁体   中英

Travis CI Deploy to AWS ElasticBeanstalk

Hi I currently try to deploy my react app to AWS Elastic Bean Stalk through travis CI. But it fail.. what should I change in my travis yml??

Here is my .travis.yml

sudo: required
services:
  - docker
before_install:
  - docker build -t sample:dev .

script:
  - docker run -e CI=true sample:dev npm run test -- --coverage

deploy:
  provider: elasticbeanstalk
  region: "us-west-1"
  app: "my-app"
  env: "MyApp-env"
  bucket_name: "xxxx"
  bucket_path: "xxx"
  on:
    branch: master
  access_key_id: $AWS_ACCESS_KEY
  secret_access_key:
    secure: "$AWS_SECRET_KEY"

But I failed to deploy it in aws elastic bean stalk. Here is the message from travis ci:

The command "docker run -e CI=true sample:dev npm run test -- --coverage" exited with 0. dpl_0 1.27s$ rvm $(travis_internal_ruby) --fuzzy do ruby -S gem install dpl dpl.1 Installing deploy dependencies Successfully installed jmespath-1.4.0 Successfully installed aws-eventstream-1.0.3 Successfully installed aws-sigv4-1.1.1 NEWER VERSION AVAILABLE: Please upgrade to AWS SDK For Ruby V3 Successfully installed aws-sdk-core-2.11.471 NEWER VERSION AVAILABLE: Please upgrade to AWS SDK For Ruby V3 Successfully installed aws-sdk-resources-2.11.471 NEWER VERSION AVAILABLE: Please upgrade to AWS SDK For Ruby V3 Successfully installed aws-sdk-2.11.471 Successfully installed rubyzip-1.3.0 Successfully installed dpl-elastic_beanstalk-1.10.15 8 gems installed !!! AWS Elastic Beanstalk support is experimental !!! dpl.2 Preparing deploy Cleaning up git repository with git stash --all . If you need build artifacts for deployment, set deploy.skip_cleanup: true . See https://docs.travis-ci.com/user/deployment#Uploading-Files-and-skip_cleanup . No local changes to save NEWER VERSION AVAILABLE: Please upgrade to AWS SDK For Ruby V3 dpl.3 Deploying application No stash entries found. /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/seahorse/client/plugins/raise_response_errors.rb:15:in call': The request signature we calculated does not match the signature you provided. Check your key and signing method. (Aws::S3::Errors::SignatureDoesNotMatch) from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/s3_sse_cpk.rb:19:in call': The request signature we calculated does not match the signature you provided. Check your key and signing method. (Aws::S3::Errors::SignatureDoesNotMatch) from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/s3_sse_cpk.rb:19:in call': The request signature we calculated does not match the signature you provided. Check your key and signing method. (Aws::S3::Errors::SignatureDoesNotMatch) from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/s3_sse_cpk.rb:19:in call' from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/s3_dualstack.rb:24:in call' from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/s3_accelerate.rb:34:in call' from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:20:in call' from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/idempotency_token.rb:18:in call' from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/aws-sdk-core/plugins/param_converter.rb:20:in call' from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/seahorse/client/plugins/response_target.rb:21:in call' from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/seahorse/client/request.rb:70:in send_request' from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/seahorse/client/base.rb:207:in send_request' from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-core-2.11.471/lib/seahorse/client/base.rb:207:in block (2 levels) in define_operation_methods' from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-resources-2.11.471/lib/aws-sdk-resources/request.rb:24:in call' from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-resources-2.11.471/lib/aws-sdk-resources/operations.rb:41:in call' from /home/travis/.rvm/gems/ruby-2.4.5/gems/aws-sdk-resources-2.11.471/lib/aws-sdk-resources/operation_methods.rb:19:in block in add_operation' from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-elastic_beanstalk-1.10.15/lib/dpl/provider/elastic_beanstalk.rb:131:in upload' from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-elastic_beanstalk-1.10.15/lib/dpl/provider/elastic_beanstalk.rb:49:in push_app' from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/lib/dpl/provider.rb:199:in block in deploy' from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/lib/dpl/cli.rb:41:in fold' from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/lib/dpl/provider.rb:199:in fold' from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/lib/dpl/provider.rb:199:in deploy' from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/lib/dpl/cli.rb:32:in run' from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/lib/dpl/cli.rb:7:in run' from /home/travis/.rvm/gems/ruby-2.4.5/gems/dpl-1.10.15/bin/dpl:5:in <top (required)>' from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:in load' from /home/travis/.rvm/gems/ruby-2.4.5/bin/dpl:23:in `' failed to deploy

Based on the new version of Travis CI, following lines code, you need to update

secret_access_key: secure: "$AWS_SECRET_KEY"

Change it to : secret_access_key: "$AWS_SECRET_KEY" Alse need to add "skip_cleanup: true" under deploy:

Because Travis CI now consider default variable as secure.

Looking at the first error from your output:

call': The request signature we calculated does not match the signature you provided. Check your key and signing method. (Aws::S3::Errors::SignatureDoesNotMatch)

I got the same error and it was caused by a mismatch on the access_key_id and secret_access_key . I resolved it by running:

travis encrypt --add deploy.access_key_id <access_key_id>

travis encrypt --add deploy.secret_access_key <secret_access_key>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM