diff --git a/create-and-deploy-charms.rst b/create-and-deploy-charms.rst index 8de91e792f4da3066b3bb59f437cc28b1001fbf6..d129331ce55fb7ebd9083d9573069fd3d227efc1 100644 --- a/create-and-deploy-charms.rst +++ b/create-and-deploy-charms.rst @@ -56,7 +56,7 @@ Create The Wordpress Charm Skeleton Wordpress Charm Development Tutorial ------------------------------------ -1. Find the wordpress directory just created and edit the **metadata.yaml** file located in it: +1. Find the wordpress directory just created and edit the ``metadata.yaml`` file located in it: .. code-block:: yaml @@ -79,27 +79,27 @@ Wordpress Charm Development Tutorial interface: mysql - The *metadata.yaml* is the file that Juju reads to find out what a charm is, what it does and what it needs to do it. + The ``metadata.yaml`` is the file that Juju reads to find out what a charm is, what it does and what it needs to do it. - The *summary*, *maintainer* and *description* fields can be edited with arbitrary descriptions. + The ``summary``, ``maintainer`` and ``description`` fields can be edited with arbitrary descriptions. - The *provides* and *requires* fields define which relations are actually provided or required by the wordpress application. + The ``provides`` and ``requires`` fields define which relations are actually provided or required by the wordpress application. Since the Wordpress charm is a web-based application, it provides a simple HTTP interface. - Also, the Wordpress charm needs a connection to a database to function properly, so in the *metadata.yaml* we require a mysql interface. + Also, the Wordpress charm needs a connection to a database to function properly, so in ``metadata.yaml`` we require a mysql interface. -2. Edit the **layer.yaml** file in the wordpress directory and include the *basic* and *apt* layer: +2. Edit the ``layer.yaml`` file in the wordpress directory and include the ``basic`` and ``apt`` layers: .. code-block:: yaml includes: ['layer:basic', 'layer:apt'] - Depending on the charm you are building, you can add other layers, but tipically the *basic* layer is required by every charm, while the *apt* layer can be very useful for charms based on packaged applications. + Depending on the charm you are building, you can add other layers, but tipically the ``basic`` layer is required by every charm, while the ``apt`` layer can be very useful for charms based on packaged applications. These two layers provide the ``charm.reactive``, ``charm-helpers``, ``charm.apt`` libraries and all of their dependencies for use by the charm. -3. Edit the **wordpress.py** file in the **wordpress/reactive** directory: +3. Edit the ``wordpress.py`` file in the ``wordpress/reactive`` directory: .. code-block:: python @@ -158,10 +158,10 @@ Wordpress Charm Development Tutorial 2. Deploy your wordpress charm - The wordpress application and unit will halt on the status **'blocked'** because no other python function - was specified to be executed in the *wordpress.py* file after the **install_wordpress** function. + The wordpress application and unit will halt on the status ``blocked`` because no other Python function + was specified to be executed in the ``wordpress.py`` file after the ``install_wordpress`` function. - Also, the application status **'blocked'** is exactly what we expect to see since we wrote the following instruction in *wordpress.py*: + Also, the application status ``blocked`` is exactly what we expect to see since we wrote the following instruction in ``wordpress.py``: .. code-block:: python @@ -173,7 +173,7 @@ Wordpress Charm Development Tutorial 6. Continue the charm development, **deploy mysql** and **add a relation between wordpress and mysql**: - 1. Add a new function in the *wordpress.py* file: + 1. Add a new function in the ``wordpress.py`` file: .. code-block:: python @@ -204,12 +204,12 @@ Wordpress Charm Development Tutorial A relation between mysql and wordpress will be added. - The wordpress application and unit will halt again on the status **'blocked'** as we expect since we wrote the **status_set** instruction - in the **database_is_ready** function. + The wordpress application and unit will halt again on the status ``blocked`` as we expect, since we wrote the ``status_set`` instruction + in the ``database_is_ready`` function. - The *database_is_ready* function is executed when both wordpress and mysql units are deployed. + The ``database_is_ready`` function is executed when both wordpress and mysql units are deployed. - Also, the function execution is triggered when the relation between wordpress and mysql is added as a result of the *juju add-relation* command previously issued. + Also, the function execution is triggered when the relation between wordpress and mysql is added as a result of the ``juju add-relation`` command previously issued. @@ -218,7 +218,7 @@ Wordpress Specific Code Configure the Wordpress application according to https://help.ubuntu.com/lts/serverguide/wordpress.html -1. Edit the **install_wordpress** function in the *wordpress.py* file: +1. Edit the ``install_wordpress`` function in the ``wordpress.py`` file: .. code-block:: python @@ -268,9 +268,9 @@ Configure the Wordpress application according to https://help.ubuntu.com/lts/ser 3. restarts the Apache service -2. Create a directory named *templates* into the wordpress directory +2. Create a directory named ``templates`` into the wordpress directory -3. In ``templates/`` create and edit a file named **config-localhost-php.tmpl**: +3. In ``templates/`` create and edit a file named ``config-localhost-php.tmpl``: .. code-block:: php @@ -282,7 +282,7 @@ Configure the Wordpress application according to https://help.ubuntu.com/lts/ser define('WP_CONTENT_DIR', '/usr/share/wordpress/wp-content'); ?> -4. Write the following function in *wordpress.py*: +4. Write the following function in ``wordpress.py``: .. code-block:: python @@ -301,9 +301,9 @@ Configure the Wordpress application according to https://help.ubuntu.com/lts/ser This function retrieves information from the mysql unit regarding the account and database that was created when - the *juju add-relation mysql wordpress* command was executed. + the ``juju add-relation mysql wordpress`` command was executed. - Then, writes these information into the */etc/wordpress/config-default.php* file using the Jinja2 templating engine. + Then, writes these information into the ``/etc/wordpress/config-default.php`` file using the Jinja2 templating engine. 5. Add the missing imports: @@ -343,7 +343,7 @@ From the command line execute this command: Use Wordpress ------------- -From the command line execute the **juju status** command: +From the command line execute the ``juju status`` command: .. image:: images/status.png