Strehler

 view release on metacpan or  search on metacpan

lib/Strehler/Manual/Installation.pod  view on Meta::CPAN

=encoding utf8

=head1 NAME

Strehler::Manual::Installation - How to install Strehler

=head1 DESCRIPTION

A guide to install Strehler on your Dancer2 app and enjoy all the power of a ready-to-use general purpose CMS.

=head1 GETTING THE MODULE

Strehler module can be easly installed from CPAN

    cpan -i Strehler

Strehler has L<Dancer2> as a mandatory dependency so getting it will give you all the tools to create a Dancer2 app (including L<Dancer2::Plugin::DBIC>).

=head1 INSTALLING ON A DANCER2 APP

This tutorial needs a Dancer2 app already create and, generally speaking, is intended for users with some knowledge about Dancer2 framework. Strehler is a ready-to-use package, but it's still a toy for developers.

=head2 DATABASE

Dancer2 app needs a database. Connection will be managed by L<Dancer2::Plugin::DBIC> so database's configuration has to be inserted in B<config.yml>.

    plugins:
        DBIC:
            default:
                dsn: dbi:mysql:mydb
                schema_class: Strehler::Schema
                user: myuser
                pass: mypassword
                options:
                    RaiseError: 1
                    PrintError: 1
                    mysql_enable_utf8: 1

As you can see you can directly use L<Strehler::Schema> as your B<schema_class>. This is the fastest solution and the recommended one if you won't modify the database adding tables other than the ones used by Strehler.

With the configuration of your database in the B<config.yml> you can run (from the root directory of your project):

    strehler initdb

This script will create on your database all the tables needed by Strehler, asking you, during the procedure, to choose a password for your admin user.

B<BEWARE>: All the tables will be preceded by a B<DROP IF EXIST> command, so if ou run the command on a database where a Strehler table is present that will be destroyed and recreated. B<DO NOT USE> this script to update the database from a Strehler ...

After using initdb command, if you chose to not use Strehler::Schema you can dump the schema using dbicdump from L<DBIx::Class::Schema::Loader>.

=head2 TEMPLATE ENGINE

Strehler uses Template Toolkit as template engine. Configure it in your config file this way:

    engines:
        template:
            template_toolkit:
                ENCODING: utf8
                DEFAULT: 'no.tt'
    template: "template_toolkit"

=head2 STATIC CONTENTS

Static contents (css and javascript) must be copied in the public directory of the project to make them available.

In the root directory of the project type

    strehler statics

This will copy under your public directory a strehler directory containing all the elements needed by the CMS.

strehler statics will erase the public/strehler directory every time you'll call it, to replace it with a fresh one from the package. Please, don't use this directory for your custom elements if you want to use this script also to update resources af...

B<Note>: You can launch initdb and statics toghere with the command

    strehler batch

=head2 CONFIG.YML

Strehler needs something configured in your B<config.yml> file.
All informations about configuration is here L<https://github.com/cym0n/strehler/wiki/Configuration>. 
The snippet below represent the minimal code needed to run CMS.

    Strehler:
        languages: ['it']
        default_language: 'it'
        timezone: 'Europe/Rome'

Yes, i'm italian and the configuration follows my needs. :-)

=head2 APP.PL SCRIPT

In the B<bin/app.pl> script just add

    use Strehler::Admin;

This directive B<must> be placed after the use directive for your main site module, as in the example below:



( run in 0.943 second using v1.01-cache-2.11-cpan-7fcb06a456a )