0

I really need help on capifony.

It follow each post on stack overflow but nothing works for me.

I try to deploy a symfony 2.3 app and I'v got this error:

Fatal error: require(): Failed opening required '../20140821061908/app/../vendor/autoload.php' (include_path=
'.:/usr/share/pear:/usr/share/php') in ../releases/20140821061908/
app/autoload.php on line 5

Below is my deploy.rb:

set :application, "*****"
set :domain,      "*****"
set :deploy_to,   "*****"
set :app_path,    "app"
set :web_path,    "web"

#set :repository,  "****"
set :repository,   "******"
set :user,        "*****"
set :password,    "******"



set :scm,         :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `subversion`, `mercurial`, `perforce`, or `none`

set :model_manager, "doctrine"
# Or: `propel`

role :web,        domain                         # Your HTTP server, Apache/etc
role :app,        domain, :primary => true       # This may be the same as your `Web` server

# General config stuff
set :keep_releases,  5
set :shared_files,      ["app/config/parameters.yml", "app/config/parameters_dev.yml", "app/config/parameters.yml"] # This stops us from having to recreate the parameters file on every deploy.
set :shared_children,   [app_path + "/logs", web_path + "/uploads"]
set :use_composer, true
set :update_vendors, true

set :branch, `git tag`.split("\n").last


set :deploy_via, :copy
#set :deploy_via, :rsync_with_remote_cache
set :update_vendors, true
set :vendors_mode, "install"

set :composer_options, "--no-dev --verbose --prefer-dist --optimize-autoloader --no-progress"


# User details for the production server
set :user, "*****"
set :use_sudo, false
ssh_options[:forward_agent] = true
ssh_options[:keys] = %w(*********)


# Run migrations before warming the cache
#before "php app/console cache:clear"
task :upload_parameters do
  origin_file = "app/config/parameters.yml"
  destination_file = latest_release + "/app/config/parameters.yml" # Notice the
  latest_release

  try_sudo "mkdir -p #{File.dirname(destination_file)}"
  top.upload(origin_file, destination_file)
end



before "deploy:share_childs", "upload_parameters","symfony:cache:warmup", "symfony:doctrine:migrations:migrate"



after "deploy" do
    run "cd ******** && php app/console cache:clear --env=prod && php app/console assetic:dump --env=prod"
end

# Be more verbose by uncommenting the following line
logger.level = Logger::MAX_LEVEL

This is my log:

DL is

deprecated, please use Fiddle
  * 2014-08-21 12:32:33 executing `deploy'
  * 2014-08-21 12:32:33 executing `deploy:update'
 ** transaction: start
  * 2014-08-21 12:32:33 executing `deploy:update_code'
    triggering before callbacks for `deploy:update_code'
--> Updating code base with copy strategy
    executing locally: "git ls-remote https://github.com/********** HEA
D"
Username for 'https://github.com': 
Password for '******'
    command finished in 108591ms
  * getting (via checkout) revision 1fae0d14fc741d4a0c5d948f7161a1e05649a58e to
C:/Users/user/AppData/Local/Temp/20140821083421
    executing locally: git clone -q https://github.com/reynermedia/symfony C:/Us
ers/user/AppData/Local/Temp/20140821083421 && cd C:/Users/user/AppData/Local/Tem
p/20140821083421 && git checkout -q -b deploy 1fae0d14fc741d4a0c5d948f7161a1e056
49a58e
Username for 'https://github.com':
Password for '****':
    command finished in 276697ms
  * Compressing C:/Users/user/AppData/Local/Temp/20140821083421 to C:/Users/user
/AppData/Local/Temp/20140821083421.tar.gz
    executing locally: tar czf 20140821083421.tar.gz 20140821083421
    command finished in 16760ms
    servers: ["54.244.228.172"]
 ** sftp upload C:/Users/user/AppData/Local/Temp/20140821083421.tar.gz -> /tmp/2
