Skip to content

Instantly share code, notes, and snippets.

@Luukyb
Created February 17, 2021 16:18
Show Gist options
  • Save Luukyb/71a95fe5784d91dc8c294cfc1c2a295c to your computer and use it in GitHub Desktop.
Save Luukyb/71a95fe5784d91dc8c294cfc1c2a295c to your computer and use it in GitHub Desktop.
Below is the template for Drupal Docksal README, complete the items with "<>".
# <Project Name>
This is the source code for the official website of <Project name> based on Drupal <version>.
## Requirements
* [Git](https://git-scm.com/)
* [Composer](https://getcomposer.org/download/)
* [Docksal](https://docksal.io/)
## Local setup with Docksal
### 1. Clone
Create your `~/Project` folder if you don't have it yet: `$ mkdir ~/Project`.
Clone the Acquia repo
```sh
$ cd ~/Projects
$ git clone <repo>
```
Add this repo as a remote repo:
```sh
$ git remote add github <repo>
```
### 2. Setup setting.local.php
Inside your project, create and open setting.local.php in docroot/sites/default:
```sh
$ cd <projectname>
$ nano docroot/sites/default/settings.local.php
```
Paste the following text in settings.local.php:
```php
<?php
/**
* @file
* Drupal site-specific configuration file.
*/
// Docksal DB connection settings.
$databases['default']['default'] = [
'database' => getenv('MYSQL_DATABASE'),
'username' => getenv('MYSQL_USER'),
'password' => getenv('MYSQL_PASSWORD'),
'host' => getenv('MYSQL_HOST'),
'driver' => 'mysql',
];
$settings['trusted_host_patterns'] = [];
$config['config_split.config_split.prod']['status'] = FALSE;
$config['config_split.config_split.local']['status'] = TRUE;
```
### 3. Import the db
Download a copy of the DB from <hosting name> and place it in ~/Project/<projectname>. Assuming the file is named prod-db.sql, execute the following:
```
$ fin db import prod-db.sql
```
### 4. Start and import the local config
Start Docksal and import the config for dev (it's config_split.config_split.local set to true above):
```sh
$ fin start
$ fin drush cr
$ fin drush cim
```
The site in your local is available at [https://<projectname>.docksal/](https://<projectname>.docksal/).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment