* [gentoo-java] Packaging scm-manager
@ 2013-08-08 23:48 Taahir Ahmed
2013-08-09 0:58 ` assabajanischer_hinterwaeldler
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Taahir Ahmed @ 2013-08-08 23:48 UTC (permalink / raw
To: gentoo-java
[-- Attachment #1: Type: text/plain, Size: 709 bytes --]
Hi all,
I'm interested in packaging scm-manager [http://www.scm-manager.org/]. It's a
very nice java servlet that handles hosting git, mercurial, bazaar, and
subversion repositories.
I'm starting by writing an init script for my existing install (attached).
I've got it mostly working, I think, but I am wondering if there's a gentoo-
approved way of setting a proper value for JAVA_HOME in the init script.
There is a file (/etc/profile.d/java-config-2.sh) that sets a value for
several java-related environment variables. Is it good practice to source
this file from an init script? Right now I'm just using a sub-shell call to
java-config to detect the active system vm.
Thanks,
Taahir Ahmed
[-- Attachment #2: scm-manager --]
[-- Type: text/plain, Size: 2900 bytes --]
#!/sbin/runscript
# Taahir Ahmed
# OpenRC init script for scm-manager. It's installed in scm-user's home
# directory, and we drop root priveleges before we invoke it. It's a java
# webapp, so my trust in it isn't particularly high.
depend() {
# Doesn't make sense to run without network access. At the very least, we
# need a loopback.
need net
# I'm pretty sure it can talk to syslog.
use logger
}
JAVA_HOME=$(java-config --jre-home)
BASEDIR=/home/scm-user/scm-server
REPO="$BASEDIR"/lib
CLASSPATH=${CLASSPATH}:"$BASEDIR"/conf
CLASSPATH=${CLASSPATH}:"$REPO"/scm-server-1.32.jar
CLASSPATH=${CLASSPATH}:"$REPO"/commons-daemon-1.0.10.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-server-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/javax.servlet-2.5.0.v201103041518.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-continuation-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-http-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-io-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-webapp-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-xml-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-servlet-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-security-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-jmx-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-util-7.6.11.v20130520.jar
CLASSPATH=${CLASSPATH}:"$REPO"/jetty-ajp-7.6.11.v20130520.jar
start() {
# if [ "${RC_CMD}" = "restart" ];
# then
# # I don't think a restart requires anything special
# fi
ebegin "Starting scm-manager"
# Launch the daemon using jsvc (from the dev-java/commons-daemon package).
/usr/bin/jsvc \
-java-home $JAVA_HOME \
-cp "$CLASSPATH" \
-Djava.awt.headless=true \
-Dlogback.configurationFile=logging.xml \
-user scm-user \
-outfile "$BASEDIR/var/log/scm-server.out" \
-errfile "$BASEDIR/var/log/scm-server.err" \
-pidfile "$BASEDIR/var/scm-server.pid" \
-Dapp.name="scm-server" \
-Dapp.repo="$REPO" \
-Dbasedir="$BASEDIR" \
sonia.scm.server.ScmServerDaemon
eend $?
}
stop() {
ebegin "Stopping scm-manager"
# Stop using jsvc and the pidfile created during "start".
/usr/bin/jsvc \
-verbose \
-stop \
-java-home $JAVA_HOME \
-cp "$CLASSPATH" \
-user scm-user \
-outfile "$BASEDIR/var/log/scm-server.out" \
-errfile "$BASEDIR/var/log/scm-server.err" \
-pidfile "$BASEDIR/var/scm-server.pid" \
-Dapp.name="scm-server" \
-Dapp.repo="$REPO" \
-Dbasedir="$BASEDIR" \
-Djava.awt.headless=true \
-Dlogback.configurationFile=logging.xml \
sonia.scm.server.ScmServerDaemon
eend $?
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-java] Packaging scm-manager
2013-08-08 23:48 [gentoo-java] Packaging scm-manager Taahir Ahmed
@ 2013-08-09 0:58 ` assabajanischer_hinterwaeldler
2013-08-09 7:04 ` James Le Cuirot
2013-08-12 5:22 ` Taahir Ahmed
2 siblings, 0 replies; 4+ messages in thread
From: assabajanischer_hinterwaeldler @ 2013-08-09 0:58 UTC (permalink / raw
To: gentoo-java
Hi Taahir,
iirc init scripts should read the given values from /etc/conf.d folder,
but it's definitly possible to access parts of the real filesystem. you
only have to take care to not exceed the root filesystem (at least it
lead to some failure in an init script i've written).
i'm not sure if this is the best idea, but placing a copy of the
JAVA_HOME value should work quiet well. to achieve this i see two ways:
1) setting the value within the depend part
2) append the update to the shutdown of this script
as i'm not sure when the depend is called this may lead to some errors,
if the things change. in both cases you have to take care, that the
necessary config values have be never written at all (hope there is a
feasible value). imo this should be a much cleaner way.
> BASEDIR=/home/scm-user/scm-server
> REPO="$BASEDIR"/lib
should definitely be placed within the config part to allow changes to it
without the need to modify the init script.
greets
martin
On Thu, Aug 08, 2013 at 06:48:24PM -0500, Taahir Ahmed wrote:
> I'm starting by writing an init script for my existing install (attached).
> I've got it mostly working, I think, but I am wondering if there's a gentoo-
> approved way of setting a proper value for JAVA_HOME in the init script.
>
> There is a file (/etc/profile.d/java-config-2.sh) that sets a value for
> several java-related environment variables. Is it good practice to source
> this file from an init script? Right now I'm just using a sub-shell call to
> java-config to detect the active system vm.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-java] Packaging scm-manager
2013-08-08 23:48 [gentoo-java] Packaging scm-manager Taahir Ahmed
2013-08-09 0:58 ` assabajanischer_hinterwaeldler
@ 2013-08-09 7:04 ` James Le Cuirot
2013-08-12 5:22 ` Taahir Ahmed
2 siblings, 0 replies; 4+ messages in thread
From: James Le Cuirot @ 2013-08-09 7:04 UTC (permalink / raw
To: gentoo-java; +Cc: ahmedtd
On Thu, 08 Aug 2013 18:48:24 -0500
Taahir Ahmed <ahmedtd@tamu.edu> wrote:
> I'm starting by writing an init script for my existing install
> (attached). I've got it mostly working, I think, but I am wondering
> if there's a gentoo- approved way of setting a proper value for
> JAVA_HOME in the init script. Right now I'm just using a
> sub-shell call to java-config to detect the active system vm.
That's what the Tomcat init script does and I don't think there's
anything wrong with that. It does effectively the same thing as
sourcing /etc/profile.d/java-config-2.sh would do but I don't think
there's any point in doing that because you will always want the system
VM in this case. Simple use /etc/java-config-2/current-system-vm as
your JAVA_HOME and you will get the same result. This location is a
symlinked directory.
I was going to suggest that you install a launcher wrapper in the
ebuild using java-pkg_dolauncher but this doesn't allow you to start
the process with jsvc because the wrapper is hardcoded to use "java". I
remember running into this issue before but decided not to use jsvc in
the end anyway.
Regards,
James
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [gentoo-java] Packaging scm-manager
2013-08-08 23:48 [gentoo-java] Packaging scm-manager Taahir Ahmed
2013-08-09 0:58 ` assabajanischer_hinterwaeldler
2013-08-09 7:04 ` James Le Cuirot
@ 2013-08-12 5:22 ` Taahir Ahmed
2 siblings, 0 replies; 4+ messages in thread
From: Taahir Ahmed @ 2013-08-12 5:22 UTC (permalink / raw
To: gentoo-java
On Thursday, August 08, 2013 18:48:24 PM Taahir Ahmed wrote:
> Hi all,
>
> I'm interested in packaging scm-manager [http://www.scm-manager.org/]. It's
a
> very nice java servlet that handles hosting git, mercurial, bazaar, and
> subversion repositories.
>
> I'm starting by writing an init script for my existing install (attached).
> I've got it mostly working, I think, but I am wondering if there's a gentoo-
> approved way of setting a proper value for JAVA_HOME in the init script.
>
> There is a file (/etc/profile.d/java-config-2.sh) that sets a value for
> several java-related environment variables. Is it good practice to source
> this file from an init script? Right now I'm just using a sub-shell call to
> java-config to detect the active system vm.
>
> Thanks,
>
> Taahir Ahmed
One other thing: scm-manager uses maven. Is there a maven eclass in the
works, or do I need to run it manually from src_configure/src_compile?
Thanks,
Taahir Ahmed
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-08-12 5:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-08 23:48 [gentoo-java] Packaging scm-manager Taahir Ahmed
2013-08-09 0:58 ` assabajanischer_hinterwaeldler
2013-08-09 7:04 ` James Le Cuirot
2013-08-12 5:22 ` Taahir Ahmed
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox