news-catalyst / reproducible-tinynews-content-api

A webiny installation complete with scripted content models and graphql
0 stars 0 forks source link

Test run of deploying multiple APIs for new clients #47

Closed jacqui closed 3 years ago

jacqui commented 3 years ago

TBD:

jacqui commented 3 years ago

I've run into a problem at step one :( - I thought I knew all the places to specify the new unique name for the API stack, but apparently I've either missed one or done something wrong.

After giving new mongodb, project and S3 bucket names, my attempt to deploy a new API stack appears to have deployed a slightly modified version of the existing API stack.

± |new-client-setup {2} ?:9 ✗| → yarn webiny deploy api --env=prod yarn run v1.22.5 $ /Users/jacqui/Projects/newscatalyst/review-webiny/new-tinynews-contentapi/node_modules/.bin/webiny deploy api --env=prod 💡 Loaded prod environment from /.env.json. 💡 Loaded prod environment from /api/.env.json. webiny Collecting components from the template. +0ms webiny Executing the template's components graph. +47ms webiny:lambdaRole Role '65c22661_14octa-contentapi_api_prod_lambdaRole' was successfully deployed to region 'us-east-1'. +0ms webiny:cognito Input was not changed, no action required. +0ms webiny:databaseProxy Building 'databaseProxy' +0ms webiny:databaseProxy Finished building 'databaseProxy' +5s webiny:databaseProxy Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_databaseProxy' to the 'us-east-1' region. +439ms webiny:databaseProxy Packaging lambda code from './databaseProxy/build' +7ms webiny:databaseProxy Updating '65c22661_14octa-contentapi_api_prod_databaseProxy' lambda config. +4s webiny:databaseProxy Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_databaseProxy' in the 'us-east-1' region. +1s webiny:imageTransformer Building 'imageTransformer' +0ms webiny:imageTransformer Finished building 'imageTransformer' +3s webiny:imageTransformer Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_imageTransformer' to the 'us-east-1' region. +4ms webiny:imageTransformer Packaging lambda code from './files/transform/build' +2ms webiny:imageTransformer Updating '65c22661_14octa-contentapi_api_prod_imageTransformer' lambda config. +1s webiny:imageTransformer Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_imageTransformer' in the 'us-east-1' region. +1s webiny:filesManage Building 'filesManage' +0ms webiny:filesManage Finished building 'filesManage' +3s webiny:filesManage Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_filesManage' to the 'us-east-1' region. +3ms webiny:filesManage Packaging lambda code from './files/manage/build' +1ms webiny:filesManage Updating '65c22661_14octa-contentapi_api_prod_filesManage' lambda config. +1s webiny:filesManage Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_filesManage' in the 'us-east-1' region. +966ms webiny:settingsManager Building 'settingsManager' +0ms webiny:settingsManager Finished building 'settingsManager' +5s webiny:settingsManager Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_settingsManager' to the 'us-east-1' region. +3ms webiny:settingsManager Packaging lambda code from './settingsManager/build' +1ms webiny:settingsManager Updating '65c22661_14octa-contentapi_api_prod_settingsManager' lambda config. +1s webiny:settingsManager Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_settingsManager' in the 'us-east-1' region. +1s webiny:securityValidateAccessToken Building 'securityValidateAccessToken' +0ms webiny:securityValidateAccessToken Finished building 'securityValidateAccessToken' +6s webiny:securityValidateAccessToken Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_securityValidateAccessToken' to the 'us-east-1' region. +3ms webiny:securityValidateAccessToken Packaging lambda code from './security/validateAccessToken/build' +1ms webiny:securityValidateAccessToken Updating '65c22661_14octa-contentapi_api_prod_securityValidateAccessToken' lambda config. +1s webiny:securityValidateAccessToken Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_securityValidateAccessToken' in the 'us-east-1' region. +777ms webiny:filesDownload Building 'filesDownload' +0ms webiny:filesDownload Finished building 'filesDownload' +4s webiny:filesDownload Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_filesDownload' to the 'us-east-1' region. +2ms webiny:filesDownload Packaging lambda code from './files/download/build' +1ms webiny:filesDownload Updating '65c22661_14octa-contentapi_api_prod_filesDownload' lambda config. +702ms webiny:filesDownload Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_filesDownload' in the 'us-east-1' region. +768ms webiny:filesBucket Deploying bucket 'contentapi-tnc-1-prod' in region 'us-east-1' +0ms webiny:filesBucket Validating S3 bucket name. +10ms webiny:filesBucket Checking if bucket contentapi-tnc-1-prod exists. +0ms webiny:filesBucket Bucket contentapi-tnc-1-prod does not exist. Creating... +1s webiny:filesBucket Bucket contentapi-tnc-1-prod created. Confirming it's ready... +1s webiny:filesBucket Bucket contentapi-tnc-1-prod creation confirmed. +932ms webiny:filesBucket Setting CORS for bucket 'contentapi-tnc-1-prod' +0ms webiny:filesBucket Setting notification configuration for bucket 'contentapi-tnc-1-prod' +977ms webiny:filesBucket Bucket 'contentapi-tnc-1-prod' was successfully deployed to the 'us-east-1' region +1s webiny:i18nLocales Building 'i18nLocales' +0ms webiny:i18nLocales Finished building 'i18nLocales' +7s webiny:i18nLocales Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_i18nLocales' to the 'us-east-1' region. +3ms webiny:i18nLocales Packaging lambda code from './i18n/locales/build' +0ms webiny:i18nLocales Updating '65c22661_14octa-contentapi_api_prod_i18nLocales' lambda config. +1s webiny:i18nLocales Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_i18nLocales' in the 'us-east-1' region. +929ms webiny:securityGraphQL Building 'securityGraphQL' +0ms webiny:securityGraphQL Finished building 'securityGraphQL' +13s webiny:securityGraphQL Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_securityGraphQL' to the 'us-east-1' region. +3ms webiny:securityGraphQL Packaging lambda code from './security/graphql/build' +1ms webiny:securityGraphQL Updating '65c22661_14octa-contentapi_api_prod_securityGraphQL' lambda config. +2s webiny:securityGraphQL Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_securityGraphQL' in the 'us-east-1' region. +843ms webiny:filesGraphQL Building 'filesGraphQL' +0ms webiny:filesGraphQL Finished building 'filesGraphQL' +14s webiny:filesGraphQL Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_filesGraphQL' to the 'us-east-1' region. +2ms webiny:filesGraphQL Packaging lambda code from './files/graphql/build' +1ms webiny:filesGraphQL Updating '65c22661_14octa-contentapi_api_prod_filesGraphQL' lambda config. +5s webiny:filesGraphQL Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_filesGraphQL' in the 'us-east-1' region. +907ms webiny:i18nGraphQL Building 'i18nGraphQL' +0ms webiny:i18nGraphQL Finished building 'i18nGraphQL' +14s webiny:i18nGraphQL Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_i18nGraphQL' to the 'us-east-1' region. +4ms webiny:i18nGraphQL Packaging lambda code from './i18n/graphql/build' +1ms webiny:i18nGraphQL Updating '65c22661_14octa-contentapi_api_prod_i18nGraphQL' lambda config. +2s webiny:i18nGraphQL Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_i18nGraphQL' in the 'us-east-1' region. +1s webiny:pageBuilderInstallation Object content was not changed. Skipping upload. +0ms webiny:formBuilderGraphQL Building 'formBuilderGraphQL' +0ms webiny:formBuilderGraphQL Finished building 'formBuilderGraphQL' +12s webiny:formBuilderGraphQL Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_formBuilderGraphQL' to the 'us-east-1' region. +3ms webiny:formBuilderGraphQL Packaging lambda code from './formBuilder/build' +1ms webiny:formBuilderGraphQL Updating '65c22661_14octa-contentapi_api_prod_formBuilderGraphQL' lambda config. +2s webiny:formBuilderGraphQL Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_formBuilderGraphQL' in the 'us-east-1' region. +1s webiny:cmsDataManager Building 'cmsDataManager' +0ms webiny:cmsDataManager Finished building 'cmsDataManager' +11s webiny:cmsDataManager Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_cmsDataManager' to the 'us-east-1' region. +3ms webiny:cmsDataManager Packaging lambda code from './cms/dataManager/build' +2ms webiny:cmsDataManager Updating '65c22661_14octa-contentapi_api_prod_cmsDataManager' lambda config. +1s webiny:cmsDataManager Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_cmsDataManager' in the 'us-east-1' region. +821ms webiny:apiTinynewsModels Building 'apiTinynewsModels' +0ms webiny:apiTinynewsModels Finished building 'apiTinynewsModels' +10s webiny:apiTinynewsModels Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_apiTinynewsModels' to the 'us-east-1' region. +4ms webiny:apiTinynewsModels Packaging lambda code from './tinynews-models/build' +1ms webiny:apiTinynewsModels Updating '65c22661_14octa-contentapi_api_prod_apiTinynewsModels' lambda config. +2s webiny:apiTinynewsModels Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_apiTinynewsModels' in the 'us-east-1' region. +770ms webiny:pageBuilderGraphQL Building 'pageBuilderGraphQL' +0ms webiny:pageBuilderGraphQL Finished building 'pageBuilderGraphQL' +12s webiny:pageBuilderGraphQL Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_pageBuilderGraphQL' to the 'us-east-1' region. +3ms webiny:pageBuilderGraphQL Packaging lambda code from './pageBuilder/build' +2ms webiny:pageBuilderGraphQL Updating '65c22661_14octa-contentapi_api_prod_pageBuilderGraphQL' lambda config. +2s webiny:pageBuilderGraphQL Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_pageBuilderGraphQL' in the 'us-east-1' region. +772ms webiny:cmsGraphQL Building 'cmsGraphQL' +0ms webiny:cmsGraphQL Finished building 'cmsGraphQL' +9s webiny:cmsGraphQL Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_cmsGraphQL' to the 'us-east-1' region. +5ms webiny:cmsGraphQL Packaging lambda code from './cms/graphql/build' +1ms webiny:cmsGraphQL Updating '65c22661_14octa-contentapi_api_prod_cmsGraphQL' lambda config. +2s webiny:cmsGraphQL Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_cmsGraphQL' in the 'us-east-1' region. +750ms webiny:cmsContent Building 'cmsContent' +0ms webiny:cmsContent Finished building 'cmsContent' +10s webiny:cmsContent Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_cmsContent' to the 'us-east-1' region. +4ms webiny:cmsContent Packaging lambda code from './cms/content/build' +2ms webiny:cmsContent Updating '65c22661_14octa-contentapi_api_prod_cmsContent' lambda config. +2s webiny:cmsContent Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_cmsContent' in the 'us-east-1' region. +753ms webiny:apolloGateway Building 'apolloGateway' +0ms webiny:apolloGateway Finished building 'apolloGateway' +9s webiny:apolloGateway Starting deployment of lambda '65c22661_14octa-contentapi_api_prod_apolloGateway' to the 'us-east-1' region. +2ms webiny:apolloGateway Packaging lambda code from './apolloGateway/build' +1ms webiny:apolloGateway Updating '65c22661_14octa-contentapi_api_prod_apolloGateway' lambda config. +2s webiny:apolloGateway Successfully deployed lambda '65c22661_14octa-contentapi_api_prod_apolloGateway' in the 'us-east-1' region. +992ms webiny:api Input was not changed, no action required. +0ms webiny:cdn Starting deployment of CloudFront distribution to the us-east-1 region. +0ms webiny:cdn CloudFront deployed successfully with URL: https://d27ff8ul81gmi2.cloudfront.net. +58ms webiny:cdn Adding "X-Cdn-Deployment-Id" forwarded header... +1s webiny:cdn Creating custom error responses... +2ms webiny:cdn Updating CDN with forwarded headers... +0ms

