hut6/docker-cli-utils 问题修复 & 功能扩展

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

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

hut6/docker-cli-utils

Composer 安装命令:

composer require hut6/docker-cli-utils

包简介

HutSix Docker Utilities

README 文档

README

Utilities to help with docker deployments

Prerequisites

composer req --dev hut6/docker-cli-utils
composer req --dev hut6/tag-release
composer req --dev deployer/dist

You will need to create a deploy/deployer-hosts.yml inventory file (as per Deployer https://deployer.org/docs/hosts.html) and list all the hosts used for deployments.

A VERSION file is also required. Version increments can be managed with the tag-release script. The VERSION file is only required when pushing secrets to 1Password scripts because the title of the entry in 1Password will include the version in it. It is not used for anything else.

You will also need a custom deployer recipe, Dockerbuild file, and at least one Docker Compose file for each project. Example files are available at https://github.com/hut6/2020-docker-prod-boilerplate

Building

bin/build master                                   # branch name
bin/build branch_name                              # branch name
bin/build 1.0.0                                    # tag
bin/build 042f86676a45                             # short hash
bin/build 2ba2014b133ad9feda8fc0c5843dd8dcbf2a8c00 # long hash

The image name will be determined using the git remote; if the remote is git@github.com:hut6/docker-cli-utils.git then the docker image will be called hut6/docker-cli-utils.

The command argument determines which commit is checked out, it can be a branch name, a tag, or a hash.

The argument will also be used as the tag for the Docker image. If building bin/build branch_name, then it will be tagged like this hut6/docker-cli-utils:branch_name. Another example would be bin/build 1.0.0 => hut6/docker-cli-utils:1.0.0.

When building the image, the local files are not used, the remote is used; changes need to be pushed to the remote before the image can be built.

Pushing

Same as above. bin/push branch_name will push hut6/docker-cli-utils:branch_name to DockerHub. The image needs to exist locally (ie needs to have been built).

Deploying

For each host, specify the Docker Compose file like this: compose_file: production.yml

bin/deploy branch_name production

First argument is the tag (as per build and push process) and second argument the host, as per the deploy/deployer-hosts.yml file. This will deploy hut6/docker-cli-utils:branch_name on the production host.

The image needs to exist on DockerHub.

Secrets Management

You'll need the 1Password CLI client op for push/pull.

Install it from https://support.1password.com/command-line/

Required files & directories

You'll need to create a /secrets directory which will contain a environment.env file for each of your deployment environments, eg production.env, or staging.env

Use the deploy/deployer-hosts.yml inventory file to specify which entry in 1Password should be used for each hosts, using the secrets_uuid key.

Pushing to 1Password

To push your file from the secrets directory to 1Password, run the following command.

bin/secrets push production

Replace production with the right host key, as per your deploy/deployer-hosts.yml file.

The first time you run this command, it will ask you which vault needs to be used.

The same command can be used to update the entry in 1password after you make changes to production secrets file.

Pulling from 1Password

This will pull the secrets file from 1password, using the UUID specified in deploy/deployer-hosts.yml, and add it to the secrets directory.

bin/secrets pull production 

Updating the docker secrets

This will load the secrets (from the secrets directory) into the docker daemon for the specified host. Containers likely will need restarting, and this command doesn't do this.

bin/secrets load production 

hut6/docker-cli-utils 适用场景与选型建议

hut6/docker-cli-utils 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.67k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 02 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 hut6/docker-cli-utils 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2020-02-20