Local Development

Last edited 32 days ago by Sean Dietrich

Requirements

Docker

Before starting local development, Docker is required and must be installed. Docker Desktop for MacOS and Docker for Linux are available for installation.

Docksal

Installing

After installing Docker, open a terminal and run the following command.
bash <(curl -fsSL https://get.docksal.io)

Pantheon

The following files can be added to the project and allow for them to have docksal configuration installed and work with Pantheon.
.docksal/etc/php/php.ini
; XDebug configuration
; XDebug remote host config
; xdebug.remote_host = 10.10.1.140
; xdebug.remote_connect_back=1
; xdebug.idekey = PHPSTORM

[PHP]

;;;;;;;;;;;;;;;
; PHP Globals ;
;;;;;;;;;;;;;;;

short_open_tag = Off
output_buffering = 4096
allow_call_time_pass_reference = Off
variables_order = "GPCS"
request_order = "GP"
register_long_arrays = Off
register_argc_argv = Off
magic_quotes_gpc = Off
enable_dl = Off
allow_url_fopen = On
realpath_cache_size = "800K"
realpath_cache_ttl = "86400"
disable_functions =
include_path = ".:/usr/share/pear:/usr/share/php"

[Date]
date.timezone = "UTC"

;;;;;;;;;;;;;;;;;;;;;;
;; PACKAGE SETTINGS ;;
;;;;;;;;;;;;;;;;;;;;;;

; Xdebug
; xdebug.max_nesting_level = 256
; xdebug.show_exception_trace = 0
; xdebug.collect_params = 0
; xdebug.remote_enable = 1
xdebug.mode = coverage,debug
xdebug.discover_client_host = 1
xdebug.client_host = 192.168.64.100

;;;;;;;;;;;;;;;;;;;;;;;
;; PANTHEON SETTINGS ;;
;;;;;;;;;;;;;;;;;;;;;;;

; Globals
expose_php = on
max_execution_time = 90
max_input_time = 900
max_input_vars = 10000
memory_limit = 2G
upload_max_filesize = 100M
post_max_size = 100M
error_reporting = E_ALL & ~E_DEPRECATED
ignore_repeated_errors = on
html_errors = off
display_errors = on
error_log = /src/logs/php-error.log
log_errors = on

; Using this to insert essential Pantheon functionality.
auto_prepend_file = /var/www/.docksal/etc/php/prepend.php

; Mail settings
sendmail_path = '/usr/bin/msmtp -t --host=mail --port=1025 --read-envelope-from'

.docksal/etc/php/prepend.php
<?php

define('PANTHEON_INFRASTRUCTURE_ENVIRONMENT', 'docksal');
define('PANTHEON_SITE', '81261de0-ac96-4068-b340-7c55d8bc4d99');
define('PANTHEON_ENVIRONMENT', 'docksal');
define('PANTHEON_BINDING', 'da824df8ee5247b195403247fa63673d');
define('PANTHEON_BINDING_UID_NUMBER', '10042');

define('PANTHEON_DATABASE_HOST', 'db');
define('PANTHEON_DATABASE_PORT', '3306');
define('PANTHEON_DATABASE_USERNAME', 'root');
define('PANTHEON_DATABASE_PASSWORD', 'root');
define('PANTHEON_DATABASE_DATABASE', 'default');
define('PANTHEON_DATABASE_PREFIX', '');
define('PANTHEON_DATABASE_BINDING', '2e2f43ea4d17492db93460e9975bb94a');

define('PANTHEON_REDIS_HOST', 'redis');
define('PANTHEON_REDIS_PORT', '6379');
define('PANTHEON_REDIS_PASSWORD', '');
define('PANTHEON_VALHALLA_HOST', 'valhalla-02.production.cluster-01.us-central1.internal.k8s.pantheon.io');
define('PANTHEON_INDEX_HOST', getenv('PANTHEON_INDEX_HOST'));
define('PANTHEON_INDEX_PORT', getenv('PANTHEON_INDEX_PORT'));
define('DRUPAL_HASH_SALT', '22f0d9fd0cf922ac045bd07db7802945e99f6ee09dac695e8d01b17131f2b67c');

$_ENV['PANTHEON_SITE'] = PANTHEON_SITE;
$_ENV['PANTHEON_ENVIRONMENT'] = PANTHEON_ENVIRONMENT;
$_ENV['PANTHEON_BINDING'] = PANTHEON_BINDING;
$_ENV['DRUPAL_HASH_SALT'] = DRUPAL_HASH_SALT;
$_ENV['DB_HOST'] = PANTHEON_DATABASE_HOST;
$_ENV['DB_PORT'] = PANTHEON_DATABASE_PORT;
$_ENV['DB_USER'] = PANTHEON_DATABASE_USERNAME;
$_ENV['DB_PASSWORD'] = PANTHEON_DATABASE_PASSWORD;
$_ENV['DB_NAME'] = PANTHEON_DATABASE_DATABASE;
$_ENV['DB_PREFIX'] = PANTHEON_DATABASE_PREFIX;
$_ENV['CACHE_HOST'] = PANTHEON_REDIS_HOST;
$_ENV['CACHE_PORT'] = PANTHEON_REDIS_PORT;
$_ENV['CACHE_PASSWORD'] = PANTHEON_REDIS_PASSWORD;
$_ENV['PANTHEON_INDEX_PORT'] = PANTHEON_INDEX_PORT;
$_ENV['PANTHEON_INDEX_HOST'] = PANTHEON_INDEX_HOST;

// System paths
putenv('PATH=/usr/local/bin:/bin:/usr/bin:/srv/bin');

$settings = array (
'conf' => array (
'pressflow_smart_start' => true,
'pantheon_binding' => PANTHEON_BINDING,
'pantheon_site_uuid' => PANTHEON_SITE,
'pantheon_environment' => PANTHEON_ENVIRONMENT,
'pantheon_tier' => 'live',
'pantheon_index_host' => PANTHEON_INDEX_HOST,
'pantheon_index_port' => PANTHEON_INDEX_PORT,
'redis_client_host' => PANTHEON_REDIS_HOST,
'redis_client_port' => PANTHEON_REDIS_PORT,
'redis_client_password' => PANTHEON_REDIS_PASSWORD,
'file_public_path' => 'sites/default/files',
'file_private_path' => 'sites/default/files/private',
'file_directory_path' => 'sites/default/files',
//'file_temporary_path' => '/tmp',
//'file_directory_temp' => '/tmp',
'css_gzip_compression' => false,
'js_gzip_compression' => false,
'page_compression' => false,
'drupal_hash_salt' => DRUPAL_HASH_SALT,
'config_directory_name' => 'config',
'file_chmod_directory' => 0777,
'file_chmod_file' => 0666
),
'databases' => array (
'default' => array (
'default' => array (
'host' => PANTHEON_DATABASE_HOST,
'port' => PANTHEON_DATABASE_PORT,
'username' => PANTHEON_DATABASE_USERNAME,
'password' => PANTHEON_DATABASE_PASSWORD,
'database' => PANTHEON_DATABASE_DATABASE,
'driver' => 'mysql',
'prefix' => '',
),
),
),
);

// Legacy Drupal Settings Block
$_SERVER['PRESSFLOW_SETTINGS'] = json_encode($settings);

$_SERVER['HTTP_USER_AGENT_HTTPS'] = 'ON';

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.