在Ubuntu上启动FishEye + Crucible

我在Atlassian问了这个问题,但是认为serverfault可能更合适,因为它比Atlassian问题更像是一个系统pipe理员问题:

我一直试图按照这个指南让FishEye + Crucible在启动时启动。 JIRA已经安装并运行,因为它在Ubuntu引导时是自己的用户(jira),但是我不能让Fisheye + Crucible(aka fecru)也这样做。

我遵循那里的指示(和页面的注释中的Ubuntu相关说明)并重新启动,JIRA像往常一样开始,但是fecru没有。 它是否与我设置为“jira”的RUN_ASvariables有关? 该命令是否会在启动时运行而不提示用户“jira”的密码? 我觉得它不会提示,因为程序JIRA开始正常启动,因为该用户…

使用:

Ubuntu 10.04 Lucid

Jira 5.0

坩埚+鱼眼2.7.11

我使用的初始化脚本的相关位:

case "$1" in start) sudo -u fisheye /path/to/fisheye/startf.sh stop) sudo -u fisheye /path/to/fisheye/stopf.sh ;; *) echo "Usage: $0 start|stop" >&2 exit 3 ;; esac 

startf.sh的内容:

 source /home/fisheye/.profile $FISHEYE_HOME/bin/start.sh 

stopf.sh:

 source /home/fisheye/.profile $FISHEYE_HOME/bin/stop.sh 

.profile的相关内容:

 export JAVA_HOME=/path/to/java/ export FISHEYE_OPTS="-Xms512m -Xmx4800m -XX:MaxPermSize=512m" export FISHEYE_HOME=/home/fisheye/fecru-xxx export FISHEYE_INST=/home/fisheye/inst-example 

当然,我可以在鱼眼提供的启动和停止脚本中添加源码.profile语句,但这意味着在升级之后再次编辑它。 我试图尽可能保持鱼眼文件不变。

我意识到这是一个古老的线程,但我无法find答案,所以这里是:

编辑fisheyectl.sh并更改nohup sh -c "exec $CMD" >> $FISHEYE_INST/var/log/fisheye.out 2>&1 &不使用nohup(因为upstart希望它在前台运行:

 #echo "Starting FishEye/Crucible... Output redirected to $FISHEYE_INST/var/log/fisheye.out" #nohup sh -c "exec $CMD" >> $FISHEYE_INST/var/log/fisheye.out 2>&1 & sh -c "exec $CMD" 

创build你的/etc/init/fisheye.conf文件(我命名为我的坩埚,但没关系):

 # Crucible Upstart # # Required-Start: # Required-Stop: description "Crucible Server" start on runlevel [2345] stop on runlevel [!2345] setuid crucible setgid crucible env FISHEYE_HOME="/home/crucible/crucible" env FISHEYE_INST="/home/crucible/crucible-datastore" # Give up if restart occurs 10 times in 30 seconds. respawn limit 10 30 # keep it running in foreground to let upstart manage it exec ~crucible/crucible/bin/start.sh respawn 

请注意,您可能需要根据您运行的用户来更改setuid和setgid。 您可能还需要更改path的env行。

随着这个问题再次出现,现在的答案已经过时,因为主要发行版切换到systemd,我将为JIRA添加我的systemd服务定义:

/etc/systemd/system/jira.service

 [Unit] Description=Atlassian JIRA After=syslog.target network.target [Service] Type=forking EnvironmentFile=/etc/sysconfig/jira ExecStart=/path/to/jira/bin/startup.sh ExecStop=/path/to/jira/bin/shutdown.sh PIDFile=/path/to/jira/work/catalina.pid SuccessExitStatus=143 User=jira Group=jira Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target 

的/ etc / SYSCONFIG / JIRA

 # Name of the user to run as USER=jira # Location of application's bin directory CATALINA_HOME=/path/to/jira # Location of Java JDK export JAVA_HOME=/usr/lib/jvm/java-8-oracle 

用您的应用程序目录replace/path/to/jira

对于其他Atlassian工具,它基本上是一样的,只是启动脚本和PID文件位置稍有不同:

  • 合stream

    • $appdir/bin/startup.sh
    • $appdir/bin/shutdown.sh
    • $appdir/work/catalina.pid
  • 鱼眼

    • $appdir/bin/start.sh
    • $appdir/bin/stop.sh
    • $appdir/bin/start-bamboo.sh
    • $appdir/bin/stop-bamboo.sh
  • 人群

    • $appdir/bin/startup.sh
    • $appdir/bin/shutdown.sh
    • $appdir/apache-tomcat/work/catalina.pid

FishEye 目前还不支持PID文件 ,所以目前有必要使用该问题的解决方法,并在nohop命令之后将此行添加到fisheyectl.sh

 echo $! > $FISHEYE_INST/var/fisheye.pid 

对于Bamboo,必须通过CATALINA_PIDvariables显式定义PID文件(请参阅$appdir/bin/catalina.sh )。 我还没有testing过,但应该可以在EnvironmentFile文件中设置这个variables。

在创build服务定义之后:

 # start JIRA sudo systemctl start jira # enable automatic start on boot sudo systemctl enable jira