Skip to main content

Installation

Prerequisites

  • A PostgreSQL database.
  • An OpenStack cloud infrastructure with a project and application credentials configured.
  • A local installation of Yii2 framework. You can easily download and install Yii2 framework from here.
  • An existing SCHEMA deployment.

Code deployment

  1. Create a new Yii project.
  2. Download the code for the local clima installation and paste it to your newly created Yii project. To easily perform this while retaining git's remote repository linking you can do the following:
    • Clone the code from your clima forked repository in a temporary directory on your machine. You can do that with the following command: git clone <https://github.com/YOUR_USERNAME/clima.git> temp.
    • Copy clima's code into your Yii project. Example command template: cp -a temp/. <PATH_TO_YII_PROJECT_DIRECTORY>.
    • Navigate to Yii project directory.
    • Verify that existing code now points to the origin repository with git remote -v.
    • Delete the temporary directory.

Dependencies management

  1. Install webvimark.

    • Navigate to config directory and open the web.php file.
    • Remove any duplicate modules entries.
    • In the remaining modules entries set:
      • 'enableRegistration' => true.
      • 'rolesAfterRegistration' => ['Bronze'].
    • DO NOT apply webvimark migrations.
  2. Uninstall Bootstrap 5 that comes with Yii and install Bootstrap 4 and Bootstrap 3 with the following commands:

    • composer remove yiisoft/yii2-bootstrap5.
    • composer require yiisoft/yii2-bootstrap4.
    • composer require --prefer-dist yiisoft/yii2-bootstrap.
  3. Install DatePicker with the following command:

    • composer require kartik-v/yii2-widget-datepicker "dev-master".
  1. Install Yii2-HttpClient with the following command:

    • composer require --prefer-dist yiisoft/yii2-httpclient.
  2. Install Yii2-jui with the following command:

    • composer require yiisoft/yii2-jui.
  3. Install Yii2-swiftmailer with the following command:

    • composer require --prefer-dist yiisoft/yii2-swiftmailer.

Database initialization

  1. Download the schema of the clima database (db_structure_2.sql) and an additional file that contains the initial values for some tables (additionals.sql).
  2. Create a PostgreSQL database and a corresponding user.
  3. Restore db_structure_2.sql file by using the following command: psql -U clima -d clima -f db_structure_2.sql.
  4. Restore additionals.sql file by using the following command: psql -U clima -d clima -f additionals.sql.
  5. Navigate to config/db.php and set the correct PostgreSQL connection credentials. For example:
return [
'class' => 'yii\db\Connection',
'dsn' => 'pgsql:host=localhost;dbname=clima',
'username' => 'clima',
'password' => 'clima',
'charset' => 'utf8'
];

Application configuration

  1. In order to configure your application you have to navigate once again to config/params.php. You should:

    • Set a name for your local SCHEMA clima deployment on name field.
    • Set schema_url field with a url that leads to your existing SCHEMA deployment.
  2. Restore your OpenStack credentials into the OpenStack related tables (OpenStack, OpenStackMachines).

Running SCHEMA clima

  1. Navigate to the main code directory.
  2. To run Yii without the need of an Apache WebServer use the following command: php yii serve.

Creating the first administrator user

In order to get superadmin privileges on your local SCHEMA clima installation implement the following steps:

  1. From the SCHEMA clima index page, navigate to Login > Registration page. Create a new user that you wish to use as superadmin.
  2. Set the newly-created user as superadmin by executing to your PostgreSQL database the following SQL query: UPDATE public.user SET superadmin=1 WHERE username='<YOUR_SUPERADMIN_USERNAME>';.
  3. Return to SCHEMA clima index page and refresh the page to refresh the navigation bar. Then navigate to Adminoptions > User management > Users. Find the user that you created and click on the corresponding Login link.
  4. Select Roles and permissions.
  5. Apply all existing roles and click on Save.

After the creation of the first superadmin you can create new users and modify their roles and permissions by using the superadmin account.