🎉 Done! Deploy finished in 209.132s.

jacqui commented 3 years ago

I'm just going to file all my notes - progress or issues - here for now.

Here's what I'm trying as far as deploying a unique, new and separate API stack is concerned:

This is a bit maddening and there's no documentation on how to deploy multiple webiny stacks - at least not that I've been able to find so far. If I get stuck I will ask about this in the webiny slack.

jacqui commented 3 years ago

so far the deploying from a new directory where I have this repo cloned, in a new branch, with the various project/mongo/s3 names updated, seems to be working.

I did check the ENV in my previous directory/checkout and there was nothing obvious at least. Interesting.

Just trying to sort out whether or not I'll need to maintain separate checkout of this content api repo for each tiny news client... doesn't seem ideal :-/ I'm thinking more about the 1 client == 1 env idea still.

jacqui commented 3 years ago

Hooray, my test deploy in the local env for what I'm calling client-1 succeeded:

  This is the first deploy of local environment, so it may take a few minutes.
  💡 Loaded local environment from <projectRoot>/.env.json.
  💡 Loaded local environment from <projectRoot>/api/.env.json.

  ✔ Great! Your MongoDB is accessible.

  webiny Collecting components from the template. +0ms
  webiny Executing the template's components graph. +50ms

  🎉 Done! Deploy finished in 403.849s.

  🏁 Congratulations! You've just deployed your Webiny API stack for the first time.
  ⏳ Please note that CDN distribution takes some time to propagate, so allow ~10 minutes for it to become accessible.

  Once your CDN is up, the following URLs will be available for you to use:

  🔗 Main GraphQL API: https://d1jzodgk101b9j.cloudfront.net/graphql
  🔗 CMS API:
     - Content Delivery API: https://d1jzodgk101b9j.cloudfront.net/cms/read/production
     - Content Preview API: https://d1jzodgk101b9j.cloudfront.net/cms/preview/production

  To finish the system setup, you need to start your admin app and complete the installation wizard:
  1) cd apps/admin
  2) yarn start

  After you finish the wizard, your system is ready for development.
  To learn more about the admin app, visit https://docs.webiny.com/docs/webiny-apps/admin/introduction

✨  Done in 423.05s.

Next up: deploy admin.

jacqui commented 3 years ago

Argh, immediately ran into trouble trying to deploy the admin stack to the local env:

± |client-trials/1 ✓| → yarn webiny deploy apps --env=local
yarn run v1.22.5
$ /Users/jacqui/Projects/newscatalyst/review-webiny/client-trials/client-1/node_modules/.bin/webiny deploy apps --env=local
  This is the first deploy of local environment, so it may take a few minutes.
  💡 Loaded local environment from <projectRoot>/.env.json.

  ✔ Great! Your MongoDB is accessible.

  webiny Collecting components from the template. +0ms
  webiny Executing the template's components graph. +44ms
  error Command "build:ssr:local" not found.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Not sure what's going on ☝️ here but I'm investigating...