I have an environment in Amazon (Container Type: 64bit Amazon Linux running PHP 5.4) and I follow this instructions to deploy Symfony2 applications: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_PHP_symfony2.html.
All is working properly but my problem is that Amazon automatically update and download the dependencies of my project (composer.json) when I deploy, but I don't want this issue because some updates can crash the application and I want to controll this.
There is a choice? I'm thinking to delete the vendor folder from my gitignore file(UPDATE: I tried this and didn't work, :-()...
this should work? Which is the best way?
Thanks a lot!
You can control the version that gets download with composer.
http://getcomposer.org/doc/01-basic-usage.md#package-versions
It runs composer.phar install on every deploy. If you put your composer.lock file into your repository and don't change it, nothing will be installed on your server. Beside that if you want to update your dependencies, first install them on your local/deployment machine and if everything is fine push your composer.lock file as well.
Related
I just setup gitdeployment to my production server from my local machine following this tutorial
Now i am going to deploy a laravel project but i've few doubts.
1.In my laravel git repo vendors folders are excluded from the git so when i deploy the project with git to live server it doesn't worked because vendor folder is missing.
One solution to solve this problem is add vendor folder to the git buti don't think its a better practise.
My solution
After git deployment login to my live server and run the composer install command to add the vendors folder.
But its looks painful process suppose if a new package is added to my project (ie image intervention package) i need to repeat my step.
So is there any way to automatically manage vendors folder in live server
I've created a Symfony project and pushed it to the github. Now I want to get it from github on another machine.
The problem is that there are a lot of files/folders in Symfony's .gitignore file by default, so my application is broken after 'git clone' command.
I would like to know, what is the best way/practice to store and retrieve Symfony application on/from github. What are the common steps to do it?
You have to download and install Composer on your server.
Keep your .gitignore as default and install your vendors on each cloning.
If your deployment isn't recurrent, you can do it manually by use :
composer install
after each cloning .
If you deploy recurrently or just if you want, you can automate your deployment using Capistrano tasks for Symfony2
I am new to composer and would like to know how do you guys deploy a project to the production server using composer?
In deploying, would composer also push the dependency packages needed to the server?
Would/ Can composer build the application with minification process?
I think the current best practice is to not run Composer on the target production server. The regular process of deploying a web application usually requires several independent steps, and Composer is only suitable for some of them, regardless of what people make it do additionally.
You mention minification, and I would add the process of pulling in JavaScript dependencies in general. This is no domain for Composer. It has been done in the past to offer Composer packages that contain Jquery, but this requires additional work to put Jquery in the right directory afterwards, adding the need to run post install scripts or add installers that need configuration. I guess the right way to do it would be to use Bower for this.
So the deployment would be at least a three step process.
Use composer to install PHP dependencies.
use bower to install JavaScript dependencies.
Use rsync, SFTP, SCP or FTP(S) to move all the files to the server.
Any optimization steps would be done prior to moving the files onto the server inside the deployment script.
And if anything fails during the collection of dependencies, be it an unsuspected downtime of Github, or your deployment server running out of disk space, you don't end up with a halfway deployed new website version. You can stop the deployment script before syncing if anything is missing or gone wrong.
yes, composer install get all dependencies in your test server, check it, if everything work ok, then sync all the files to your production server, which can save you from the unexpected problem running composer install on your production server.
other way is to sign all the files from your test server after composer install, then use composer install to get all dependencies in your production server, sign the files, now you must check two signs separately generated in test and production server, if it match, congratulations, the deploy is ok.
I want to install intervention/image package on my web server i had installed on my localhost , and i want to install it on my web server , Can I Install Laravel 4 package without using Composer? because i don't have acces to use command prompt on my web server.
How are you installing Laravel and the other dependencies already?
Just install it locally like normal then copy your vendor directory along with the rest of your project to your host.
it's possible for you to just upload your vendor directory with ftp, but I wouldn't advise it to you.
Couple of reasons:
You don't want to upload your dev-dependencies, so you would have to handpick which folder to upload - everytime you want to update your dependencies
Uploading over ftp is very slow, so that might take a long time
You don't get the latest versions of the dependencies (which could resolve some security issues)
You wouldn't get any warning if some package isn't compatible with your environment.
I suggest you to use a host that gives you CLI, or even better that can directly run composer when you push up your files, as hannesvdvreken said, fortrabbit (Disclosure: i work there).
If you are running PHP on a shared host without composer you still have some options left:
Install composer on the server in the same folder as your project,
Upload composer.phar to your server,
Change your hosting provider (try fortrabbit),
Upload your vendor folder from your local computer to your server. (Last resort)
Yes you can download it via LaraPack. It provide you ready-to-use Laravel instalation, so you don't have install it with Composer. It also gets weekly update.
I'd like to know if I can install or use the Laravel PHP framework on any web server without using Composer (PHP package/dependency manager) every time?
I would like to be able to drop my app on to any web server (like a shared server without access to the command line).
If I run composer install the first time (locally), then all the dependencies should be present, correct?
Then, I should be able to drop it onto any server with all of the files (including the vendor directory)?
If you really wanted to, you could do all the work that Composer does manually, but you definitely should not. Installing Composer is easy, it's just a matter of getting the composer.phar file and running commands on it.
You do not need to run Composer on your server as well as locally, once you run composer install or composer update your project will have all its dependencies available and you can just upload it straight to your server.
You cannot install laravel local without composer in your project.
On this site you can download everything what you can download also with the composer build tool. But you do not need a composer installation. Of course laravel is also present there: https://php-download.com/package/laravel/laravel
If you have shared server and you are not able to install composer and run cmd to install a new package or update an existing package.
You can one thing by installing composer on your local machine and install(ex composer require package/name) or update(ex composer update package/name) all the packages, then upload your vendor directory on the server with your code. it will work for you same as in your local environment.
NOTE: I strongly recommend that you should use the Laravel with the composer, it is an important part of laravel and you can try to convince your client to provide a server that supports laravel. Please check the link below and you can find the server requirements. https://laravel.com/docs/5.5#installation
If you don't want to use composer on server then you will have to run composer install/update and download all the libraries locally and then manually upload all those files on the server i.e. Vendor Directory.
In-Case of shared hosting where you can't connect to server with shh there you might have to do that but it will take lot of time to upload all the files on server so I would recommend that you should composer and then download the libraries through composer install/update.
Yes, you can install all project dependencies via composer in your localhost first, and then transfer all the files via FTP to your actual website.
Just download the zip file from github and upload to your htdoc and voilĂ it will work for you