Discussion:
ARCHIVA_BASE doesn't work with version 2.0.1
Joseph Wilkicki
2014-06-23 22:28:26 UTC
Permalink
Hi!

I'm trying to install Archiva 2.0.1 standalone on RHEL6 using the
instructions here:
http://archiva.apache.org/docs/2.0.1/adminguide/standalone.html

I'm trying to separate the base install from the configuration, as
indicated in the instructions. I've put the distribution into
/opt/apache-archiva-2.0.1 and symlinked it to /opt/archiva. I symlinked
/opt/archiva/bin/archiva to /etc/init.d/archiva and run chkconfig add and
chkconfig on. I've put in /etc/profile.d/archiva.sh: export
ARCHIVA_BASE=/var/archiva and made sure the variable is set in my shell.
I've created the directories indicated in the instructions. I've made
sure there is an archiva user and changed the startup script RUN_AS_USER to
archiva.

The startup script won't start the app. I made sure
/var/subsys/local/archiva exists and is writable by that user. I've
changed /opt/archiva/conf/wrapper.conf set.default.ARCHIVA_BASE=/var/archiva


As far as I can tell, the documentation is just wrong about ARCHIVA_BASE
but I don't see any other way of doing this. I've tried searching the
mailing list as well and I can't seem to find anything relevant to 2.0.1.
Can anyone help here?

I also tried just installing 2.0.1 with the Puppet rules, but apparently
it just can't setup Archiva 2.0.1. It runs but the DefaultUserService has
a combination of errors doing basic things like getting the admin user
created or setting up Redback for LDAP, so I'm falling back to manual
instructions.

Output from the archiva startup script is here:

+ APP_NAME=archiva
+ APP_LONG_NAME='Apache Archiva'
++ dirname /etc/init.d/archiva
+ BASEDIR=/etc/init.d/..
++ cd /etc/init.d/..
++ pwd
+ BASEDIR=/etc
+ ls -l /etc/init.d/archiva
+ grep -e '->'
+ '[' 0 = 0 ']'
++ pwd
+ _PWD=/opt
++ dirname /etc/init.d/archiva
+ _EXEDIR=/etc/init.d
+ cd /etc/init.d
++ basename /etc/init.d/archiva
+ _BASENAME=archiva
++ ls -l archiva
++ sed 's/.*->\ //g'
+ _REALFILE=/opt/archiva/bin/archiva
++ dirname /opt/archiva/bin/archiva
+ BASEDIR=/opt/archiva/bin/..
++ cd /opt/archiva/bin/..
++ pwd
+ BASEDIR=/opt/archiva
+ cd /opt
+ WRAPPER_CMD=./wrapper
+ WRAPPER_CONF=/opt/archiva/conf/wrapper.conf
+ PRIORITY=
+ PIDDIR=/opt/archiva/logs
+ RUN_AS_USER=archiva
+ case $0 in
+ SCRIPT=/etc/init.d/archiva
+ CHANGED=true
+ '[' Xtrue '!=' X ']'
++ echo /etc/init.d/archiva
++ sed -e 's; ;:;g'
+ SAFESCRIPT=/etc/init.d/archiva
++ echo /etc/init.d/archiva
++ sed -e 's;/; ;g'
+ TOKENS=' etc init.d archiva'
+ REALPATH=
+ for C in '$TOKENS'
++ echo etc
++ sed -e 's;:; ;g'
+ C=etc
+ REALPATH=/etc
+ '[' -h /etc ']'
+ for C in '$TOKENS'
++ echo init.d
++ sed -e 's;:; ;g'
+ C=init.d
+ REALPATH=/etc/init.d
+ '[' -h /etc/init.d ']'
++ ls -ld /etc/init.d
+ LS='lrwxrwxrwx 1 root root 11 Apr 24 2001 /etc/init.d -> rc.d/init.d'
++ expr 'lrwxrwxrwx 1 root root 11 Apr 24 2001 /etc/init.d -> rc.d/init.d'
: '.*-> \(.*\)$'
+ LINK=rc.d/init.d
+ expr rc.d/init.d : '/.*'
++ dirname /etc/init.d
+ REALPATH=/etc/rc.d/init.d
+ '[' -h /etc/rc.d/init.d ']'
+ for C in '$TOKENS'
++ echo archiva
++ sed -e 's;:; ;g'
+ C=archiva
+ REALPATH=/etc/rc.d/init.d/archiva
+ '[' -h /etc/rc.d/init.d/archiva ']'
++ ls -ld /etc/rc.d/init.d/archiva
+ LS='lrwxrwxrwx 1 root root 24 Jun 23 17:43 /etc/rc.d/init.d/archiva ->
/opt/archiva/bin/archiva'
++ expr 'lrwxrwxrwx 1 root root 24 Jun 23 17:43 /etc/rc.d/init.d/archiva ->
/opt/archiva/bin/archiva' : '.*-> \(.*\)$'
+ LINK=/opt/archiva/bin/archiva
+ expr /opt/archiva/bin/archiva : '/.*'
+ REALPATH=/opt/archiva/bin/archiva
+ '[' -h /opt/archiva/bin/archiva ']'
+ '[' /opt/archiva/bin/archiva = /etc/init.d/archiva ']'
+ SCRIPT=/opt/archiva/bin/archiva
+ '[' Xtrue '!=' X ']'
++ echo /opt/archiva/bin/archiva
++ sed -e 's; ;:;g'
+ SAFESCRIPT=/opt/archiva/bin/archiva
++ echo /opt/archiva/bin/archiva
++ sed -e 's;/; ;g'
+ TOKENS=' opt archiva bin archiva'
+ REALPATH=
+ for C in '$TOKENS'
++ echo opt
++ sed -e 's;:; ;g'
+ C=opt
+ REALPATH=/opt
+ '[' -h /opt ']'
+ for C in '$TOKENS'
++ echo archiva
++ sed -e 's;:; ;g'
+ C=archiva
+ REALPATH=/opt/archiva
+ '[' -h /opt/archiva ']'
++ ls -ld /opt/archiva
+ LS='lrwxrwxrwx 1 root root 20 Jun 23 17:43 /opt/archiva ->
apache-archiva-2.0.1'
++ expr 'lrwxrwxrwx 1 root root 20 Jun 23 17:43 /opt/archiva ->
apache-archiva-2.0.1' : '.*-> \(.*\)$'
+ LINK=apache-archiva-2.0.1
+ expr apache-archiva-2.0.1 : '/.*'
++ dirname /opt/archiva
+ REALPATH=/opt/apache-archiva-2.0.1
+ '[' -h /opt/apache-archiva-2.0.1 ']'
+ for C in '$TOKENS'
++ echo bin
++ sed -e 's;:; ;g'
+ C=bin
+ REALPATH=/opt/apache-archiva-2.0.1/bin
+ '[' -h /opt/apache-archiva-2.0.1/bin ']'
+ for C in '$TOKENS'
++ echo archiva
++ sed -e 's;:; ;g'
+ C=archiva
+ REALPATH=/opt/apache-archiva-2.0.1/bin/archiva
+ '[' -h /opt/apache-archiva-2.0.1/bin/archiva ']'
+ '[' /opt/apache-archiva-2.0.1/bin/archiva = /opt/archiva/bin/archiva ']'
+ SCRIPT=/opt/apache-archiva-2.0.1/bin/archiva
+ '[' Xtrue '!=' X ']'
++ echo /opt/apache-archiva-2.0.1/bin/archiva
++ sed -e 's; ;:;g'
+ SAFESCRIPT=/opt/apache-archiva-2.0.1/bin/archiva
++ echo /opt/apache-archiva-2.0.1/bin/archiva
++ sed -e 's;/; ;g'
+ TOKENS=' opt apache-archiva-2.0.1 bin archiva'
+ REALPATH=
+ for C in '$TOKENS'
++ echo opt
++ sed -e 's;:; ;g'
+ C=opt
+ REALPATH=/opt
+ '[' -h /opt ']'
+ for C in '$TOKENS'
++ echo apache-archiva-2.0.1
++ sed -e 's;:; ;g'
+ C=apache-archiva-2.0.1
+ REALPATH=/opt/apache-archiva-2.0.1
+ '[' -h /opt/apache-archiva-2.0.1 ']'
+ for C in '$TOKENS'
++ echo bin
++ sed -e 's;:; ;g'
+ C=bin
+ REALPATH=/opt/apache-archiva-2.0.1/bin
+ '[' -h /opt/apache-archiva-2.0.1/bin ']'
+ for C in '$TOKENS'
++ echo archiva
++ sed -e 's;:; ;g'
+ C=archiva
+ REALPATH=/opt/apache-archiva-2.0.1/bin/archiva
+ '[' -h /opt/apache-archiva-2.0.1/bin/archiva ']'
+ '[' /opt/apache-archiva-2.0.1/bin/archiva =
/opt/apache-archiva-2.0.1/bin/archiva ']'
+ CHANGED=
+ '[' X '!=' X ']'
++ dirname /opt/apache-archiva-2.0.1/bin/archiva
+ cd /opt/apache-archiva-2.0.1/bin
++ pwd
+ REALDIR=/opt/apache-archiva-2.0.1/bin
++ echo /opt/archiva/logs
++ cut -c1,1
+ FIRST_CHAR=/
+ '[' / '!=' / ']'
++ echo ./wrapper
++ cut -c1,1
+ FIRST_CHAR=.
+ '[' . '!=' / ']'
+ WRAPPER_CMD=/opt/apache-archiva-2.0.1/bin/./wrapper
++ echo /opt/archiva/conf/wrapper.conf
++ cut -c1,1
+ FIRST_CHAR=/
+ '[' / '!=' / ']'
+ ANCHORFILE=/opt/archiva/logs/archiva.anchor
+ PIDFILE=/opt/archiva/logs/archiva.pid
+ LOCKDIR=/var/lock/subsys
+ LOCKFILE=/var/lock/subsys/archiva
+ pid=
+ PSEXE=/usr/bin/ps
+ '[' '!' -x /usr/bin/ps ']'
+ PSEXE=/bin/ps
+ '[' '!' -x /bin/ps ']'
++ uname -s
++ tr '[:upper:]' '[:lower:]'
++ tr -d '[:blank:]'
+ DIST_OS=linux
+ case "$DIST_OS" in
++ uname -p
++ tr '[:upper:]' '[:lower:]'
++ tr -d '[:blank:]'
+ DIST_ARCH=x86_64
+ '[' x86_64 = unknown ']'
+ case "$DIST_ARCH" in
+ DIST_ARCH=x86
+ '[' linux = macosx ']'
+ WRAPPER_TEST_CMD=/opt/apache-archiva-2.0.1/bin/./wrapper-linux-x86-64
+ /opt/apache-archiva-2.0.1/bin/./wrapper-linux-x86-64 -v
+ '[' 0 = 0 ']'
+ WRAPPER_CMD=/opt/apache-archiva-2.0.1/bin/./wrapper-linux-x86-64
+ '[' X = X ']'
+ CMDNICE=
+ '[' X = X ']'
+ ANCHORPROP=
+ IGNOREPROP=
+ LOCKPROP=
+ '[' -d /var/lock/subsys ']'
+ '[' -w /var/lock/subsys ']'
+ LOCKPROP='wrapper.lockfile="/var/lock/subsys/archiva"'
+ case "$1" in
+ checkUser touchlock start
+ '[' Xarchiva '!=' X ']'
+ IDEXE=/usr/xpg4/bin/id
+ '[' '!' -x /usr/xpg4/bin/id ']'
+ IDEXE=/usr/bin/id
+ '[' '!' -x /usr/bin/id ']'
++ /usr/bin/id -u -n
+ '[' root = archiva ']'
+ '[' Xarchiva '!=' X ']'
+ '[' 'Xwrapper.lockfile="/var/lock/subsys/archiva"' '!=' X ']'
+ '[' Xtouchlock '!=' X ']'
++ groups archiva
++ awk '{print $3}'
++ tail -1
+ RUN_AS_GROUP=archiva
+ '[' Xarchiva = X ']'
+ touch /var/lock/subsys/archiva
+ chown archiva:archiva /var/lock/subsys/archiva
+ su -m archiva -c '"/opt/apache-archiva-2.0.1/bin/archiva" start'
+ APP_NAME=archiva
+ APP_LONG_NAME='Apache Archiva'
++ dirname /opt/apache-archiva-2.0.1/bin/archiva
+ BASEDIR=/opt/apache-archiva-2.0.1/bin/..
++ cd /opt/apache-archiva-2.0.1/bin/..
++ pwd
+ BASEDIR=/opt/apache-archiva-2.0.1
+ ls -l /opt/apache-archiva-2.0.1/bin/archiva
+ grep -e '->'
+ '[' 1 = 0 ']'
+ WRAPPER_CMD=./wrapper
+ WRAPPER_CONF=/opt/apache-archiva-2.0.1/conf/wrapper.conf
+ PRIORITY=
+ PIDDIR=/opt/apache-archiva-2.0.1/logs
+ RUN_AS_USER=archiva
+ case $0 in
+ SCRIPT=/opt/apache-archiva-2.0.1/bin/archiva
+ CHANGED=true
+ '[' Xtrue '!=' X ']'
++ echo /opt/apache-archiva-2.0.1/bin/archiva
++ sed -e 's; ;:;g'
+ SAFESCRIPT=/opt/apache-archiva-2.0.1/bin/archiva
++ echo /opt/apache-archiva-2.0.1/bin/archiva
++ sed -e 's;/; ;g'
+ TOKENS=' opt apache-archiva-2.0.1 bin archiva'
+ REALPATH=
+ for C in '$TOKENS'
++ echo opt
++ sed -e 's;:; ;g'
+ C=opt
+ REALPATH=/opt
+ '[' -h /opt ']'
+ for C in '$TOKENS'
++ echo apache-archiva-2.0.1
++ sed -e 's;:; ;g'
+ C=apache-archiva-2.0.1
+ REALPATH=/opt/apache-archiva-2.0.1
+ '[' -h /opt/apache-archiva-2.0.1 ']'
+ for C in '$TOKENS'
++ echo bin
++ sed -e 's;:; ;g'
+ C=bin
+ REALPATH=/opt/apache-archiva-2.0.1/bin
+ '[' -h /opt/apache-archiva-2.0.1/bin ']'
+ for C in '$TOKENS'
++ echo archiva
++ sed -e 's;:; ;g'
+ C=archiva
+ REALPATH=/opt/apache-archiva-2.0.1/bin/archiva
+ '[' -h /opt/apache-archiva-2.0.1/bin/archiva ']'
+ '[' /opt/apache-archiva-2.0.1/bin/archiva =
/opt/apache-archiva-2.0.1/bin/archiva ']'
+ CHANGED=
+ '[' X '!=' X ']'
++ dirname /opt/apache-archiva-2.0.1/bin/archiva
+ cd /opt/apache-archiva-2.0.1/bin
++ pwd
+ REALDIR=/opt/apache-archiva-2.0.1/bin
++ echo /opt/apache-archiva-2.0.1/logs
++ cut -c1,1
+ FIRST_CHAR=/
+ '[' / '!=' / ']'
++ echo ./wrapper
++ cut -c1,1
+ FIRST_CHAR=.
+ '[' . '!=' / ']'
+ WRAPPER_CMD=/opt/apache-archiva-2.0.1/bin/./wrapper
++ echo /opt/apache-archiva-2.0.1/conf/wrapper.conf
++ cut -c1,1
+ FIRST_CHAR=/
+ '[' / '!=' / ']'
+ ANCHORFILE=/opt/apache-archiva-2.0.1/logs/archiva.anchor
+ PIDFILE=/opt/apache-archiva-2.0.1/logs/archiva.pid
+ LOCKDIR=/var/lock/subsys
+ LOCKFILE=/var/lock/subsys/archiva
+ pid=
+ PSEXE=/usr/bin/ps
+ '[' '!' -x /usr/bin/ps ']'
+ PSEXE=/bin/ps
+ '[' '!' -x /bin/ps ']'
++ uname -s
++ tr '[:upper:]' '[:lower:]'
++ tr -d '[:blank:]'
+ DIST_OS=linux
+ case "$DIST_OS" in
++ uname -p
++ tr '[:upper:]' '[:lower:]'
++ tr -d '[:blank:]'
+ DIST_ARCH=x86_64
+ '[' x86_64 = unknown ']'
+ case "$DIST_ARCH" in
+ DIST_ARCH=x86
+ '[' linux = macosx ']'
+ WRAPPER_TEST_CMD=/opt/apache-archiva-2.0.1/bin/./wrapper-linux-x86-64
+ /opt/apache-archiva-2.0.1/bin/./wrapper-linux-x86-64 -v
+ '[' 0 = 0 ']'
+ WRAPPER_CMD=/opt/apache-archiva-2.0.1/bin/./wrapper-linux-x86-64
+ '[' X = X ']'
+ CMDNICE=
+ '[' X = X ']'
+ ANCHORPROP=
+ IGNOREPROP=
+ LOCKPROP=
+ '[' -d /var/lock/subsys ']'
+ '[' -w /var/lock/subsys ']'
+ case "$1" in
+ checkUser touchlock start
+ '[' Xarchiva '!=' X ']'
+ IDEXE=/usr/xpg4/bin/id
+ '[' '!' -x /usr/xpg4/bin/id ']'
+ IDEXE=/usr/bin/id
+ '[' '!' -x /usr/bin/id ']'
++ /usr/bin/id -u -n
+ '[' archiva = archiva ']'
+ RUN_AS_USER=
+ '[' X '!=' X ']'
+ start
+ echo 'Starting Apache Archiva...'
Starting Apache Archiva...
+ getpid
+ '[' -f /opt/apache-archiva-2.0.1/logs/archiva.pid ']'
+ '[' X = X ']'
+ COMMAND_LINE=' "/opt/apache-archiva-2.0.1/bin/./wrapper-linux-x86-64"
"/opt/apache-archiva-2.0.1/conf/wrapper.conf" wrapper.syslog.ident=archiva
wrapper.pidfile="/opt/apache-archiva-2.0.1/logs/archiva.pid"
wrapper.daemonize=TRUE '
+ eval '"/opt/apache-archiva-2.0.1/bin/./wrapper-linux-x86-64"'
'"/opt/apache-archiva-2.0.1/conf/wrapper.conf"'
wrapper.syslog.ident=archiva
'wrapper.pidfile="/opt/apache-archiva-2.0.1/logs/archiva.pid"'
wrapper.daemonize=TRUE
++ /opt/apache-archiva-2.0.1/bin/./wrapper-linux-x86-64
/opt/apache-archiva-2.0.1/conf/wrapper.conf wrapper.syslog.ident=archiva
wrapper.pidfile=/opt/apache-archiva-2.0.1/logs/archiva.pid
wrapper.daemonize=TRUE
+ exit 0
+ RETVAL=0
+ '[' 'Xwrapper.lockfile="/var/lock/subsys/archiva"' '!=' X ']'
+ getpid
+ '[' -f /opt/archiva/logs/archiva.pid ']'
+ '[' X = X ']'
+ '[' -f /var/lock/subsys/archiva ']'
+ exit 0
Brett Porter
2014-06-24 06:03:38 UTC
Permalink
Hi Joseph,
Post by Joseph Wilkicki
Hi!
I'm trying to install Archiva 2.0.1 standalone on RHEL6 using the
http://archiva.apache.org/docs/2.0.1/adminguide/standalone.html
It does seem that these are omitting some detail when doing it as a service. Because it switches user without running any login shell, the profile scripts are not picked up.

