Re: Different DAViCal database

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Different DAViCal database

Narcis Garcia - GiLUG
The following are new steps i've followed to successfully install DAViCal in an independent database and permissions for an UBuntu 10.04 shared server. Please, give me an account to document it in the wiki.

# Register stable repository (useful for any Ubuntu/Debian), and install DAViCal + PostgreSql service:
sudo apt-key advanced --keyserver pgp.net.nz --recv-keys F6E0FA5CF0307507BB23A512EAFCFEBF8FEB8EBF
echo "deb http://debian.mcmillan.net.nz/debian stable awm #DAViCal CalDAV Server" | sudo tee /etc/apt/sources.list.d/davical.list
sudo apt-get update
sudo apt-get install postgresql davical davical-doc php5-curl

# Customize the DAViCal database details
DatabaseName=mycaldb
AdminPassword=1234
DBUsername=mycaluser
DBPassword=12345

# Add open permissions temporarily for the installation scripts:
MediumPgVersion="$(psql --version | grep -ie "sql" | tr -s " " "\n" | tail --lines=1 | cut -f 1,2 -d ".")"
PgConfig="/etc/postgresql/${MediumPgVersion}/main/pg_hba.conf"
sudo mv "$PgConfig" "${PgConfig}.davical-bak"
sudo cp -a "${PgConfig}.davical-bak" "$PgConfig"
echo "# Permissions for the DAViCal CMS" | sudo tee "$PgConfig"
echo "local   $DatabaseName $DBUsername       trust" | sudo tee --append "$PgConfig"
echo "" | sudo tee --append "$PgConfig"
sudo cat "${PgConfig}.davical-bak" | sudo tee --append "$PgConfig"
sudo service postgresql-${MediumPgVersion} reload

# Apply a temporary patch to creation script:
CScript="/usr/share/davical/dba/create-database.sh"
sudo mv "$CScript" "${CScript}.davical-bak"
sudo cp -a "${CScript}.davical-bak" "$CScript"
cat "${CScript}.davical-bak" | sed -e "s/DBNAME=.*/DBNAME=${DatabaseName}/g" | sed -e "s/AWL_DBAUSER=.*/AWL_DBAUSER=${DBUsername}/g" | sudo tee "$CScript"

# Apply a temporary patch to update script:
UScript="/usr/share/davical/dba/update-davical-database"
sudo mv "$UScript" "${UScript}.davical-bak"
sudo cp -a "${UScript}.davical-bak" "$UScript"
cat "${UScript}.davical-bak" | sed -e "s/\$dbname = .*/\$dbname = \"${DatabaseName}\";/g" | sed -e "s/\$dbuser = .*/\$dbuser = \"${DBUsername}\";/g" | sed -e "s/\$dbpass = .*/\$dbpass = \"${DBPassword}\";/g" | sudo tee "$UScript"

# Run main installation script:
sudo su postgres -c "$CScript" "$DatabaseName" "$AdminPassword"
# Take note of the shown password for the 'admin' user and restore installation scripts.
sudo mv "${UScript}.davical-bak" "$UScript"
sudo mv "${CScript}.davical-bak" "$CScript"

# Set password authentication for the database:
echo "ALTER USER $DBUsername WITH PASSWORD '${DBPassword}';" | sudo su postgres -c psql
echo "# Permissions for the DAViCal CMS" | sudo tee "$PgConfig"
echo "local   $DatabaseName $DBUsername       password" | sudo tee --append "$PgConfig"
echo "" | sudo tee --append "$PgConfig"
sudo cat "${PgConfig}.davical-bak" | sudo tee --append "$PgConfig"
sudo service postgresql-${MediumPgVersion} reload

VHostName=caldav.example.net
# Create configuration in /etc/davical/${VHostName}-conf.php following the example in http://wiki.davical.org/w/Debian
# and adding the parameter password= to the string pg_connect[]
# (chapter about /etc/davical/config.php)

# Create Apache virtualhost and configure it as the example in http://wiki.davical.org/w/Debian
# but replace ServerName and ServerAlias for virtualhosts needed values



Al 03/10/12 10:55, En/na Narcis Garcia - GiLUG ha escrit:
I see that one problem is that two scripts have hard-coded the database
name and username for PostgreSql hard-coded , and don't take care of
command-line parameters:

/usr/share/davical/dba/create-database.sh
/usr/share/davical/dba/update-davical-database





------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Davical-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/davical-general