Code Monkey home page Code Monkey logo

codeigniter-deployer's Introduction

CodeIgniter Deployer

Latest Stable Version Total Downloads Latest Unstable Version License

A Deployment Tool for CodeIgniter 3.0.

You can deploy CodeIgniter with one command.

This is based on Deployer 3.0.

Folder Structure

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

Requirements

  • PHP 5.4.0 or later
  • Composer
  • Git
  • SSH
  • Shell

Installation

Install this project with Composer:

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

Install deploy folder to your CodeIgniter application folder:

$ php vendor/kenjis/codeigniter-deployer/install.php
  • Above command always overwrites exisiting files.
  • You must run it at CodeIgniter project root folder.

Configuration

Configure deploy/deployer.php.

Servers

// 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');

See https://github.com/deployphp/docs/blob/master/servers.md for details.

Repository

// Your Git repository
set('repository', '[email protected]:org/your-codeigniter-app.git');

You need git command on your servers, and make sure you can git clone on the servers.

Reference

Configure Your Servers

Apache

See the sample below. In this case, /var/www/your-codeigniter-app is a base folder.

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

Each deployment is installed in releases/YYYYMMDDHHMMSS folder.

The current release is your-codeigniter-app/current folder, and it is a symbolic link to releases/20150529181638 folder.

So if you use codeigniter-composer-installer's folder structure, your Apache configuratoin is like this:

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

If you use CodeIgniter as the default folder structure, your Apache configuratoin is like this:

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

sudo

Deployer will try to get write permission with the sudo command, so this command has to be running without prompt password and without tty.

Here is an example of configuration:

Defaults:username !requiretty

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

If you don't need sudo for your deployment, you can set in deploy/deployer.php.

set('writable_use_sudo', false);

How to Deploy

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

Related Projects for CodeIgniter 3.0

codeigniter-deployer's People

Contributors

kenjis avatar

Watchers

James Cloos avatar Joao Saraiva avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.