You should add the export command for ARCHIVA_BASE into /etc/init.d/archiva, or edit wrapper.conf (see below).

I'll file a bug that this should either be documented or included in the default scripts.
Post by Joseph Wilkicki
I'm trying to separate the base install from the configuration, as
indicated in the instructions. I've put the distribution into
/opt/apache-archiva-2.0.1 and symlinked it to /opt/archiva. I symlinked
/opt/archiva/bin/archiva to /etc/init.d/archiva and run chkconfig add and
chkconfig on. I've put in /etc/profile.d/archiva.sh: export
ARCHIVA_BASE=/var/archiva and made sure the variable is set in my shell.
I've created the directories indicated in the instructions. I've made
sure there is an archiva user and changed the startup script RUN_AS_USER to
archiva.
The startup script won't start the app. I made sure
/var/subsys/local/archiva exists and is writable by that user. I've
changed /opt/archiva/conf/wrapper.conf set.default.ARCHIVA_BASE=/var/archiva
Setting this variable should have worked (I just tried locally). If you're happy with that, you might need to make sure all the wrapper scripts had stopped first.

If you see -Dappserver.base=/var/archiva in the 'ps' command, then it has been picked up, and should be logging to the correct logs directory.
Post by Joseph Wilkicki
As far as I can tell, the documentation is just wrong about ARCHIVA_BASE
but I don't see any other way of doing this. I've tried searching the
mailing list as well and I can't seem to find anything relevant to 2.0.1.
Can anyone help here?
I also tried just installing 2.0.1 with the Puppet rules, but apparently
it just can't setup Archiva 2.0.1.
Not sure what you meant by puppet rules, but this alternative will also give you a completely working Archiva install on a clean RHEL installation (after Puppet is installed):