0140821083421.tar.gz
    [54.244.228.172] /tmp/20140821083421.tar.gz
    [54.244.228.172] done
  * sftp upload complete
  * executing "cd ********/releases && tar xzf /tmp/20140821083421.tar.g
z && rm /tmp/20140821083421.tar.gz"
    servers: ["54.244.228.172"]
    [54.244.228.172] executing command
    command finished in 2800ms
  * 2014-08-21 12:53:57 executing `deploy:finalize_update'
  * executing "chmod -R g+w ********/releases/20140821083421"
    servers: ["54.244.228.172"]
    [54.244.228.172] executing command
    command finished in 872ms
--> Creating cache directory
  * executing "sh -c 'if [ -d *****/releases/20140821083421/app/cache
 ] ; then rm -rf *******/releases/20140821083421/app/cache; fi'"
    servers: ["54.244.228.172"]
    [54.244.228.172] executing command
    command finished in 778ms
  * executing "sh -c 'mkdir -p *********/releases/20140821083421/app/cach
e && chmod -R 0777 ***********/releases/20140821083421/app/cache'"
    servers: ["54.244.228.172"]
    [54.244.228.172] executing command
    command finished in 808ms
  * executing "chmod -R g+w *********/releases/20140821083421/app/cache"
    servers: ["54.244.228.172"]
    [54.244.228.172] executing command
    command finished in 805ms
  * 2014-08-21 12:54:00 executing `deploy:share_childs'
    triggering before callbacks for `deploy:share_childs'
  * 2014-08-21 12:54:00 executing `upload_parameters'
  * executing "mkdir -p ************/releases/20140821083421/app/config"
    servers: ["54.244.228.172"]
    [54.244.228.172] executing command
    command finished in 773ms
    servers: ["54.244.228.172"]
 ** sftp upload app/config/parameters.yml -> **********/releases/201408210
83421/app/config/parameters.yml
    [54.244.228.172] *********/releases/20140821083421/app/config/paramet
ers.yml
    [54.244.228.172] done
  * sftp upload complete
  * 2014-08-21 12:54:02 executing `symfony:cache:warmup'
--> Warming up cache
  * executing "sh -c 'cd ***********/releases/20140821083421 && php app/con
sole cache:warmup --env=prod --no-debug'"
    servers: ["54.244.228.172"]
    [54.244.228.172] executing command
*** [err :: 54.244.228.172] PHP Warning:  Module 'apc' already loaded in Unknown
 on line 0
*** [err :: 54.244.228.172] PHP Warning:  require(***********/releases/2014
0821083421/app/../vendor/autoload.php): failed to open stream: No such file or d
irectory in ***********/releases/20140821083421/app/autoload.php on line 5
 ** [out :: 54.244.228.172]
 ** [out :: 54.244.228.172] Warning: require(***********/releases/201408210
83421/app/../vendor/autoload.php): failed to open stream: No such file or direct
ory in /var/www/library/releases/20140821083421/app/autoload.php on line 5
*** [err :: 54.244.228.172] PHP Fatal error:  require(): Failed opening required
 '/var/www/library/releases/20140821083421/app/../vendor/autoload.php' (include_
path='.:/usr/share/pear:/usr/share/php') in **********/releases/2014082108
3421/app/autoload.php on line 5
 ** [out :: 54.244.228.172]
 ** [out :: 54.244.228.172] Fatal error: require(): Failed opening required '**********/releases/20140821083421/app/../vendor/autoload.php' (include_path=
'.:/usr/share/pear:/usr/share/php') in ***********/releases/20140821083421/
app/autoload.php on line 5
    command finished in 903ms
*** [deploy:update_code] rolling back
  * executing "rm -rf ***********/releases/20140821083421; true"
    servers: ["54.244.228.172"]
    [54.244.228.172] executing command
    command finished in 919ms
failed: "sh -c 'sh -c '\\''cd **********/releases/20140821083421 && php ap
p/console cache:warmup --env=prod --no-debug'\\'''" on 54.244.228.172

Thanks to @rolerbi, the de deploy pass the error and seems to do everything well. But at the end it just rollback... Below are my logs

 ** [out :: 54.244.228.172] 11:55:59 [file+] **********/releases/201408220
72838/app/../web/js/compiled/min_signup.js
    command finished in 78664ms
  * 2014-08-22 11:55:42 executing `symfony:cache:warmup'
