stef686/codeigniter-deployer

CodeIgniter 3.0 的部署工具

安装次数: 1,851

依赖关系: 0

建议者: 0

安全性: 0

星级: 0

关注者: 1

分支: 22

类型:项目

dev-master / 1.0.x-dev 2018-04-12 13:10 UTC

This package is not auto-updated.

Last update: 2024-09-21 05:24:48 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

这是Kenjis原始包的分支,针对Deployer 6.1.0进行了更新

CodeIgniter 3.1.*的部署工具

您可以使用一条命令部署CodeIgniter。

基于Deployer 6.1.0

文件夹结构

codeigniter/
└── deploy/
     ├── deploy.php ... config file for Deployer
     ├── deploy.sh  ... script to deploy
     └── logs/

需求

  • PHP 7.0 或更高版本
  • Composer
  • Git
  • SSH
  • Shell

安装

使用Composer安装此项目

$ cd /path/to/codeigniter/
$ composer require stef686/codeigniter-deployer:1.0.x@dev --dev

deploy文件夹安装到您的CodeIgniter应用程序文件夹中

$ php vendor/stef686/codeigniter-deployer/install.php
  • 以上命令会覆盖现有文件。
  • 您必须在CodeIgniter项目根目录下运行它。

配置

配置deploy/deployer.php

服务器

// Your production server
server('prod', 'your.server.example.com', 22)
    ->user('username')
    ->forwardAgent()
    ->stage('production')
    ->env('branch', 'master')
    ->env('deploy_path', '/var/www/your-codeigniter-app');

有关详细信息,请参阅https://github.com/deployphp/docs/blob/master/servers.md

仓库

// Your Git repository
set('repository', 'git@github.com:org/your-codeigniter-app.git');

您需要在服务器上配置git命令,并确保您可以在服务器上运行git clone

参考

配置您的服务器

Apache

请参阅下面的示例。在这种情况下,/var/www/your-codeigniter-app 是基本文件夹。

your-codeigniter-app/
├── current -> /var/www/your-codeigniter-app/releases/20150529181638
└── releases/
     ├── 20150529180505/
     ├── 20150529181203/
     └── 20150529181638/

每次部署都安装到 releases/YYYYMMDDHHMMSS 文件夹中。

当前版本是 your-codeigniter-app/current 文件夹,它是到 releases/20150529181638 文件夹的符号链接。

因此,如果您使用codeigniter-composer-installer的文件夹结构,则您的Apache配置如下所示

DocumentRoot /var/www/your-codeigniter-app/current/public

如果您使用CodeIgniter作为默认的文件夹结构,则您的Apache配置如下所示

DocumentRoot /var/www/your-codeigniter-app/current

sudo

Deployer将尝试使用sudo命令获取写权限,因此此命令必须在无提示密码和无tty的情况下运行。

以下是一个配置示例

Defaults:username !requiretty

username   ALL=(ALL) NOPASSWD: /usr/bin/setfacl

如果您不需要为您的部署使用sudo,您可以在deploy/deployer.php中设置。

set('writable_use_sudo', false);

如何部署

$ cd /path/to/codeigniter/
$ cd deploy/
$ sh deploy.sh

CodeIgniter 3.0的相关项目