error when running rails-post-deploy

146 views
Skip to first unread message

Gabriela

unread,
Feb 5, 2012, 1:04:13 AM2/5/12
to alavet...@googlegroups.com
Hey!

I keep getting this error when trying to install alaveteli:

gaba@margarita ~/code/alaveteli (release/0.5 *) - $ ./script/rails-post-deploy
/home/gaba/code/alaveteli
commonlib/shlib/deployfns: line 50: /home/gaba/code/alaveteli/commonlib
/home/gaba/code/alaveteli/commonlib/bin/yaml2sh: No such file or directory
: shlib/deployfns read_conf: error loading config file config/general.yml

Anybody have any idea?

I'm using rvm with ruby 1.8.7 and rubygems 1.8.6

Gaba

Robin Houston

unread,
Feb 5, 2012, 2:58:05 AM2/5/12
to alavet...@googlegroups.com, alavet...@googlegroups.com
Sounds like the config file is missing. You can copy config/general.yml-example to config/general.yml and edit as necessary.

Robin

Sent from my telephone

Gabriela

unread,
Feb 5, 2012, 11:45:10 AM2/5/12
to alavet...@googlegroups.com
Yes but the config file is there config/general.yml.

Seb Bacon

unread,
Feb 5, 2012, 11:52:57 AM2/5/12
to alavet...@googlegroups.com
Did you do a "git submodule update"? (it's in the install
instructions, but easily missed -- I often forget it!)

seb

--
skype: seb.bacon
mobile: 07790 939224
land: 01531 671074

Robin Houston

unread,
Feb 5, 2012, 12:03:12 PM2/5/12
to alavet...@googlegroups.com
The rails-post-deploy script does a git submodule update --init, so I don’t think that’s the problem in this case.

Robin

Robin Houston

unread,
Feb 5, 2012, 12:11:54 PM2/5/12
to alavet...@googlegroups.com
Oh hang on! It totally doesn’t. How stupid of me. (In the mySociety environment the deployment system does a submodule update --init before running the rails-post-deploy script, and I got muddled up.)

So maybe that *is* the problem.

Robin

Gabriela

unread,
Feb 7, 2012, 11:22:14 PM2/7/12
to alavet...@googlegroups.com
I did the git submodule init and clone the repository again to start
over and I get the same problem. Now I changed to debug mode and this
is what I get. It seems that it's dying on line 51 and it's not
finding yaml2sh but the file is there. I'm using debian.

gaba@margarita ~/code/alaveteli (release/0.5 *) - $ ./script/rails-post-deploy

++ pwd
+ APP_DIR=/home/gaba/code/alaveteli
+ cd app/..
/home/gaba/code/alaveteli
+ '[' -e config/general ']'
+ '[' -e config/general.yml ']'
+ . commonlib/shlib/deployfns
+++ _mysociety_commonlib_directory
++++ dirname commonlib/shlib/deployfns
+++ cd commonlib/shlib/..
+++ pwd
++ MYSOCIETY_COMMONLIB_DIR='/home/gaba/code/alaveteli/commonlib
/home/gaba/code/alaveteli/commonlib'
+ read_conf config/general
++ mktemp /tmp/ms-deploy-configsource.XXXXXX
+ CONF_SOURCE=/tmp/ms-deploy-configsource.HRb3LR
+ case "$1" in
+ '[' -f config/general.yml ']'
+ '[' -e config/general ']'
+ '/home/gaba/code/alaveteli/commonlib
/home/gaba/code/alaveteli/commonlib/bin/yaml2sh' --prefix=OPTION_
config/general.yml
commonlib/shlib/deployfns: line 51: /home/gaba/code/alaveteli/commonlib


/home/gaba/code/alaveteli/commonlib/bin/yaml2sh: No such file or directory

+ die 'shlib/deployfns read_conf: error loading config file config/general.yml'
+ echo -e : 'shlib/deployfns read_conf: error loading config file
config/general.yml'


: shlib/deployfns read_conf: error loading config file config/general.yml

+ exit 1


gaba@margarita ~/code/alaveteli (release/0.5 *) - $


When I run the yaml2sh 'by hand' I get the configuration file

gaba@margarita ~/code/alaveteli (release/0.5 *) - $