--> Warming up cache
  * executing "sh -c 'cd **********/releases/20140822072838 && php app/con
sole cache:warmup --env=prod --no-debug'"
    servers: ["54.244.228.172"]
    [54.244.228.172] executing command
*** [err :: 54.244.228.172] PHP Warning:  Module 'apc' already loaded in Unknown
 on line 0
 ** [out :: 54.244.228.172] Warming up the cache for the prod environment with d
ebug false
    command finished in 12389ms
  * executing "chmod -R g+w **********/releases/20140822072838/app/cache"
    servers: ["54.244.228.172"]
    [54.244.228.172] executing command
    command finished in 843ms
    triggering after callbacks for `symfony:cache:warmup'
  * 2014-08-22 11:55:55 executing `symfony:doctrine:migrations:migrate'
    triggering before callbacks for `symfony:doctrine:migrations:migrate'
  * executing "sh -c 'cd **********/releases/20140822072838 && php app/con
sole --no-ansi doctrine:migrations:status --env=prod --no-debug'"
    servers: ["54.244.228.172"]
    [54.244.228.172] executing command
    command finished in 1391ms
*** [deploy:update_code] rolling back
  * executing "rm -rf **********/releases/20140822072838; true"
    servers: ["54.244.228.172"]
    [54.244.228.172] executing command
    command finished in 2183ms
failed: "sh -c 'sh -c '\\''cd **********/releases/20140822072838 && php ap
p/console --no-ansi doctrine:migrations:status --env=prod --no-debug'\\'''" on ****************
7
  • Is it the first deploy you make on this server ? Commented Aug 21, 2014 at 7:37
  • Can you give us the full stack of logs before the error occurred ? logger.level = Logger::TRACE Commented Aug 21, 2014 at 8:26
  • @alterPHP: it's the first deploy, but the application is already on the server. It try to improve my deployement process. Commented Aug 21, 2014 at 8:35
  • @rolebi: I'll update my post as soon as I have the logs with the new log level Commented Aug 21, 2014 at 8:36
  • Did you play deploy:setup command first ? Commented Aug 21, 2014 at 8:46

2 Answers 2

2
before "deploy:share_childs", "upload_parameters","symfony:cache:warmup", "symfony:doctrine:migrations:migrate"

This line force to warmup cache before vendors are installed. Replace it with :

before "deploy:share_childs",  "upload_parameters"
after  "symfony:cache:warmup", "symfony:doctrine:migrations:migrate"

In place of

after "deploy" do
    run "cd ******** && php app/console cache:clear --env=prod && php app/console     assetic:dump --env=prod"
end

use

set :assets_install,      true
set :dump_assetic_assets, true
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks a lot. It's really better. But I have another problem, everything goes well through the end and just... rollback. I've updated my post with the new messages
@Salestrip regarding the doctrine:migration:migrate error: is your database setup on the targeted server ? Does the doctrine:migration:migrate was here on purpose or just from a copy/paste ?
I removed doctrine:migration:migrate and it works! at last! Thank hyou very much!
-1

I was stuck on this for a while, I'm not sure if it's exactly the same issue. When I deployed vi Capifony, the bootstrap.php.cache file was pointing to my FormBundle.php file, but in a previous release folder tha no longer existed. I took a look at the code in vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php and the path it uses is realpath(DIR.'/../../../../../../../../app') - hardcoded path, wtf? The problem with this is that my vendor folder is outside of mySymfony setup in a shared folder, so that realpath points to nothing useful.

It does however checking for an server variable ($_SERVER('argv')) a bit further up in the code, so I just set that in the vhosts adding this to the file: SetEnv argv /var/www/njc-forms/current

Hope that helps someone out there.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.