deployment - OpsWorks / Chef PHP deploy process -
i'm having serious frustration getting simple php application deploy reliably using opsworks, can't find documentation of how srv/www/app-name/releases
directory managed, think may been cause of current problem.
i'm deploying laravel application, need 2 things happen chef recipes on deploy: composer install, , directories made writable. composer seem installing fine, recipe create & chmod directories seems happen previous release - makes no sense me @ all.
install composer:
node[:deploy].each |application, deploy| script "composer-install" interpreter "bash" cwd "#{deploy[:deploy_to]}/current" user "root" code <<-eoh composer install eoh end end
this works fine, can refresh vendor directory runs see dependencies appearing. next recipe run:
node[:deploy].each |application, deploy| chef::log.info("application path: #{deploy[:deploy_to]}"); node['directories'].each |path| # path need new_path = "#{deploy[:deploy_to]}/current/"+path chef::log.info("checking directory: "+new_path); # ensure dir exists unless file.exists?(new_path) chef::log.info("creating directory: "+new_path); dir.mkdir( new_path, 777 ) end # ensure writable file.chmod( 777, new_path ) end end
the content chef::log
appear in log, there no errors, directories not there - created in previous release/timestamp
directory, if 'current' symlink has reverted duration of recipe. created permissions '411'.
can explain i'm going wrong here? can access new directory path instead of using 'current' symlink?
what happening you're applying these 2 specified recipes @ different stages of deployment. since you're using current - @ 1 stage old directory, while checking out next part of application.
what should maybe doing instead :
- use "#{release_path}" variable in recipes generate build specific files/events in app.
- use deploy/before_restart.rb file execute symlinks provide files @ predictable location
if provide screenshot of recipes being called , on layer layer edit view, people here see happening , give better feedback.
Comments
Post a Comment