Joomla

Installer for Joomla Content Management System

Joomla! is a free, award-winning content management system written in PHP which is allows users to easily publish their content on the world wide web and intranets.

This server configuration is meant to help you deploy different versions of joomla.

If you deploy using the web based interface, the default options will apply:
- Mysql 5.5
- Joomla 3.4.1
- Apache

If you deploy using the CLI, the following parameters are accepted:
- RELEASE_TAG (default 3.4.1). The value can be a release number (3.4.1) or a branch name.
- DBUSER: (default 'joomla'), to set the database username
- DBPASS: (default 'joomla'), to set the database password
- DBNAME: (default 'joomla'), to set the database name
- DATABASE: (default 'mysql-5.5'), sets the database versions. Accepts 'mysql-5.5', 'mysql-5.6' and 'postgres'.
- MODULES_ENABLED: (default "rewrite") List of Apache modules, separated by space, that will be enabled. Example: "rewrite deflate"
- MODULES_DISABLED: (default "") List of Apache modules, separated by space, that will be disabled. Example: "rewrite deflate"
- PHP_INI: (default "") List of options, separated by space. Example: "register_globals=off track_errors=yes"

Example of the creation of a testing server customizing DBUSER and DBPASS
mac: 0.7.4
description: Joomla server
name: joomla
version: '1.0'
roles:
role_joomla:
instance create:
configuration: joomla
environment:
- DBUSER: myuser
- DBPASS: mypassword
infrastructures:
joomla:
name: 'joomla'
role: role_joomla

Save these contents to joomla.macfile and run the following command:
mac infrastructure macfile joomla.macfile

To install the mac command:
curl -sSL https://manageacloud.com/mac | bash

Configuration summary

Ubuntu Trusty Tahr 14.04 Ubuntu Trusty Tahr 14.04
Bootstrap code
#!/bin/bash
# Uncomment for debugging
#set -x

#
# variables
#
RELEASE_TAG=${RELEASE_TAG:-3.4.1}
DBUSER=${DBUSER:-joomla}
DBPASS=${DBPASS:-joomla}
DBNAME=${DBNAME:-joomla}
DATABASE=${DATABASE:-mysql-5.5}
MODULES_ENABLED=${MODULES_ENABLED:-rewrite}
MODULES_DISABLED=${MODULES_DISABLED:-}
PHP_INI=${PHP_INI:-}

MODULES=($MODULES)"
INIS=($PHP_INI)"

#
# add 512Mb extra swap
#
dd if=/dev/zero of=/swapfile bs=1024 count=512k
mkswap /swapfile

echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf
echo 10 | sudo tee /proc/sys/vm/swappiness

chown root:root /swapfile
chmod 0600 /swapfile

echo " /swapfile       none    swap    sw      0       0 " >> /etc/fstab

swapon /swapfile


#
# Apache and php
#
apt-get update -qq
apt-get install -qq git apache2 libapache2-mod-php5 php5-mysql php5-pgsql php5-gd php-pear php-apc curl
a2enmod rewrite
rm /etc/apache2/sites-enabled/000-default.conf

cat >/etc/apache2/sites-enabled/joomla.conf <<EOL
<VirtualHost _default_:80>
        DocumentRoot /var/www/joomla
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>
EOL

# apache modules
for MODULE in "${MODULES_ENABLED[@]}"
do
    if [ "$MODULE" != "" ]; then
	    a2enmod $MODULE
    fi
done

# apache modules
for MODULE in "${MODULES_DISABLED[@]}"
do
	if [ "$MODULE" != "" ]; then
		a2dismod $MODULE
    fi
done


# php ini
for INI in "${INIS[@]}"
do
    if [ "$INI" != "" ]; then
	    echo "$INI" >> /etc/php5/apache2/conf.d/joomla.ini
    fi
done


#
# code base
#
cd /var/www/
git clone -q --branch ${RELEASE_TAG} https://github.com/joomla/joomla-cms.git
mv joomla-cms joomla
chown -R www-data:www-data joomla
cd joomla

#
# database
#
if [ "$DATABASE" == "postgres" ]; then

  apt-get -y -q install postgresql
  su - postgres -c "psql -c \"CREATE USER $DBUSER WITH PASSWORD '$DBPASS';\""
  su - postgres -c "psql -c \"CREATE DATABASE $DBNAME OWNER $DBUSER;\""
  
elif [ "$DATABASE" == "mysql-5.5" ]; then

  DEBIAN_FRONTEND=noninteractive apt-get -y -q install mysql-server-5.5
  mysql -uroot -e "CREATE DATABASE $DBNAME"
  mysql -uroot -e "CREATE USER '$DBUSER'@'localhost' IDENTIFIED BY '$DBPASS';"
  mysql -uroot -e "GRANT ALL PRIVILEGES ON $DBNAME.* TO '$DBUSER'@'%' WITH GRANT OPTION;"
  
elif [ "$DATABASE" == "mysql-5.6" ]; then

  DEBIAN_FRONTEND=noninteractive apt-get -y -q install mysql-server-5.6
  sleep 5
  mysql -uroot -e "CREATE DATABASE $DBNAME"
  mysql -uroot -e "CREATE USER '$DBUSER'@'localhost' IDENTIFIED BY '$DBPASS';"
  mysql -uroot -e "GRANT ALL PRIVILEGES ON $DBNAME.* TO '$DBUSER'@'%' WITH GRANT OPTION;"
   
else 
    echo "Database $DATABASE not found"
    exit 1
fi

/etc/init.d/apache2 restart















Quick Deployment
Advanced Deployment