./commonlib/bin/yaml2sh config/general.yml
ISO_COUNTRY_CODE='GB'
DOMAIN='127.0.0.1:3000'
INCOMING_EMAIL_DOMAIN='localhost'
ADMIN_PASSWORD='passwordx'
TRACK_SENDER_NAME='Alaveteli Webmaster'
INCOMING_EMAIL_SECRET='xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx'
READ_ONLY=''
TWITTER_USERNAME='whatdotheyknow'
AVAILABLE_LOCALES='en es'
DEFAULT_LOCALE='en'
STAGING_SITE='1'
ADMIN_PUBLIC_URL=''
GAZE_URL='http://gaze.mysociety.org'
MAX_REQUESTS_PER_USER_PER_DAY='6'
TRACK_SENDER_EMAIL='postmaster@localhost'
BLOG_FEED='http://www.mysociety.org/category/projects/whatdotheyknow/feed/'
INCOMING_EMAIL_PREFIX=''
FORWARD_NONBOUNCE_RESPONSES_TO='user-support@localhost'
CONTACT_NAME='Alaveteli Webmaster'
RECAPTCHA_PRIVATE_KEY='x'
USE_GHOSTSCRIPT_COMPRESSION='True'
COOKIE_STORE_SESSION_SECRET='your secret key here, make it long and random'
...

Seb Bacon

unread,
Feb 8, 2012, 4:37:39 AM2/8/12
to alavet...@googlegroups.com
Hi,

I'm no bash scripter, so I don't know the solution (Robin?), but the
proximate cause here is:

On 8 February 2012 04:22, Gabriela <gabe...@gmail.com> wrote:

> ++ MYSOCIETY_COMMONLIB_DIR='/home/gaba/code/alaveteli/commonlib
> /home/gaba/code/alaveteli/commonlib'

As in, that variable is being set as the same thing, twice. It should be

> ++ MYSOCIETY_COMMONLIB_DIR='/home/gaba/code/alaveteli/commonlib'

It's as if the `cd` call at
https://github.com/mysociety/commonlib/blob/master/shlib/deployfns#L22
was outputting the current working directory, as well as the `pwd`
that follows.

Sorry it's such a struggle!

Seb

Robin Houston

unread,
Feb 8, 2012, 4:46:52 AM2/8/12
to alavet...@googlegroups.com
If the cause is indeed the cd call outputting the path to the working directory (why would it do that?) then the solution would be to change line 22 of deployfns to read:

      cd "$(dirname "${BASH_SOURCE[0]}")"/.. > /dev/null

Does that make any difference, Gabriela?

And yes, sorry this has been a bit of a trek.

Robin

Gabriela

unread,
Feb 11, 2012, 6:02:30 PM2/11/12
to alavet...@googlegroups.com
Yes! That worked. Thanks. I don't know why is getting that path. I should check that out later. At first I want to make it work in my machine. I had other problems but I think it was my machine ruby  installation. I had to remove all rubies and rvm from the computer and start over. Now is running with ruby 1.8.7 without rvm. Yeah!

Robin Houston

unread,
Feb 12, 2012, 8:43:25 AM2/12/12
to alavet...@googlegroups.com
Ah, great! I‘m glad it worked. I’ve committed what I hope is a fix both to this problem and to another related problem that could arise under unusual circumstances:

Robin Houston

unread,
Feb 12, 2012, 10:07:27 AM2/12/12
to alavet...@googlegroups.com
Also, I would recommend that you don’t export CDPATH from your shell. I can’t think of any good reason to export it, and it’s likely to cause occasional problems with a lot of shell scripts because it changes the behaviour of the cd command in a way that most scripts are not designed to expect.

Robin

On Sat, Feb 11, 2012 at 11:02 PM, Gabriela <gabe...@gmail.com> wrote:

Robin Houston

unread,
Feb 12, 2012, 2:05:24 PM2/12/12
to alavet...@googlegroups.com
Actually I was so astonished by this extraordinary bug that I wrote a blog post about it: http://bosker.wordpress.com/2012/02/12/bash-scripters-beware-of-the-cdpath/

Robin
Reply all
Reply to author
Forward
0 new messages