定制 tiknil/skipper 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

tiknil/skipper

Composer 安装命令:

composer require tiknil/skipper

包简介

CLI application to manage multiple instances of local web applications

README 文档

README

Skipper is a tool for managing multiple local Laravel docker-compose deployment.

It is strongly opinionated towards the patterns used by Tiknil while building a laravel application.

Installation

composer global require tiknil/skipper

Make sure that the composer binaries directory is in your $PATH

You can update Skipper to the latest version by running

composer global update tiknil/skipper

Usage

Register the current path as a skipper project:

# No options, sane defaults will be used and you will be asked to confirm the main fields
skipper init

# All fields can also be set via command line options
skipper init --host=[host] --name=[name] \
        --compose-file=docker/docker-compose.yml \
        --env-file=docker/.env \
        --http-container=nginx
        --php-container=php-fpm

You will be asked to automatically install the default laravel docker compose files.

See Project for details about each field.

Start the project containers

skipper sail

Stops the project containers

skipper dock

Install caddy root certificate

skipper proxy:certs

Once a project is running, skipper provides some useful commands to directly interact with it.

skipper bash                  # Start a new bash shell inside the PHP container
skipper composer [command...] # Run a composer command (use instead of composer [command]
skipper artisan [command...]  # Run an artisan command (use instead of php artisan [command]
skipper tinker                # Start a new Laravel Tinker shell
skipper backup                # Create a new MySQL backup
skipper restore --file [file] # Restore a MySQL backup

Run skipper without arguments for a complete list of available commands

Architecture

Skipper runs a Caddy container, running as reverse proxy and forwarding requests to the corresponding project instance. Caddy is also able to generate HTTPS certificates for local domains, enabling a local environment very similar to a production deployment.

Skipper install its files inside the ~/.skipper directory.

Mailpit

Skipper also runs a Mailpit container by default. You can see the web dashboard at localhost:8025

Laravel should use the host host.docker.internal and port 1025 with driver SMTP:

MAIL_MAILER=smtp
MAIL_HOST=host.docker.internal
MAIL_PORT=1025

This avoids running a separate mailpit/mailhog instance for each project.

Docker compose commands

You may need to run custom docker compose command for a project, e.g. ps to see running containers.

You can use the compose command:

skipper compose [command]

Basically, replace each docker-compose [command] with skipper compose [command]. This is required because skipper attaches some options to the docker-compose command that are required, such as the name or the env file path.

Project

For the reverse proxy to work, skipper need to know about a project and update the caddy configuration file. A new project is registered using the init command.

All available projects are registered inside the ~/.skipper/config.yaml configuration file.

  • name: The project name is used as the docker compose prefix for each container, volume or network related to the project. As a consequence, it must be unique and an update can result in data loss (new docker volumes will be used).
  • host: The domain to register in the reverse proxy
  • path: The path to the project root
  • composeFile: relative path to the docker-compose file.
  • envFile: relative path to the .env file for the docker-compose file
  • httpContainer: name of the http container, where caddy should forward the requests
  • phpContainer: name of the php container, where the utility commands should be run.

Development

Skipper leverages strongly the Symfony console and process components.

If you are developing skipper and you need to test your edits, you have two choices:

  • Run the bin/skipper binary directly (e.g. bin/skipper list)
  • Update your global composer.json file with a reference to the local project:
"repositories": [
    {
        "type": "path",
        "url": "path/to/your/local/project"
    }
],

Now running composer global require tiknil/skipper your local version will be used instead of the published version.

See CONTRIBUTING.md for additional technical informations.

Troubleshooting

Invalid SSL certificates on a new project

In case of ssl errors after launching a new project, you probably need to install the Caddy root certificate into your system.

skipper proxy:certs

Note that the browser may cache the ssl error, you may need to wait a while after installing the certificate for the browser to stop showing warnings

Invalid SSL certificates on a running project (INVALID_DATE)

In case ssl errors start occurring after the project is running for a while, it is probably caused by a time drift between your PC datetime and the container internal clock. You can reload the caddy container to resolve:

skipper proxy:reload

command not found: skipper

If your shell does not find the skipper command after the global installation with composer, you probably do not have the composer bin directory into your $PATH.

Add the following line to your ~/.zshrc:

export PATH=$PATH:$HOME/.composer/vendor/bin

Then reload the file:

source ~/.zshrc

If you are not using zsh as your shell, refer to your preferred shell configuration file instead of ~/.zshrc

tiknil/skipper 适用场景与选型建议

tiknil/skipper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 28 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 05 月 24 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 28
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 12
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-24