Skip to content

Drupal 8 installation for OS2Forms 2.0 Solution

License

Notifications You must be signed in to change notification settings

orehoj/os2forms8

 
 

Repository files navigation

OS2Forms Drupal 8 project

Build Status

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Traditional

Installing

  1. Clone the git repository

    git clone [email protected]:OS2Forms/os2forms8.git
  2. Enter the newly created project directory

    cd os2forms8
  3. Install dependencies

    composer install
  4. Install drupal based on OS2Forms profile. Make sure you substitute the following variables:

    • db_pass
    • db_user
    • db_host
    • db_name
    • account_password
    • site_name
    drush si os2forms8 --db-url=mysql://db_user:db_pass@db_host/db_name --account-pass=account_password --site-name="site_name"

With Docksal

Prerequisites

Installing

  1. Clone the git repository

    git clone [email protected]:OS2Forms/os2forms8.git
  2. Enter the newly created project directory

    cd os2forms8
  3. Start docksal environment

    fin start
  4. Create local settings

    cp web/sites/example.settings.local.php web/sites/default/settings.local.php
  5. Add file permission fix to settings.local.php. See https://docs.docksal.io/apps/drupal/#file-permissions

    // web/sites/default/settings.local.php
    
    $settings['file_chmod_directory'] = 0777;
    $settings['file_chmod_file'] = 0666;
  6. Here you can choose to install a standard OS2forms or include the OS2forms Forløb module with necessary configurations.

    # Option 1: Standard OS2forms test or development install
    fin rebuild-test
    # Option 2: OS2forms 2.1 med Forløb test or development install
    fin build-forloeb
  7. Configure trusted hosts in settings.local.php (add the following if not present)

    // web/sites/default/settings.local.php
    
    $settings['trusted_host_patterns'] = ['^os2forms8.docksal$', '^localhost$'];

You should now be able to browse to the application at http://os2forms8.docksal

Deployment

These instructions will get you a copy of the project up and running on a live system. For a more detailed description, you could look at the web/core/INSTALL.txt here.

Prerequisites

  • A HTTP server such as Apache that supports PHP
  • A database service such as MySQL
  • PHP 7.4 with the following extensions enabled:
    • gd
    • curl
    • simplexml
    • xml
    • dom
    • soap
    • mbstring
    • zip
    • database specific extension such as the mysql extension
  • Composer
  • Drush launcher

Installing

  1. Clone the git repository
git clone [email protected]:OS2Forms/os2forms8.git

It assumes that you have configured your web-server to use path [/vhost/path]/os2web8/web as document root folder.

  1. Enter the newly created project directory
cd os2forms8
  1. Install dependencies without development dependencies
composer install --no-dev
  1. Create local settings
    cp web/sites/default.settings.local.php web/sites/default/settings.local.php
  2. Add databases settings to web/sites/default/settings.local.php
   $databases['default']['default'] = array (
     'database' => '[dbname]',
     'username' => '[dbuser]',
     'password' => '[dbpass]',
     'prefix' => '',
     'host' => '[dbhost]',
     'port' => '',
     'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
     'driver' => 'mysql',
   );
  1. Generate a salt string and insert it in web/sites/default/settings.local.php

    # Generate salt string - this will output a new salt string
    ./vendor/bin/drush php-eval 'echo \Drupal\Component\Utility\Crypt::randomBytesBase64(55) . "\n";'
    // web/sites/default/settings.php
    $settings['hash_salt'] = ''; // Insert the generated salt string here
  2. Configure trusted hosts in web/sites/default/settings.local.php. For more information on how to write this, see the section for Trusted Host settings in the official Drupal installation guide.

    // web/sites/default/settings.local.php
    
    $settings['trusted_host_patterns'] = [''];
  3. Install Drupal

    Using drush command:

    # To install default OS2Forms
    drush si os2forms8 --account-pass=account_password --site-name="OS2Forms"
    
    # To install OS2Forms 2
    drush si os2forms_forloeb_profile --account-pass=account_password --site-name="OS2Forms med forløb"
    

    Or visit the url for the os2forms application and follow the instructions

    • Select the os2forms install profile for a default os2forms installation
  4. Enable OS2Forms modules

    ./vendor/bin/drush en os2forms, os2forms_nemid, os2forms_dawa, os2forms_sbsys

Development

During development display of all PHP warnings and errors should be enabled by adding

<?php
// settings.local.php.
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
$config['system.logging']['error_level'] = 'verbose';

to setttings.local.php. See Enable Drupal 8 backend errorlog/debugging mode for further details.

Contributing

OS2Forms projects is open for new features and os course bugfixes. If you have any suggestion, or you found a bug in project, you are very welcome to create an issue in github repository issue tracker. For issue description there is expected that you will provide clear and sufficient information about your feature request or bug report.

Development environment

For development purposes there has been included development environment driven by Docksal. You can find all settings related to in /.docksal folder.

See official manual on how to install docksal on your local development machine.

Since you have installed docksal it's easy to get installed default installation. Use following commands:

# Clone project if you didn't do it yet
git clone [email protected]:OS2Forms/os2forms8.git os2forms8-dev
cd os2forms8-dev
# Start docksal environment
fin start

As result, you will get URL like http://os2forms8-dev.docksal that is going to be used for access os2forms application.

Run fin help to see commands you may need. You see more information about docksal fin command

Most useful commands:

  • fin start/stop/restart - start/stop/restart environment
  • fin bash - get ssh access in CLI container
  • fin drush [comnnand] - run drush command from host mashine in CLI container
  • fin composer [comnnand] - run composer command from host mashine in CLI container
  • fin exec 'command' - run any command from host machine in CLI container

Install default installation

To get default installation just run fin rebuild-test command. Docksal will create default os2forms installation for you.

Before start using it you need to add trusted hosts settings. See next section.

Upload existing db

If you have existing database you want to upload and use, then you have to configure Drupal settings (see section above). NOTE: It's recommended to add settings settings.local.php file.

Default db service credentials:

$databases['default']['default'] = array (
  'database' => 'default',
  'username' => 'root',
  'password' => 'root',
  'prefix' => '',
  'host' => 'db',
  'port' => '',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
);

Use fin bash or fin drush [command] to upload your database

You also need to add the rest drupal settings such as salt, sync/tmp folders, trusted hosts

$settings['trusted_host_patterns'] = ['^os2forms8-dev.docksal$', '^localhost$'];

Code review policy

See OS2Forms code review policy

Git name convention

See OS2Forms git name convention

About

Drupal 8 installation for OS2Forms 2.0 Solution

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • SCSS 39.3%
  • PHP 35.5%
  • Twig 13.1%
  • Shell 7.2%
  • JavaScript 3.9%
  • Dockerfile 1.0%