sudo yum install -y java-1.7.0-openjdk
sudo puppet module install maestrodev/archiva
sudo puppet apply -e 'class { archiva: version => "2.0.1" }'

This particular alternative installs to /usr/local/archiva and /var/local/archiva, altering the init.d script as I described at the beginning.
Post by Joseph Wilkicki
It runs but the DefaultUserService has
a combination of errors doing basic things like getting the admin user
created or setting up Redback for LDAP, so I'm falling back to manual
instructions.
That sounds like it might have created an incorrect security.properties. Try removing that file and restarting the service and see if that helps.

Regards,
Brett
Joseph Wilkicki
2014-06-24 20:45:41 UTC
Permalink
My mailing list subscription is a little messed up, but this is in reply to
this message:

http://mail-archives.apache.org/mod_mbox/archiva-users/201406.mbox/%3CDE946284-8A9F-4919-9D17-B1683B1700F7%40apache.org%3E

I'll try adding ARCHIVA_BASE directly to the init script and see if that
helps.

I had mentioned Puppet rules in my original mail. I meant the puppet
module mentioned in Brent's reply: maestrodev/archiva I tried to use
the LDAP parameters and the external user JDBC from the module
documentation (which was only in init.pp and not in the README.md on Puppet
Forge) and neither worked successfully. I assume the former didn't work
because 2.0.1 does a graphical setup for LDAP now and I don't really know
why it didn't setup MySQL properly. It seemed no matter what I did,
Archiva couldn't create the guest account or the admin user account even
though the puppetlabs/mysql module setup the database properly.
Joseph Wilkicki
2014-06-24 20:59:39 UTC
Permalink
Added in ARCHIVA_BASE. I see no sign of appserver.base in the output of
the startup script. I made /opt/archiva/logs writable by the archiva user
and it placed a pid file in that directory. The startup script just seems
to be ignoring ARCHIVA_BASE entirely. I'll try the puppet module again
with the stripped down configuration.
Post by Joseph Wilkicki
My mailing list subscription is a little messed up, but this is in reply
http://mail-archives.apache.org/mod_mbox/archiva-users/201406.mbox/%3CDE946284-8A9F-4919-9D17-B1683B1700F7%40apache.org%3E
I'll try adding ARCHIVA_BASE directly to the init script and see if that
helps.
I had mentioned Puppet rules in my original mail. I meant the puppet
module mentioned in Brent's reply: maestrodev/archiva I tried to use
the LDAP parameters and the external user JDBC from the module
documentation (which was only in init.pp and not in the README.md on Puppet
Forge) and neither worked successfully. I assume the former didn't work
because 2.0.1 does a graphical setup for LDAP now and I don't really know
why it didn't setup MySQL properly. It seemed no matter what I did,
Archiva couldn't create the guest account or the admin user account even
though the puppetlabs/mysql module setup the database properly.
Loading...