Practice deploying, how to do?

Asked

Viewed 2,792 times

5

Today many languages have practices of deploy that automates the whole process, concept as IC (Continuous Integration).

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

My doubts is how the deploy for PHP applications and what tools are used for this ?

Jenkins and Capistrano. They are usually used in Ruby. Jenkins allows you to perform unit testing or any other tests and if all goes through deploy to the server. Who does the management deploy on the server is Capistrano, it keeps the files of the last release that was working correctly and creates a symbolic link to the new release that has been raised and if any failure occurs in the new release the Capistrano back point to the release previous.

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

  • Did any of the answers satisfy your doubt? if yes accept one of the answers or explain some point not satisfied by the answers.

2 answers

1

I don’t understand what you want exactly, but there are two tools for this

  1. Simple PHP Git deploy script:

    Automatically deploys code using PHP and Git.

  2. Deployer

  3. As the author requested Jekins for PHP

    • Jenkins for PHP: http://jenkins-php.org

      Requirements: Phpunit, Php_codesniffer, PHPLOC, Php_depend, PHPMD, PHPCPD and phpDox

Note: From what I’ve read about, you can rather deploy PHP applications with it, pretty much the same way you deploy apps written in Ruby.

  • Interesting deployer. You have already used Jenkins and Capistrano. They are usually used in Ruby. Jenkins allows you to run unit tests or any other tests and if everything passes, deploy to the server. Who does the management deploy on the server is the Capistrano, it keeps the files of the last release that was working properly and creates a symbolic link to the new release that was uploaded and if any failure occurs in the new release the Capistrano back point p the previous release.

  • @Leandromacedo No, I’m more of a hand job. But one day maybe I’ll test.

  • automation tools are a hand on the wheel. Still mias with those of devOps and CI. I recommend you learn and very interesting.

  • of curiosity, what kind of test you usually do for your applications ?

  • @Leandromacedo I really do a lot of things at hand, I am very focused on developing Classes/codes for using other tools and not "complete solutions", but I will study this when I have a time :) ... I edited the answer.

0

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

Excerpt from the article: Local repository If you already have a local repository, jump to the pícoximo passo. It all starts with creating a simple Git repository: Tools used during 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, let’s 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 facilitated, we will create the repository there that 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 git-hook that will be responsible for copying all the 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

Note that we first set the GIT_WORK_TREE environment variable as the site’s root and then run a git checkout -f that will move the files without a 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 on-air, just run the command (after you commit):

git push web

As the focus changed to Jenkins I will leave some links of PHP usage tutorials with Jenkins as a complement.

Git

Deployer

Heroku

  • Interesting deployer. You have already used Jenkins and Capistrano. They are usually used in Ruby. Jenkins allows you to run unit tests or any other tests and if everything passes, deploy to the server. Who does the management deploy on the server is the Capistrano, it keeps the files of the last release that was working properly and creates a symbolic link to the new release that was uploaded and if any failure occurs in the new release the Capistrano back point p the previous release.

  • @Leandromacedo, knew the Jenkins (used in a java project made in college) but now I’m getting to know this Capistrano

  • I saw the use of Capistrano for web applications in Ruby, and I fell in love. It is very practical and helps me in deploy. Even avoid that situation when we are uploading new files from the system and it gets inattentive.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.