Closed atikhono closed 8 years ago
This is very similar to my commit 78037c1b9bbcf03d9cfc11959e7cdba3da5e6fad
Going to release it tonight. I need to go to work now.
@linc01n Cool, thanks!
@linc01n I've converged a clean instance and it seems my patch isn't enough... 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'. I'm looking into this, will update asap.
/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 reason is in this line (start-search.sh):
$sucmd -l $BITBUCKET_USER -c "mkdir -p \"$ES_CONFIG_PATH\" && cp -r \"$PRGDIR/../elasticsearch/config-template/\"* \"$ES_CONFIG_PATH\""
start-search.sh is called from start-bitbucket.sh. start-bitbucket.sh is called by the init script:
start() {
./start-bitbucket.sh
}
So PRGDIR is ./. We can workaround by running $BASE/bin/start-bitbucket.sh instead of ./start-bitbucket.sh in the init script.
The setup scripts in $BITBUCKET_HOME/bin were refactored and now they call set-bitbucket-home.sh to set BITBUCKET_HOME and set-bitbucket-user.sh to set BITBUCKET_USER instead of user.sh.
Without this patch, a Bitbucket instance starts up under root. A bundled Elasticsearch instance can't run as root and fails to start. That's the reason code search doesn't work. You get behaviour like described here: https://jira.atlassian.com/browse/BSERV-8763 (Search is currently unavailable)
We need to have $BITBUCKET_HOME/bin/set-bitbucket-home.sh and $BITBUCKET_HOME/bin/set-bitbucket-user.sh instead of $BITBUCKET_HOME/bin/user.sh for Bitbucket 4.6.0 and higher.
I tested the change with Bitbucket 4.6.2.
Fixes #156
@linc01n @bflad Please have a look