GithubHelp home page GithubHelp logo

guoyu07 / php-deploy-rocketeer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from code-smell/php-deploy-rocketeer

0.0 0.0 0.0 456 KB

Deploying a PHP Application with Rocketeer

License: MIT License

PHP 100.00%

php-deploy-rocketeer's Introduction

Deploying a PHP Application with Rocketeer

This is an example project using Rocketeer for deploying a PHP application.

What's Rocketeer?

Rocketeer is a fast and easy deploying tool for PHP developers. It is inspired by Capistrano which is written in Ruby, but can easily be used to deploy any language. Since Rocketeer is written in PHP it has a few advantages over Capistrano especially in a PHP environment.

It requires an SSH connection, meaning if your project is running on a shared hosting (and use FTP to upload files), it probably can't do anything for you.

Rocketeer provides a handful of built-in tasks to deploy and manage your remote projects.

Core folders

Two configuration options are essential when deploying with Rocketeer.

The root_directory on your server โ€“ this folder is Rocketeer's little self-contained world: whatever it does will be in that folder. And the application_name - this is to let Rocketeer handle multiple applications on the same server.

If per example your root_directory is /var/www/ and your application_name is webapp, then Rocketeer will create /var/www/webapp/ and everything it does will happen in that folder.

How it works

In the working folder mentioned above Rocketeer will create three folders.

  • releases is where the history of your application is stored.
  • current is where the latest version of your application will always be. This is a symlink pointing to one of the releases in the releases folder.
  • shared is where files are stored, that are shared between each releases.

When a new release is created and is ready to be served, Rocketeer will update the symlink of the current folder to make it point to the new release.

| var
|-- www
  |-- webapp
    |-- current => /var/www/webapp/releases/20130721000000
    |-- releases
    |  |-- 20130721000000
    |  |  |-- app
    |  |     |-- storage
    |  |       |-- logs => /var/www/webapp/shared/app/storage/logs
    |  | 20130602000000
    |-- shared
      |-- app
        |-- storage
          |-- logs

Template for PHP application with Rocketeer

I have prepared a template for a simple PHP application and the deployment with Rocketeer. In order to work you must have Git installed on your machine.

1. Clone repository

$ git clone https://github.com/code-smell/php-deploy-rocketeer.git

2. Install Rocketeer

$ cd php-deploy-rocketeer
$ php composer.phar install            

3. Edit configuration

In file .rocketeer/remote.php edit the following line:

'root_directory' => 'your_root_directory',

In file .rocketeer/config.php edit the following lines:

'host'      => 'your_host',
'username'  => 'your_username',
'password'  => 'your_password',

If you leave the entries above empty, you will be asked by Rocketeer.

Please note that the folder .rocketeer is hidden and therefore is not visible in your file explorer.

4. Deploy application

Now, you are ready to deploy.

$ cd php-deploy-rocketeer
$ php vendor/bin/rocketeer deploy

You can skip the questions about the repository username and password asked by Rocketeer. After finishing you can display the current release.

$ php vendor/bin/rocketeer current

To list the available commands use the following command.

$ php vendor/bin/rocketeer list

5. Open website

Depending on your remote server configuration you can access the PHP application by typing:

http://your-webserver.test/

The output should be something like this:

Rocketeer Release 20161015204946.        

What's next

Of course, this was only a simple example. There isn't a database nor a complex structure in this application. But it clearly shows that deploying with Rocketeer is quite easy. Now it's up to you.

php-deploy-rocketeer's People

Contributors

tbreuss 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.