jibazee@s17263607:~/public_html/wolfzeit.com/releases/20141005181639]$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Nothing to install or update
Generating autoload files
I did this. Then I did composer install again. That went ok.
The deploy still has the same error.
Yes. The local repository and bitbucket is in sync.
By the way, wpcli:db:push works. The local WordPress on MAMP looks fine in browser and even the half completed release on the server is reachable. Just the deploy doesn’t want…
In your local environment please delete your composer.lock file and re-run composer install. Then commit and push to your Git repo again and try another deployment.
The problem is the npm capistrano gem uses npm install --production by default which doesn’t install the devDependencies. Roots’ package.json has everything under devDependencies. See https://github.com/roots/roots/blob/master/package.json#L25 so nothing is actually being installed.
Add set :npm_flags, '--silent' to your config/deploy.rb and you’ll be good.
First step to debugging Capistrano is to always run the command it failed on manually (as the same user you deploy as).
So manually run cd /home/jibazee/public_html/wolfzeit.com/current/web/app/themes/wolfzeit && ( WP_ENV=staging /usr/bin/env npm install --silent ) and see what’s going on.
It’s usually not an actual Capistrano error but an error with a command its running.
Yes, I can SSH without being prompted. I SSH via SSH keys.
I tried at the server to clone the bitbucket repo in a new directory,
then I’m prompted. Is it clever to put the private keys on the server?
Is SSH forward agent being used in every standard capistrano deploy?
Sorry, that I bother you with these problems. I’m completely new to Capistrano and Roots. I could go my old way and deploy with SFTP but that’s so old fashioned…
I got further. The problem with npm was, that the owner of some gems on the server in ~/.npm was root. I changed all to my user and npm went ok. Then followed Bower && grunt, both went ok. Then npm comes again and wants to find a package.json in the root of the current release which doesn’t exist. Not locally neither on the server. Should there be one?
[420db568] Command: if test ! -d /home/jibazee/public_html/wolfzeit.com/releases/20141006180813; then echo "Directory does not exist '/home/jibazee/public_html/wolfzeit.com/releases/20141006180813'" 1>&2; false; fi
DEBUG[420db568] Finished in 0.090 seconds with exit status 0 (successful).
INFO[e7cff70a] Running /usr/bin/env npm install on wolfzeit.net
DEBUG[e7cff70a] Command: cd /home/jibazee/public_html/wolfzeit.com/releases/20141006180813 && ( WP_ENV=staging /usr/bin/env npm install )
DEBUG[e7cff70a] [37m[40mnpm[0m [0m[31m[40mERR![0m [0m[35m
DEBUG[e7cff70a] install[0m Couldn't read dependencies
DEBUG[e7cff70a] [0m
DEBUG[e7cff70a] [37m[40mnpm[0m [0m[31m[40mERR![0m [0m[35mpackage.json[0m ENOENT, open '/home/jibazee/public_html/wolfzeit.com/releases/20141006180813/package.json'
DEBUG[e7cff70a] [0m[37m[40mnpm[0m [0m[31m[40mERR![0m
DEBUG[e7cff70a] [0m[35mpackage.json[0m This is most likely not a problem with npm itself.
DEBUG[e7cff70a] [0m[37m[40mnpm[0m [0m[31m[40mERR![0m [0m[35mpackage.json[0m npm can't find a package.json file in your current directory.
At which step of installation/deploy is the package.json generated or must be added to the root of the Bedrock directory? What should it content? I read the documentation, but found nothing about it.
The npm Capistrano gem runs automatically on deploy:updated when you require it. You properly configured it by setting set :npm_target_path, fetch(:theme_path).
The problem is in your config/deploy.rb where you run execute 'npm', 'install' within the release_path. That’s the error you’re seeing because it obviously doesn’t exist there. Since you already have capistrano-grunt you don’t need that Grunt custom task at all.
Thank you so much. It works! (I had to correct two lines:)
set :theme_path, -> { "#{fetch(:release_path)}/web/app/themes/wolfzeit" }
to
set :theme_path, -> { "#{release_path}/web/app/themes/wolfzeit" }
and
set :grunt_tasks, 'deploy'
to
set :grunt_tasks, 'build'
Maybe this is not the correct way of using Grunt, but I’m new to Grunt and I have to learn.
“Das war eine schwere Geburt” is a german saying which means it wasn’t easy. It took me three weeks to setup Capistrano/Roots.
One last question. If you know, where the .env lyes in the shared folder, you can read the data from outside. If I restrict the rights wordpress doesn’t work at all. Is this a security hole or have I misconfigured something?
Thanks again cfx and skalkinshaw for your professional and kind help!
Gabriel from Berlin