Browse Source

improve packaging once again by making it easier to get started

master
parent
commit
2d16285998
  1. 4
      arangodb/arangod.conf
  2. 43
      arangodb/arangodb.spec
  3. 7
      arangodb/arangodump.conf
  4. 35
      arangodb/arangomkdb.sh

4
arangodb/arangod.conf

@ -17,8 +17,8 @@ uid = @l_rusr@
gid = @l_rgrp@
threads = 8
endpoint = ssl://127.0.0.1:8529
keyfile = @l_prefix@/etc/arangodb/arangodb-sv.pem
cafile = @l_prefix@/etc/arangodb/arangodb-ca.pem
keyfile = @l_prefix@/etc/arangodb/arangod-sv.pem
cafile = @l_prefix@/etc/arangodb/arangod-ca.pem
disable-authentication = no
disable-authentication-unix-sockets = no

43
arangodb/arangodb.spec

@ -43,6 +43,8 @@ Source0: https://github.com/arangodb/arangodb/archive/v%{V_tarball}.tar.gz
Source1: rc.arangodb
Source2: arangod.conf
Source3: arangosh.conf
Source4: arangodump.conf
Source5: arangomkdb.sh
Patch0: arangodb.patch
# build information
@ -139,8 +141,15 @@ PreReq: readline, ncurses, openssl, icu, libexecinfo
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE arangod.conf} \
%{SOURCE arangosh.conf} \
%{SOURCE arangodump.conf} \
$RPM_BUILD_ROOT%{l_prefix}/etc/arangodb/
# install utility
%{l_shtool} install -c -m 755 %{l_value -s -a} \
-e 's;@l_bash@;%{l_bash};g' \
%{SOURCE arangomkdb.sh} \
$RPM_BUILD_ROOT%{l_prefix}/bin/arangomkdb
# install run-command script
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
@ -167,33 +176,35 @@ PreReq: readline, ncurses, openssl, icu, libexecinfo
%post
if [ $1 -eq 1 ]; then
# provide SSL/TLS certificate/key pairs
if [ ! -f $RPM_INSTALL_PREFIX/etc/arangodb/arangodb-sv.pem ]; then
if [ ! -f $RPM_INSTALL_PREFIX/etc/arangodb/arangod-sv.pem ]; then
cat $RPM_INSTALL_PREFIX/etc/x509/example-server.crt.pem \
$RPM_INSTALL_PREFIX/etc/x509/example-server.key.pem \
>$RPM_INSTALL_PREFIX/etc/arangodb/arangodb-sv.pem
chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/etc/arangodb/arangodb-sv.pem
chmod 600 $RPM_INSTALL_PREFIX/etc/arangodb/arangodb-sv.pem
>$RPM_INSTALL_PREFIX/etc/arangodb/arangod-sv.pem
chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/etc/arangodb/arangod-sv.pem
chmod 600 $RPM_INSTALL_PREFIX/etc/arangodb/arangod-sv.pem
fi
if [ ! -f $RPM_INSTALL_PREFIX/etc/arangodb/arangodb-ca.pem ]; then
if [ ! -f $RPM_INSTALL_PREFIX/etc/arangodb/arangod-ca.pem ]; then
cat $RPM_INSTALL_PREFIX/etc/x509/example-ca.crt.pem \
>$RPM_INSTALL_PREFIX/etc/arangodb/arangodb-ca.pem
chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/etc/arangodb/arangodb-ca.pem
chmod 644 $RPM_INSTALL_PREFIX/etc/arangodb/arangodb-ca.pem
>$RPM_INSTALL_PREFIX/etc/arangodb/arangod-ca.pem
chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/etc/arangodb/arangod-ca.pem
chmod 644 $RPM_INSTALL_PREFIX/etc/arangodb/arangod-ca.pem
fi
# display information about next steps
( echo "After initially starting ArangoDB with..."
echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc arangodb start"
echo "...you should immediately set a root password:"
echo " \$ echo 'require(\"org/arangodb/users\").update(\"root\", \"<root-pw>\");' | \\%{l_nil}"
echo "...you should immediately set the \"root\" password on database \"_system\":"
echo " \$ echo 'require(\"@arangodb/users\").update(\"root\", \"<root-pw>\");' | \\%{l_nil}"
echo " $RPM_INSTALL_PREFIX/bin/arangosh --server.disable-authentication true"
echo "You can then create an user account:"
echo " \$ echo 'u = require(\"org/arangodb/users\"); \\%{l_nil}"
echo " u.save(\"<user-name>\", \"<user-pw>\"); u.reload();' | \\%{l_nil}"
echo " $RPM_INSTALL_PREFIX/bin/arangosh \\%{l_nil}"
echo " --server.username root --server.password <root-pw>"
echo "You can then create a custom database with:"
echo " \$ $RPM_INSTALL_PREFIX/bin/arangomkdb <database> <username> <password>"
echo "Then you can connect to the custom database with:"
echo " \$ $RPM_INSTALL_PREFIX/bin/arangosh \\%{l_nil}"
echo " --server.database <database> \\%{l_nil}"
echo " --server.username <username> \\%{l_nil}"
echo " --server.password <password>"
echo "The web interface of ArangoDB you can reach under:"
echo " http://localhost:8529/"
echo " https://localhost:8529/"
) | %{l_rpmtool} msg -b -t notice
fi
if [ $1 -eq 2 ]; then

7
arangodb/arangodump.conf

@ -0,0 +1,7 @@
##
## arangodump.conf -- ArangoDB shell configuration
##
[server]
endpoint = ssl://localhost:8529

35
arangodb/arangomkdb.sh

@ -0,0 +1,35 @@
#!@l_bash@
##
## arangomkdb.sh -- ArangoDB database creation utility
##
# get information
if [ $# -ge 1 ]; then
database="$1"; shift
else
read -p "database: " -e database
fi
if [ $# -ge 1 ]; then
username="$1"; shift
else
read -p "username: " -e -i $database username
fi
if [ $# -ge 1 ]; then
password="$1"; shift
else
read -p "password: " -e -s password
echo ""
fi
read -p "root password: " -e -s rootpw
# generate the JavaScript code to create database
js="db._createDatabase(\"$username\", [], ["
js="$js { username: \"root\", passwd: \"$rootpw\" },"
js="$js { username: \"$username\", passwd: \"$password\" } ]);"
# execute the JavaScript code
echo "$js" | \
@l_prefix@/bin/arangosh \
--server.username root \
--server.password "$rootpw"
Loading…
Cancel
Save