I Want a script to statup stash on linux ubuntu/debian.
This is a self question. I know a possible answer, but I can't comment on the Stash Documentation (I think is disabled). I made this question to share my script and get feedback from others.
Create a startup script on /etc/init.d/stash with the contents:
#!/bin/bash # RUN_AS: The user to run fisheye as. Its recommended that you create a separate user account for security reasons RUN_AS=stash # STASH_INSTALLATION: The path to the Stash installation. Its recommended to create a symbolic link to the latest version so # the process will still work after upgrades. STASH_INSTALLATION="/opt/atlassian/stash" STASH_HOME="/var/atlassian/application-data/stash" stashctl() { if [ "x$USER" != "x$RUN_AS" ]; then su - "$RUN_AS" -c "export STASH_HOME=$STASH_HOME;$STASH_INSTALLATION/bin/$1" else "export STASH_HOME=$STASH_HOME;$STASH_INSTALLATION/bin/$1" fi } case "$1" in start) stashctl start-stash.sh ;; stop) stashctl stop-stash.sh ;; restart) stashctl stop-stash.sh sleep 10 stashctl start-stash.sh ;; *) echo "Usage: $0 {start|stop|restart}" esac exit 0
This script is based on a Fisheye startup script. I recommend create a stash user, set the permissions to that user, and create a symlink to easy upgrades:
adduser stash cd /opt/atlassian ln -s atlassian-stash-1.0.0 stash chown stash.stash -R /opt/atlassian/stash chown stash.stash /var/atlassian/application-data/stash/
To startup on the system boot:
update-rc.d stash defaults
In my opinion its better to give the stash user only on the logs, temp, work folder the rights.
cd /opt/atlassian/stash sudo chown -R stash:root logs temp work
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
FYI, I've submitted a documentation request here: https://jira.atlassian.com/browse/STASH-2731
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Documentation is here:
https://confluence.atlassian.com/display/STASH/Running+Stash+as+a+Linux+service
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Other alternative is to use something like daemontools. The benefit of this over the init script above is it will monitor the process and ensure it restarts if errors occur. Plus you can set it up to have much nicer environment variable handling etc..
It is more involved initially creating correct run scripts etc.. but I find superior to the init scripts
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I agree with you Colin Goudie.
I you try to do this with init scripts. If you have some script ready and want share, I will be grateful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, by all means, I'd love to see a daemontools tutorial for stash !
In the meantime, thanks Giovanni for this very usefull startup script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just released my deb-package to outside. It maybe usefull for installing Stash on Ubuntu:
https://bitbucket.org/lelik/atlassian-stash-deb
Feel free to test and post issues to tracker.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thx Melanie :)
And juste because I stumbled on that myself, when installing any atlassian product as a service on Debian flavored linuxes (Debian, Ubuntu), one can use the above script (I use it for Jira and Stash). It's not fully LSB compliant, but it works well.
One has to remember if said product uses a SSL connector (via catalina) to also copy the .keystore (after importing SSL certificate) to the "dedicated user account's homedir" (created for this script's usage) too.
Not stash specific, but as you opened a 'linux services' issue, might as well point that out.
Have a nice day
EDIT1 : cf this Running+JIRA+over+SSL+or+HTTPS
EDIT2 : following previous link, for the 'service user'
1 ) either generate the SSL cert and import it (.keystore) while logged under the service user's account, then in 'server.xml' specify its location with
<Connector port="443" maxHttpHeaderSize="8192" (...) SSLEnabled="true" (...) keystorePass="password" keystoreFile="/home/serviceuser/.keystore" />
Points "SSLEnabled", "KeystorePass", and "keystoreFile" are not documented in the referenced article's body, but are all compulsory. Omitting 'keystoreFile' won't result in any error in the 'catalina.log' file, the '.keystore' is found, but... it won't be loaded properly by tomcat.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.