how to use Bamboo for PHP application
Asked by rspl patel:

Hello Support Team,

I have PHP application and need to deploy on server using Bamboo. I have configured plan but not able to find which tasks will helpful for PHP application deployment. Major tasks are related to Java projects only.

Can you please provide steps for do it or if any video you can provide it then will be really help for me and my team.

Thanks,

Sunil


Answers:
author: rspl patel
body: Hi,

Below is scenario for PHP application.

1) I have code which is in git repository.

2) But on live site/server there is no repository due to some firewall/vpn restriction.

3) Now after modified files I am committing file on Git and also manually upload modified file on live server via Filezilla.

4) Question is is there any way in Bamboo, where I can commit my code from local and these all modified files will store into particular place where any developer can deploy modified files on live server using Filezilla, In case of my absent.

Please provide details with steps thanks,

comments: author: Gonchik Tsymzhitov
body: Hi!

Ok, as I understand your have to live server a some connect via ftp/scp.

If I were you, I will setup staging server in development network.

1. This server will be updated from git repo. Has some different configs although live server.

2. Bamboo Plan will include 3 tasks.

2.1. Pull master repo on staging server

2.2. Second task is some smoke test, like "curl staging.example.com", parse result.

2.3. Main task is rsync files to live server.Tasks will base command "SSH task". I have provided you early a doc.

like this "rsync -Pav --exclude config.php --exclude 'admin/config/\*' staging/ deployer@live.example.com:/var/www/live.example.com/"

3. Let's share this plan to developers.

Cheers,

Gonchik Tsymzhitov


author: rspl patel
body: Thanks Gonchik for above answer.

based on your answer, I need to do following steps.

1) Add Bamboo task for checkout from git.

2) Add Bamboo SSH task and add live credential into it.

3) After that execute plan.

Is it correct?

Some where I found below points for PHP application.

I would suggest to create ZIP Artifact, upload it to your server and unzip it.

Step 1: Add new task to your default job - "Script", and inside body add a zip command to create zip file out of your code.

Step 2: Go to Artifacts tab, and define your artifact. Make sure to Share this artifact.

Step 3: Add new tasks to your Deploy - first Artifact download, and select your new created artifact.

Step 4: Add new task - SCP task. It will allow you to copy your zip file to your server. Specify your server credentials and remote path.

Step 5: Add new task - SSH task. Add a simple unzip command to unpack your files.

I got from below URL:

<https://stackoverflow.com/questions/35912145/how-to-deploy-php-project-with-bamboo>

Can you please let me know which is correct?

Thanks,

Sunil


author: Gonchik Tsymzhitov
body: Hi!

Yes, looks like it is correct.

But could you use tar.gz or use chown for unziped files?

Because after extract data you will loose file permissions.

Cheers,

Gonchik Tsymzhitov


author: rspl patel
body: Thanks Gonchik for your help.


author: rspl patel
body: Hi Gonchik,

I have one more query.

Below is the Scenarios:

1) I have modified 2 files for required changes.

2) Commit to git.

3) Now I need only two files which I modify only. Currently in Bamboo, all files are converting into zip file. Is there any way for get only those files which I modify/commit. Something can we do by Patch command but not sure.

Currently I have added Script task into plan and added below command into body.

zip -r php.zip PHP

Can you please help me for in Bamboo which task I need to add into Plan and how to create modified zip files only?

Thanks,

Sunil

Sunil


author: rspl patel
body: Any reply on it please?


author: Gonchik Tsymzhitov
body: Hi Sunil,

You can use SSH tasks for your deployment plans

<https://confluence.atlassian.com/bamboo/using-the-ssh-task-in-bamboo-306348532.html>

or if you want to use PHPUnit let's follow this instruction

[https://confluence.atlassian.com/bamboo/getting-started-with-php-and-bamboo-289277284.html](https://confluence.atlassian.com/bamboo/getting-started-with-php-and-bamboo-289277284.html?)

Hope it helps.

Cheers,

Gonchik Tsymzhitov

comments: author: rspl patel
body: Thanks Gonchik for quick reply.

In my application I don't need to run PHPunit.

Just need to deploy PHP modified files on server. In PHP, no files are compile, just need to deploy only. Please help I am not able to find any solution for it?

Please provide steps or any video tutorial.

Thanks,


author: Gonchik Tsymzhitov
body: Sinul,

Well, your php code in vcs/cvs system?

If it is, let's try to use integration like trigger from bitbucket after commit, then run plan with git pull task and if you need additionaly command let's use terminal commands - "Command".

Videos:

[https://www.youtube.com/watch?v=TwCSOyhYoNc](https://www.youtube.com/watch?v=TwCSOyhYoNc?)

<https://www.youtube.com/watch?v=VTObPQJ1_SE>

<https://www.youtube.com/watch?v=uffm6kdsNF4>

Cheers,

Gonchik Tsymzhitov