承接 firevel/artisan 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

firevel/artisan

Composer 安装命令:

composer require firevel/artisan

包简介

Serverless Laravel Artisan for AppEngine

README 文档

README

Artisan support for Laravel / Firevel running on App Engine or Google Cloud Run. It can be used for remote command execution or Cloud Scheduler.

Installation

Install package:

composer require firevel/artisan

Publish config:

php artisan vendor:publish --provider="Firevel\Artisan\ArtisanServiceProvider" --tag="config"

Usage

With Google Cloud SDK you can execute artisan commands directly from your command line. Make sure your user got cloudscheduler.jobs.run or appengine.runtimes.actAsAdmin permission.

After replacing {command} with artisan command (ex.: route:list) and {project} with your project name you can run:

curl -X POST -d "{command}" -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Accept: application/json" https://{project}.appspot.com/_artisan/call

If you are running multiple services, replace {service} with your service name and run:

curl -X POST -d "{command}" -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Accept: application/json" https://{service}-dot-{project}.appspot.com/_artisan/call

Using queues

If you would like to use queues to run your commands, you would need to set ARTISAN_CONNECTION and ARTISAN_QUEUE env variables first.

Default connection is set to cloudtasks and default queue is set to artisan. If you would like to use default configuration make sure:

To dispatch command run:

curl -X POST -d "{command}" -H "Authorization: Bearer $(gcloud auth print-access-token)" https://{project}.appspot.com/_artisan/queue

or

curl -X POST -d "{command}" -H "Authorization: Bearer $(gcloud auth print-access-token)" https://{service}-dot-{project}.appspot.com/_artisan/queue

Google Cloud Scheduler

You can use this package to run commands using Cloud Scheduler.

Cloud Run

Add a job via the Cloud Scheduler page in the Google Cloud console. To begin, select the Target Type as HTTP, followed by specifying the URL field as https://{APP_URL}/_artisan/call, method POST, and the appropriate artisan command in the Body field (e.g., route:cache). For the Auth header, select "Add OICD token", and for the service account, select the default App Engine account. If you prefer to use a different service account, you will need to add the service account email to the configuration file under artisan.authorized_service_accounts.

Default artisan.authorized_service_accounts is:

    'authorized_service_accounts' => [
        env('GOOGLE_CLOUD_PROJECT') . '@appspot.gserviceaccount.com',
    ],

Make sure your GOOGLE_CLOUD_PROJECT is set if you are using default configutation.

App Engine

If you are using App Engine you can use standard cron.yaml file.

Security

Request validation is based on:

  • GAE_SERVICE env variable with x-appengine-cron, x-google-internal-skipadmincheck, x-cloudscheduler and x-appengine-cron header
  • or OIDC token validation if bearer token is JWT.
  • otherwise it will validate bearer token using testIamPermissions

A possible weakness is sending a bearer token instead of a signature. In the event of a user entering a typo in the URL, the sensitive token may be sent to the incorrect service.

Warning

If you are using this package outside App Engine make sure GAE_SERVICE env is NOT set.

firevel/artisan 适用场景与选型建议

firevel/artisan 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.41k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 10 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 firevel/artisan 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-10-25