Practice deploy, how to do?

5

Currently many languages have deploy deploy practices that automates the whole process, such as CI (Continuous Integration).

Each commit in the repository is deploy system (I believe Jenkins or Capistrano) performs unit testing / TDD and if everything is ok it sends the files to the server.

My question is how do you deploy deploy for PHP applications and which tools are used for this?

Jenkins and Capistrano. They are commonly used in Ruby. Jenkins allows you to run unit tests or any other tests and if all else passes the deploy to the server. Who deploy deploy on the server is Capistrano, it maintains the files of the last release that was working properly and creates a symbolic link for the new release in> that has been uploaded and if there is any failure in the new release Capistrano will point back to the previous release .

I want to understand how to use Jenkins and Capistrano for PHP applications or similar tools.

    
asked by anonymous 22.04.2015 / 14:53

2 answers

1

I do not understand what you want exactly, but there are two tools for it

  • Simple PHP Git deploy script :

    Automatically deploy the code using PHP and Git.

    • Repository: link
    • (this step is only required in private repositories) go to link and add your server's SSH key .
    • Go to link .
    • Click add webhook in the Webhooks panel.
    • Enter the Payload url to deploy the script ex: http://example.com/deploy.php?sat=YourSecretAccessTokenFromDeployFile .
  • Deployer

  • As the author requested Jekins for PHP

    • Jenkins for PHP: link

      Requirements: PHPUnit, PHP_CodeSniffer, PHPLOC, PHP_Depend, PHPMD, PHPCPD and phpDox

  •   

    Note: As I read on, you can actually deploy PHP applications with it, pretty much the same way you do with applications written in Ruby.

        
    22.04.2015 / 15:01
    0

    There is an English article explaining how deploy is done with Git English article , version in Portuguese edited Translated and Edited

    Article Excerpt: Local repository If you already have a local repository, skip to the next step. It all starts with creating a simple Git repository: Tools used in the process:

    $ mkdir website && cd website
    $ git init
    Initialized empty Git repository in /home/thiagobelem/website/.git/
    $ echo 'Olá, mundo!' > index.html
    $ git add index.html
    $ git commit -q -m "Iniciando o repositório"
    

    Now that your local repository is ready, index.html has been created and the first commit done, we will create the remote repository in the production environment (server where the site is / will run). Remote Repository Assuming that your site will run on a server that you have SSH access made easy, we will create the repository there which will be a copy of the local server:

    $ mkdir website.git && cd website.git
    $ git init --bare
    Initialized empty Git repository in /home/thiagobelem/website.git/
    

    Now let's start creating the git-hook that will be responsible for copying all files - from the bare repository - to the folder where the site will run in the production environment:

    $ cat > hooks/post-receive
    #!/bin/sh
    GIT_WORK_TREE=/var/www/meusite.com.br git checkout -f
    $ chmod +x hooks/post-receive
    

    See that we first set the GIT_WORK_TREE environment variable as the root of the site and then run a git checkout -f that will move the files without any trace from your Git repository. Now just go back to your machine and add the remote repository:

    $ git remote add web ssh://meusite.com.br/home/thiagobelem/website.git
    $ git push web +master:refs/heads/master
    

    Updating the files As you work on the site and want to update the server in the air, you just run the command (after doing the commit):

    git push web
    
      

    As the focus has shifted to jenkins, I'll leave some links to the PHP Using PHP Tutorials as a complement.

    Git

    Deployer

    Heroku

    22.04.2015 / 15:10