bflad / chef-stash

Chef Cookbook for Atlassian Stash
Other
37 stars 42 forks source link

Run start-bitbucket.sh with the full path in Bitbucket init script #158

Closed atikhono closed 8 years ago

atikhono commented 8 years ago

After merging #157 I've converged a new bitbucket instance, and it seems that patch isn't enough to bring the code search up.

When I start Bitbucket manually, I get 'cannot stat' error and elasticsearch fails as log4j isn't configured properly (elasticsearch/config-template/ contains logging configuration). The result is the same -- 'Search is unavailable'.

/etc/init.d/bitbucket start
-------------------------------------------------------------------------------
Starting Atlassian Bitbucket and bundled Elasticsearch
To start Atlassian Bitbucket on its own, run start-webapp.sh instead
-------------------------------------------------------------------------------
Starting Elasticsearch bundled with Atlassian Bitbucket
BITBUCKET_HOME set to /var/atlassian/application-data/bitbucket
Starting Elasticsearch bundled with Atlassian Bitbucket as dedicated user stash 

cp: cannot stat `./../elasticsearch/config-template/*': No such file or directory

Elasticsearch bundled with Atlassian Bitbucket started successfully

The culprit is this line (in start-search.sh): $sucmd -l $BITBUCKET_USER -c "mkdir -p \"$ES_CONFIG_PATH\" && cp -r \"$PRGDIR/../elasticsearch/config-template/\"* \"$ES_CONFIG_PATH\""

It copies logging configuration to where elasticsearch is set to look for it.

start-search.sh is called by start-bitbucket.sh, and start-bitbucket.sh is called by the init script:

start() {
    ./start-bitbucket.sh
}

So PRGDIR is ./. It looks like a bug in start-search.sh. We can workaround by running $BASE/bin/start-bitbucket.sh instead of ./start-bitbucket.sh in the init script. Worked for me.

atikhono commented 8 years ago

@linc01n please have a look

linc01n commented 8 years ago

I can start bitbucket and search with d779f76 of the cookbook on an upgrade of existing instance. Let me try fresh one.

atikhono commented 8 years ago

@linc01n have you got a fresh instance working without this patch?

linc01n commented 8 years ago

@atikhono I tried a fresh install and reproduce this bug. It is about the copying of the elasticsearch config files. Merged. Thanks