google/cloud-tools 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

google/cloud-tools

Composer 安装命令:

composer require google/cloud-tools

包简介

PHP tools for Google Cloud Platform

README 文档

README

Install

Add google/cloud-tools to the require-dev section of your composer.json.

You can also run the following command:

$ composer require google/cloud-tools --dev

Utilities

flex_exec

The cli script src/Utils/Flex/flex_exec is a tool for running a command with using the same Docker image as the application running on App Engine Flex.

It spins up a Docker image of a Deployed App Engine Flexible App, and runs a command in that image. For example, if you are running Laravel application, you can invoke a command like php artisan migrate in the image.

If the Flex application is requesting the cloudsql access (beta_settings, cloud_sql_instances), this tool also provides the connection to the same Cloud SQL instances.

The command runs on virtual machines provided by Google Cloud Container Builder, and has access to the credentials of the Cloud Container Builder service account.

Prerequisites

To use flex_exec, you will need:

  • An app deployed to Google App Engine Flex
  • The gcloud SDK installed and configured. See https://cloud.google.com/sdk/
  • The google/cloud-tools composer package

You may also need to grant the Cloud Container Builder service account any permissions needed by your command. For accessing Cloud SQL, you need to add Cloud SQL Client permission to the service account.

You can find the service account configuration in the IAM tab in the Cloud Console under the name [your-project-number]@cloudbuild.gserviceaccount.com.

Resource usage and billing

The tool uses virtual machine resources provided by Google Cloud Container Builder. Although a certain number of usage minutes per day is covered under a free tier, additional compute usage beyond that time is billed to your Google Cloud account. For more details, see: https://cloud.google.com/container-builder/pricing

If your command makes API calls or utilizes other cloud resources, you may also be billed for that usage. However, flex_exec does not use actual App Engine instances, and you will not be billed for additional App Engine instance usage.

Example

src/Utils/Flex/flex_exec run -- php artisan migrate

Testing Utilities

There are various test utilities in the Google\Cloud\TestUtils namespace.

Test examples

The example test cases are available in test/fixtures/appengine-standard directory.

Environment variables

There are multiple environment variables to control the behavior of our test traits.

All Traits

  • GOOGLE_PROJECT_ID: The project id for deploying the application.
  • GOOGLE_VERSION_ID: The version id for deploying the application.

AppEngineDeploymentTrait

  • GOOGLE_DEPLOYMENT_DELAY: Number of seconds to wait after the deployment has been triggered before continuing to execute tests.
  • GOOGLE_KEEP_DEPLOYMENT: Set to true to keep deployed app in place after test completion.
  • GOOGLE_SKIP_DEPLOYMENT: Set to true if you want to skip deployment.
  • RUN_DEPLOYMENT_TESTS: Set to true if you want to run deploy tests.

DevAppserverTestTrait

  • LOCAL_TEST_TARGETS: You can specify multiple yaml files if your test need multiple services.
  • PHP_CGI_PATH: Path to php-cgi for running dev_appserver.
  • RUN_DEVSERVER_TESTS: Set to true if you want to run tests.

google/cloud-tools 适用场景与选型建议

google/cloud-tools 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 949.94k 次下载、GitHub Stars 达 23, 最近一次更新时间为 2016 年 05 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「test」 「appengine」 「gcp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 google/cloud-tools 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 google/cloud-tools 我们能提供哪些服务?
定制开发 / 二次开发

基于 google/cloud-tools 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 949.94k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 23
  • 点击次数: 38
  • 依赖项目数: 6
  • 推荐数: 0

GitHub 信息

  • Stars: 23
  • Watchers: 23
  • Forks: 20
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2016-05-11