Lamp

juju deploy lamp
Show information
You will need Juju 2.9 to be able to run this command. Learn how to upgrade to Juju 2.9.
Channel Version Base
latest/stable 6
12.04
latest/edge 6
12.04

Platform:

12.04

About

set up an apache server with php and supports a connection to mysql Read more


Discuss this charm

Share your thoughts on this charm with the community on discourse.

Join the discussion

While many Reactive Framework charms work on machines today, it’s recommended to create new charms with the Operator Framework. Learn more about the history of charms.

Overview

This is a generic LAMP charm to enable quick development of a LAMP application. The first thing the LAMP charm does is to install and configure a new instance with Apache and PHP5. The charm will then copy any files /website inside the charm folder structure, into /var/www on the deployed instance.

Usage

This is an example deployment of the charm:

  1. Deploy Mysql as a service.

     juju deploy mysql
    
  2. Deploy phpmyadmin, set a password, and then expose it.

     juju deploy phpmyadmin
     juju set phpmyadmin password="password"
     juju expose phpmyadmin
    
  3. Relate phpmyadmin and MySQL so they can talk to each other

     juju add-relation phpmyadmin mysql
    
  4. Deploy LAMP from your local folder

     charm get lamp
    

    Now cd lamp and copy your PHP files into the ~/lamp/website folder. Now deploy your application:

     juju deploy --repository ~/lamp local:lamp
    
  5. Set up your bazaar branch and publish your website

     juju set lamp website-bzr="lp:~vtuson/+junk/mytodo_web"
     juju expose lamp
    
  6. Configure your database and link LAMP and MySQL

     juju set lamp website-database="your_db_name"
     juju add-relation lamp mysql
    

Configuration

It also allows you to specify a Bazaar branch. It will clone the branch into the webserver and copy the contents to /var/www. As an example set:

juju set lamp website-bzr="lp:~vtuson/+junk/mytodo_web"

You can set up a relationship with a Mysql service. A Mysql database is created by default at this time. You can change the name of the database as a configuration options.

juju set lamp website-database="your_db_name"

If you provide a file called mysql_config either on the /website folder or in the root of you Bazaar branch, this will be used to configure further the Mysql database. PLease note that this file is called every time a new unit is created. For example, item creation should first check if the table exists.

The charm will store the details of the relationship in /var/webconfig. In there you can also find opendb.php, a basic script that will open the connection to the MySQL database for you.

If you want to update the web service by pulling the latest version of the Bazaar branch, just run the following commands:

juju set lamp bzr-update="yes"
juju set lamp bzr-update=

Contact Information

Though this will be listed in the charm store itself don't assume a user will know that, so include that information here:

LAMP Charm