@0xc/maverick 中文文档教程

发布于 5年前 浏览 24 项目主页 更新于 3年前

 npm(作用域)”></a> <a href=npm 构建状态 GitHub 问题 GitHub 拉取请求 < img src="https://badges.greenkeeper.io/tcarrio/maverick.svg" alt="Greenkeeper 徽章"> Libraries.io 对 GitHub 存储库的依赖状态

Maverick

Usage

Usage: maverick [action]

Command your arsenal of Docker containers for ultimate development

Options:
  -V, --version                         output the version number
  -b, --build                           build all or certain services in the docker-compose.yml
  -d, --down                            take down all or certain services in the docker-compose.yml
  -u, --up                              launch a certain or all of the database, redis, and services
  -r, --restart                         restart service name(s)
  -R, --reload                          reload services with updates to env_file and docker-compose.yml
  -s, --setup                           runs the setup script provided by the project (default: false)
  -l, --list [filter]                   list services currently defined for local development
  -p, --ps                              List existing containers
  -n, --ngrok [subdomain] [auth_token]  Persist your subdomain and auth token to the Maverick config
  -g, --generate                        Generate a new Docker Compose using the maverick.yml config
  -i, --init                            Initialize a Maverick configuration in the current directory
  -h, --help                            output usage information

Description

这个项目为 本地开发环境驱动 通过容器化技术。 这个版本建立了一个可选的 maverick.yml 配置 它位于项目的根目录中。 maverick.yml 提供功能到 动态生成的 docker-compose.yml 缓冲区,用于内部 docker.compose 命令。 它将 Docker Compose 服务分为以下几类:

  • images
  • infrastructure
  • batch
  • packages
  • services

Images

镜像仅作为生成所需 Docker 镜像的一种方式存在,可以在以后引用。

Infrastructure

基础设施自动连接到全球生成的网络,应该用于 围绕数据库、消息总线等的定义。还有某些基础设施 开箱即用的服务。 要对内置基础设施使用默认配置, 只需用空值指定键,例如 mysql:。 任何提供的配置都将与 默认值,因此要使用特定的 root 密码设置数据库,您只需要指定 mysql.environment: 条目下密码的环境变量。

Batch

有些操作只需要进行一次。 批次类别是放置的好位置 一次性操作,如数据库更新、迁移等。

Packages / Services

包是 Docker Compose 服务,仅用于监视要转译的源代码更改。 另一方面,服务合并了依赖的转译源。 仅直接依赖 被挂载到服务中,为包提供一个中心位置来观察变化和更新 直接依赖受源代码更改的影响。

最重要的是,开始项目的最佳方式是包含支持的命令 用于 Maverick 自动检测包/服务。 只需添加一个 npm 脚本即可开始。 对于包,添加 maverick:watch。 对于服务,添加 maverick:start。 这些将在 处理您的包的单一存储库并自动实现为包和服务 包含在 Docker Compose 中。

Features

使用 maverick -i 初始化您的项目。 这将生成默认的 Maverick 配置。

使用 maverick -u 启动容器队列。 这也可以接收单独的服务名称。

使用 maverick -r 重新启动服务或整个队列。 对于环境变量的更改,请使用 重新加载 (-R) 选项。 由于环境变量是在创建容器时绑定的,所以只有 销毁现有容器并创建一个新容器将提供更新的环境变量。

使用 maverick -d 拆除所有内容。 也适用于个别服务。

使用 maverick -b 再次构建任何或所有图像。 因为图像本身包含依赖项, Maverick 使用 package.json 和图像中指定的依赖项执行一些确定性的魔法 标签。 因此,每当您重新加载 服务时,都会自动进行重建。 一种简单的制作方法 确保您拥有最新的依赖项是重新加载您的服务。

Future Goals

  • Separate major features into separate subcommands of maverick
  • More robust package and service declarations in the project config

npm (scoped) npm Build Status GitHub issues GitHub pull requests Greenkeeper badge Libraries.io dependency status for GitHub repo

Maverick

Usage

Usage: maverick [action]

Command your arsenal of Docker containers for ultimate development

Options:
  -V, --version                         output the version number
  -b, --build                           build all or certain services in the docker-compose.yml
  -d, --down                            take down all or certain services in the docker-compose.yml
  -u, --up                              launch a certain or all of the database, redis, and services
  -r, --restart                         restart service name(s)
  -R, --reload                          reload services with updates to env_file and docker-compose.yml
  -s, --setup                           runs the setup script provided by the project (default: false)
  -l, --list [filter]                   list services currently defined for local development
  -p, --ps                              List existing containers
  -n, --ngrok [subdomain] [auth_token]  Persist your subdomain and auth token to the Maverick config
  -g, --generate                        Generate a new Docker Compose using the maverick.yml config
  -i, --init                            Initialize a Maverick configuration in the current directory
  -h, --help                            output usage information

Description

This project offers a configurable and dynamic solution for a local development environment driven by containerized technologies. This version institutes an optional maverick.yml configuration that goes in the root directory of the project. The maverick.yml offers functionality into the dynamically generated docker-compose.yml buffer that is used for the internal docker.compose commands. It segments Docker Compose services into the following categories:

  • images
  • infrastructure
  • batch
  • packages
  • services

Images

Images exist only as a means of generating a required Docker image that can be referenced later.

Infrastructure

Infrastructure automatically connects to the global generated network, and should be used for definitions that orient around databases, message buses, etc. There are also certain infrastructure services that are supported out of the box. To use the default configuration for a builtin infrastructure, simply specific the key with a null, e.g. mysql:. Any provided configurations will be joined with the defaults, so to set up a database with a specific root password, you only need to specify the environment variable for the password under the mysql.environment: entry.

Batch

Some operations only need to be done once. The batch category is a good location for putting in one-off operations such as database updates, migrations, and more.

Packages / Services

Packages are Docker Compose services that serve only to watch for source code changes to transpile. On the other hand, services incorporate the transpiled source of dependencies. Only direct dependencies are mounted to a service, providing a central location for packages to watch for changes and update when a direct dependency is impacted by a source code change.

Most importantly, the best way to get started with your project is to include the supported commands for automatic detection of packages/services by Maverick. Just add an npm script to get started. With packages, add maverick:watch. For services, add maverick:start. These will be detected when processing your monorepository for packages and automatically fulfilled as packages and services to be included in the Docker Compose.

Features

Initialize your project with maverick -i. This will generate the default Maverick configuration.

Launch the fleet of containers with maverick -u. This can also receive individual service names.

Restart a service or the entire fleet with maverick -r. For changes to environment variables, use the reload (-R) option. Since the environment variables are bound at the creation of the container, only destroying the existing container and creating a new one will provide the updated environment variables.

Tear everything down with maverick -d. Applies to individual services as well.

Build any or all image again with maverick -b. Because the image themselves contain the dependencies, Maverick performs some deterministic magic using the dependencies specified in the package.json and image tags. Thus, a rebuild will happen automatically whenever you are reloading services. An easy way to make sure you have the latest dependencies is to reload your services.

Future Goals

  • Separate major features into separate subcommands of maverick
  • More robust package and service declarations in the project config
更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文