I’ve been using cakephp for a local information management project.
I’ve decided to use version 3 for my little e-commerce project but i have several questions regarding deployment to our hosting platform.
In version 2, it was easy to develop in local and deploy to live server.
Right now with version 3 it’s a little complicated with composer activities and so on.
What is the recommended way of working on cakephp for local development and deployment to live server ?
I’ve read several articles about it, but i am interested in the security perspective and don’t do’s.
Is it safe to upload my local development copy to a live server ?
I am continuously updating my dependacy libraries/plugins via composer, is it safe to upload composer modifications ?
You may try with capcake using capistrano
What I do with simple pages (e.g. < 10 controllers/tables) is set up a clone repo in the server, and install with composer using
composer install --no-dev -o configure the app.php (set debug to false) and done!
Actually composer helps you in safe deploying. My strategy is the following.
- I have my development enviroment where I regularly run composer update to get the latest versions of cake and libraries.
- I use github for version control. So when I am working on a bugfix or on a new feature I push my changes there.
- I added /vendor, /tmp, /logs to my .gitignore file as I do not want them in version control.
- When I want to deploy I just pull my code from github and use the composer --nodev install command to get my code and all the used libraries to the production server.
Thank you very much for the recommendations.
I’ve used a svn method similiar to rrd several years ago.
I will try to use composer for my project too.
What about security ? Can you protect your code within github from unwanted access from bug hunters ?
Since my projects are private, i use git to deploy my code.
It works really nice.
Bitbucket offers free private repos.
CakePHP 2.x doesn’t create cache and logs folder in tmp when debug value is 0.
I use Apache environment variable for setting debug value
Here is how I deploy
Now, there is a problem. CakePHP will throw error as it won’t generate cache and logs folder. These folders are generated when request hits Cake app with debug level != 0.
How do I solve that? I don’t want to change debug level to non-zero on my production machine.
@markstory @dereuromark Please suggest
You should have your own deploy scripts take care of that.
It can be as simple as
mkdir -p ./tmp