承接 onedesign/atomic-deploy 相关项目开发

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

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

onedesign/atomic-deploy

Composer 安装命令:

composer require onedesign/atomic-deploy

包简介

A script to easily handle atomic deployments in a Linux environment.

README 文档

README

This project is based on the concepts presented in Buddy Atomic Deployments. It provides functionality to handle shared files and directories across deployments. While this was built for use with Buddy, it will work in any standard *nix environment.

Dependencies

  • PHP 5.5+
  • curl

File Structure

  • deploy-cache/ - the location where all files are uploaded to the server
  • revisions/ - a directory containing all revisions
  • current - a symbolic link to the current revision
  • shared/ - a directory containing files that should be shared across all deploys

Usage

curl -sS https://raw.githubusercontent.com/onedesign/atomic-deployments/master/atomic-deploy.php | php -- --revision=$(date "+%F-%H-%M-%S")

Buddy + Craft 2 Example

Add the following in the "SSH Commands" section after your file upload action in your pipeline:

curl -sS https://raw.githubusercontent.com/onedesign/atomic-deployments/master/atomic-deploy.php | php -- --revision=${execution.to_revision.revision} --symlinks='{"shared/config/.env.php":".env.php","shared/storage":"craft/storage"}'

Options

  • --revision (required) accepts a string ID for this revision
  • --deploy-dir accepts a base directory for deployments (default: current working directory)
  • --deploy-cache-dir accepts a target cache directory (default: deploy-cache within deploy-dir)
  • --revisions-to-keep number of old revisions to keep in addition to the current revision (default: 20)
  • --symlinks a JSON hash of symbolic links to be created in the revision directory (default: {})
  • --help prints help and usage instructions
  • --ansi forces ANSI color output
  • --no-ansi disables ANSI color output
  • --quiet supresses unimportant messages
  • --protect Password protect sites at .oneis.us (default: true)

Symlinks

Symlinks are specified as {"target":"linkname"} and use the native ln utility to create links.

  • target is relative to the --deploy-dir path
  • linkname is relative to the revision path

For example, specifying this option:

--symlinks='{"shared/config/.env.php":".env.php","shared/logs":"logs"}'

will create symlinks the same way as:

ln -s <deploy-dir>/shared/config/.env.php revisions/<revision>/.env.php
ln -s <deploy-dir>/shared/logs revisions/<revision>/logs

Note: Files and directories that exist where the symlinks are being created will be overwritten. For example, using the above example, this is actually what is happening:

rm -rf revisions/<revision_id>/.env.php \
  && ln -sfn <deploy-dir>/shared/config/.env.php revisions/<revision>/.env.php
rm -rf revisions/<revision_id>/logs \
  && ln -sfn <deploy-dir>/shared/logs revisions/<revision>/logs

Password Protection

By default, the deployment will password protect any site that is served from a *.oneis.us domain name. This works by prepending the contents of the templates/htaccess-auth.txt file to any existing .htaccess file found in the current/web directory. If an .htaccess file does not exist within that directory, one will be generated using the templates/htaccess.txt file.

Testing

cd ./test
php ../bin/deploy \
  --deploy-cache-dir="./deploy-cache" \
  --revision="123456" \
  --symlinks='{"shared/config/env":".env","shared/storage":"storage"}'

onedesign/atomic-deploy 适用场景与选型建议

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

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

围绕 onedesign/atomic-deploy 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 10
  • Watchers: 9
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Unlicense
  • 更新时间: 2021-08-04