This blog is about set up a local developement instance for Drupal 8 on Pantheon server and the best use of drush.
Let’s follow the step-by-step process to set up our own local developement instance:
I)
To set up local developement instancefor Drupal 8 , Click on git and copy below command
git clone ssh://devserver.dev.463157b8-419d-482f-b571-xxxxxxxxx@deveserver.dev.463157b8-419d-482f-b571-3504bb893903.drush.in:2222/~/repository.git mkrishnapriya-drupal
II)
Then go to your web root i.e. /var/www/html/ and paste the copied command
git clone ssh://devserver.dev.463157b8-419d-482f-b571-xxxxxxxxx@devserver.dev.463157b8-419d-482f-b571-3504bb893903.drush.in:2222/~/repository.mkrishnapriya-drupal
III)
Meanwhile, create a database for the site in local
mysql -u root -p Enter the username and administrator password you set-up during installation
CREATE DATABASE drupal8;
IV)
Download the Pantheon Drush alias from Pantheon Dashboard (https://dashboard.pantheon.io) and place that file to .drush folder
i.e. /home//.drush/
Place below code in .drush folder file name as local.aliases.drushrc.php
--------------------------------------------------------------------------
$local_sites = '/var/www/html/';
$scan = scandir($local_sites);
unset($scan[0]);
unset($scan[1]);
foreach($scan as $projects){
$aliases[$projects] = array(
'root' => $local_sites . $projects,
'path-aliases' => array(
'%dump-dir' => $local_sites . 'drush.dbdumps',
'%files' => $local_sites . $projects . '/sites/default/files'
)
);
}
?>
V)
After clone is done, go to /var/www/html/drupal8/sites/default/
Create new settings.local.php should be an settings.local.php of Drupal 8 Note: Add below code snippet
/**
* @file
* settings.local.php.
*/
// Local development configuration.
if (!defined('PANTHEON_ENVIRONMENT')) {
// Database.
$databases['default']['default'] = array (
'database' => Drupal8,
'username' => '*****',
'password' => '****',
'prefix' => '',
'host' => '******',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
$config_directories['sync'] = 'sites/default/config';
$settings['hash_salt'] = '$HASH_SALT';
}
ini_set('max_execution_time', -1); // add if required
ini_set('memory_limit', '512M'); // add if required
ini_set('upload_max_filesize , 1024M'); // add if required
ini_set('post_max_size , 1024M'); // add if required
Step 6
Create files folder in sites/all/default/
Give permission to file folder Chmod 777 -R files/
Go to ./drush folder through terminal and type drush cc drush
Now on terminal, type drush sa
You will get all local aliases, dev aliases, test aliases and live aliases
Let’s follow the step-by-step process to set up our own local developement instance:
I)
To set up local developement instancefor Drupal 8 , Click on git and copy below command
git clone ssh://devserver.dev.463157b8-419d-482f-b571-xxxxxxxxx@deveserver.dev.463157b8-419d-482f-b571-3504bb893903.drush.in:2222/~/repository.git mkrishnapriya-drupal
II)
Then go to your web root i.e. /var/www/html/ and paste the copied command
git clone ssh://devserver.dev.463157b8-419d-482f-b571-xxxxxxxxx@devserver.dev.463157b8-419d-482f-b571-3504bb893903.drush.in:2222/~/repository.mkrishnapriya-drupal
III)
Meanwhile, create a database for the site in local
mysql -u root -p Enter the username and administrator password you set-up during installation
CREATE DATABASE drupal8;
IV)
Download the Pantheon Drush alias from Pantheon Dashboard (https://dashboard.pantheon.io) and place that file to .drush folder
i.e. /home//.drush/
Place below code in .drush folder file name as local.aliases.drushrc.php
--------------------------------------------------------------------------
$local_sites = '/var/www/html/';
$scan = scandir($local_sites);
unset($scan[0]);
unset($scan[1]);
foreach($scan as $projects){
$aliases[$projects] = array(
'root' => $local_sites . $projects,
'path-aliases' => array(
'%dump-dir' => $local_sites . 'drush.dbdumps',
'%files' => $local_sites . $projects . '/sites/default/files'
)
);
}
?>
V)
After clone is done, go to /var/www/html/drupal8/sites/default/
Create new settings.local.php should be an settings.local.php of Drupal 8 Note: Add below code snippet
/**
* @file
* settings.local.php.
*/
// Local development configuration.
if (!defined('PANTHEON_ENVIRONMENT')) {
// Database.
$databases['default']['default'] = array (
'database' => Drupal8,
'username' => '*****',
'password' => '****',
'prefix' => '',
'host' => '******',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
$config_directories['sync'] = 'sites/default/config';
$settings['hash_salt'] = '$HASH_SALT';
}
ini_set('max_execution_time', -1); // add if required
ini_set('memory_limit', '512M'); // add if required
ini_set('upload_max_filesize , 1024M'); // add if required
ini_set('post_max_size , 1024M'); // add if required
Step 6
Create files folder in sites/all/default/
Give permission to file folder Chmod 777 -R files/
Go to ./drush folder through terminal and type drush cc drush
Now on terminal, type drush sa
You will get all local aliases, dev aliases, test aliases and live aliases
No comments:
Post a Comment