Невозможно настроить развертывание стека без сервера в стек локальных сетей - PullRequest
0 голосов
/ 27 февраля 2019

Я использую без сервера для развертывания стека AWS без сервера.(то есть: лямбда, sqs, sns).Я хочу запустить локально перед попыткой развертывания в AWS.Я искал и вижу localstack , подходящий для моего случая использования.Вот мой шаг для развертывания системы:

  1. Клонируйте проект и запустите весь стек, используя Docker.(команда: docker-compose up)
  2. Установить библиотеку serverless-localstack и обновить serverless.yml в моем проекте

Вот мой конфиг:

plugins:
  - serverless-localstack

custom:
  localstack:
    host: http://localhost
    debug: false
    endpoints:
    stages:
      - local
      - dev
    lambda:
      mountCode: False # Enable this flag to improve performance

После этого я развертываю этот стек с помощью команды: serverless deploy --stage local.Но я всегда встречаю исключение.

Serverless: Updating Stack...
Serverless: Recoverable error occurred (502), sleeping for 5 seconds. Try 1 of 4
Serverless: Recoverable error occurred (502), sleeping for 5 seconds. Try 2 of 4
Serverless: Recoverable error occurred (502), sleeping for 5 seconds. Try 3 of 4
Serverless: Recoverable error occurred (502), sleeping for 5 seconds. Try 4 of 4

  Serverless Error ---------------------------------------

  502

Вот мой полный журнал развертывания:

Serverless: Generated requirements from /Users/hqt/Documents/avex/requirements.txt in /Users/hqt/Documents/avex/.serverless/requirements.txt...
Serverless: Installing requirements from /Users/hqt/Documents/avex/.serverless/requirements/requirements.txt ...
Serverless: Docker Image: lambci/lambda:build-python2.7
Serverless: Running docker run --rm -v /Users/hqt/Documents/avex/.serverless/requirements\:/var/task\:z -u 0 lambci/lambda\:build-python2.7 python2.7 -m pip install -t /var/task/ -r /var/task/requirements.txt...
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Injecting required Python packages to package...
Serverless: WARNING: Function crawl_twitter_accounts_api has timeout of 900 seconds, however, it's attached to API Gateway so it's automatically limited to 30 seconds.
Serverless: Using serverless-localstack
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
..
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service avex.zip file to S3 (25.08 MB)...
Serverless: Validating template...
Serverless: Skipping template validation: Unsupported in Localstack
Serverless: Updating Stack...
Serverless: Recoverable error occurred (502), sleeping for 5 seconds. Try 1 of 4
Serverless: Recoverable error occurred (502), sleeping for 5 seconds. Try 2 of 4
Serverless: Recoverable error occurred (502), sleeping for 5 seconds. Try 3 of 4
Serverless: Recoverable error occurred (502), sleeping for 5 seconds. Try 4 of 4

  Serverless Error ---------------------------------------

  502

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           11.6.0
     Serverless Version:     1.38.0
Serverless: Generated requirements from /Users/hqt/Documents/avex/requirements.txt in /Users/hqt/Documents/avex/.serverless/requirements.txt...
Serverless: Installing requirements from /Users/hqt/Documents/avex/.serverless/requirements/requirements.txt ...
Serverless: Docker Image: lambci/lambda:build-python2.7
Serverless: Running docker run --rm -v /Users/hqt/Documents/avex/.serverless/requirements\:/var/task\:z -u 0 lambci/lambda\:build-python2.7 python2.7 -m pip install -t /var/task/ -r /var/task/requirements.txt...
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Injecting required Python packages to package...
Serverless: WARNING: Function crawl_twitter_accounts_api has timeout of 900 seconds, however, it's attached to API Gateway so it's automatically limited to 30 seconds.
Serverless: Using serverless-localstack
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
..
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service avex.zip file to S3 (25.08 MB)...
Serverless: Validating template...
Serverless: Skipping template validation: Unsupported in Localstack
Serverless: Updating Stack...
Serverless: Recoverable error occurred (502), sleeping for 5 seconds. Try 1 of 4
Serverless: Recoverable error occurred (502), sleeping for 5 seconds. Try 2 of 4
Serverless: Recoverable error occurred (502), sleeping for 5 seconds. Try 3 of 4
Serverless: Recoverable error occurred (502), sleeping for 5 seconds. Try 4 of 4

  Serverless Error ---------------------------------------

  502

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information -----------------------------
     OS:                     darwin
     Node Version:           11.6.0
     Serverless Version:     1.38.0

Пожалуйста, скажите мне, как это исправить.

1 Ответ

0 голосов
/ 28 февраля 2019

Я не буду говорить, как это исправить, но, возможно, проблема в том, что вы используете питон, и он собран в контейнере lambci / lambda: build-python2.7.Возможно, проблема в том, чтобы перенести архив с кодом между контейнерами - из lambci / lambda в localstack.Я переигрываю его с помощью nodejs и все в порядке

...