Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Bitbucket 4.6 needs set-bitbucket-home.sh and set-bitbucket-user.sh #157

Merged
merged 1 commit into from
May 31, 2016

Conversation

atikhono
Copy link
Contributor

@atikhono atikhono commented May 30, 2016

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

@linc01n
Copy link
Collaborator

linc01n commented May 31, 2016

This is very similar to my commit 78037c1

@linc01n linc01n merged commit d779f76 into bflad:master May 31, 2016
@linc01n
Copy link
Collaborator

linc01n commented May 31, 2016

Going to release it tonight. I need to go to work now.

@atikhono
Copy link
Contributor Author

@linc01n Cool, thanks!

@atikhono
Copy link
Contributor Author

atikhono commented May 31, 2016

@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

@atikhono
Copy link
Contributor Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants