@if ( '/' != $uri && '' != $uri )
@else @endif
 
 
How It Works?
TOP
Ladep works with SSH, GIT, rsync, composer, Java. The following is the main workflow.


How does Ladep build your project?
  1. Fetch source code from the GIT repository to your deploy server.
  2. Create an .env file for Laravel Framework.
  3. Assemble file config/app.php to your project.
  4. Install all composers.
  5. Assemble file config/database.php to your project.
  6. Assemble file config/session.php to your project.
  7. Assemble file public/.htaccess to your project.
  8. Assemble user customized HTTP error pages to your project.
  9. Scan all JavaScript files by tag ladep=1 from all views, and then, try to compress and confuse them, and finally, try to inject the compressed stream into the views.
  10. Scan all CSS files by tag ladep=1 from all views, and then, try to compress them and inject the compressed stream into the views.
  11. Clean up unnecessary files.
  12. All done.

How does Ladep push your project to the target servers?
  1. Create a new directory by version(GIT tag) in the releases directory on the target server if it does not exists.
  2. Use command rsync to upload files of the project to the directory on the target servers.
  3. Set file modes on the target servers to make the project works well.
  4. Remove soft link wwwroot on the target server if it already exists.
  5. Create new soft link wwwroot to the new uploaded directory on the target server.
  6. Create a tar archive for the previous version and remove and remove existing files to save the system inode.
  7. Okay, a new version was released.

What does the directory structure on the target server looks like?
/your/project/directory/
|--releases
|    |--1.0.5
|    |--1.0.4-_-20160512093356.tar
|    |--1.0.3-_-20160510195125.tar
|--wwwroot -> /your/project/directory/releases/1.0.5/
 
 
Requires
TOP
In order to deploy your projects by Ladep, all required things are here:
  • Your projects must be stored in a git repository
  • Your projects must be written by Laravel Framework
  • An individual and isolated deploy server with Linux/Unix/Mac OS X, SSH, rsync, MySQL, Java installed
    And a MySQL database must be created for project testing. Please execute the following commands in your MySQL environment:
    $ create database homestead;
    $ grant ALL privileges on homestead.* to 'homestead'@'localhost' identified by 'secret';
    $ FLUSH PRIVILEGES;
 
 
Deploy key
TOP
In order to transmit data safely, Ladep use SSH to do that between your deploy server and production servers. So, we must put the SSH public key of deploy server to all of your production servers.
The current user's SSH public key is located in ~/.ssh/id_rsa.pub on your deploy server.
You can execute the following command to generate a new one if it does not exists:
$ ssh-keygen -t rsa

On production servers, try to append the SSH public key to ~/.ssh/authorized_keys if it does not exists.
And, don't forget to set the permission for the file:
$ chmod 600 ~/.ssh/authorized_keys

For more information, please view :
How to configure passwordless login in Mac OS X and Linux
 
 
Project file
TOP
The structure of a project file like this:
{
    "name"	: "cn.ladep.www",
    "repo"	:
    {
            "url"	: "https://github.com/dekuan/cn.ladep.git",
            "ver"	: "1.0.6"
    },
    "server" :
    {
        "config" :
        {
            "url"	: "/etc/ladep/config/production/cn.ladep.www/",
            "type"	: "file"
        },
        "list" :
        [
            {
                "host"	: "111.111.111.111",
                "user"	: "worker",
                "pwd"   : "",
                "dm"	: "www.ladep.cn",
                "path"	: "/var/www/cn.ladep.www/"
            }
        ]
    }
}

Description
["name"]
The name of your project, it can be any string you like, for example: cn.ladep.www, ladep-website.
["repo"]
Specify Git repository.
["repo"]["url"]
Specify url of the Git repository.
["repo"]["ver"]
Specify version/tag of the Git repository you want to build.
Notes:
If you specify option --last for command build, this parameter will be ignored and be replaced with the latest version/tag obtained from Git repository in real-time.
For example:
$ ladep build project/production/cn.ladep.www --last
["server"]
Specify target server.
["server"]["config"]
Specify location of a directory that contains the configuration files for the target server.
["server"]["config"]["url"]
Specify location of a directory that contains the configuration files. Usually, this directory contains file app.php, database.php, .htaccess.
app.php
Specify any customized configurations in this file for the target server that may different from your local or development server.
database.php
Specify database connection parameters in this file for the target server that may different from your local or development server.
.htaccess
Specify URL rewrite rules and other options for the target server.
["server"]["config"]["type"]
Specify type of the location. This is always "file" so far.
["server"]["list"]
Specify one or more target server(s). The description of the server node is listed below:
{
["host"] : "111.111.111.111",
The IP address of one target server.

["user"] : "worker",
The owner name of your project, this is usually an user name of Linux/Unix/Max OS X. Ladep use it to log on the target server via SSH. By the way, we strongly recommended that you shouldn't use root user.

["pwd"] : "",
This parameter is useless so far, please maintain it as empty. Ladep transmits data in passwordless mode. For more information, please see Deploy key

["dm"] : "www.ladep.cn",
The domain name of your project. It's usually a domain name of your web service.

["path"] : "/var/www/cn.ladep.www/"
The location of a directory of your project on target server. It might be used by Apache, Nginx, Lighttpd or other HTTP daemons. So, it's usually a website directory.
}
 
 
Command
TOP
build
Fetch source code by version/tag from your GIT repository and build it.
Options:
--last
If this option was specified, Ladep will obtain the latest version/tag from your Git repository in real-time. The version/tag in project file will be ignored.
--no-compress-js
If this option was specified, Ladep will give up to scan and compress JavaScript.
--no-compress-css
If this option was specified, Ladep will give up to scan and compress CSS.
For example, to build the latest version:
$ ladep build project/production/cn.ladep.www.ladep --last

push
push a built project to target server.
Options:
--last
Ladep will obtain the latest version/tag from your Git repository in real-time. The version/tag in project file will be ignored.
For example, to push the latest version to your production server(s):
$ ladep push project/production/cn.ladep.www.ladep --last

rollback
rollback a project to specialized version/tag.
For example, to rollback your project to version 1.0.1:
$ ladep rollback project/production/cn.ladep.www.ladep 1.0.1

view
view all versions/tags on target server.
For example, to view all versions on your production server(s):
$ ladep view project/production/cn.ladep.www.ladep

pulllog
pull laravel exception logs of all projects to local.
For example, to pull all log files to local machine:
$ ladep pulllog

selfupdate
Update Ladep itself to the latest version.
$ ladep selfupdate