# Installation

### Checkout codebase <a href="#newprojectsetup-checkoutinitialcodebase" id="newprojectsetup-checkoutinitialcodebase"></a>

The Rain packages are available for you to clone in a modified version of the [recommended Drupal composer template](https://github.com/drupal/recommended-project).

The project is hosted on a public Bitbucket repo which can be cloned using the following command:

```
git clone git@bitbucket.org:mediacurrent/drupal-project.git shortcode_project
```

Change to the project folder and run the following command to initialize the codebase.

```
composer install
rm web/sites/default/.gitignore
```

This runs composer install. As this is the first time being run, it is a composer update and calculates all dependencies.

### Spin-up your local environment <a href="#newprojectsetup-checkoutinitialcodebase" id="newprojectsetup-checkoutinitialcodebase"></a>

Any local development tool should work, at [Mediacurrent](https://www.mediacurrent.com) we use DDEV. \
DDEV users can use the setup instructions below:

<details>

<summary>DDEV Configuration</summary>

#### Run DDEV’s configuration tool

You can pass in defaults (recommended options below), or you can run it without arguments for an interactive configuration tool.

```
# Option 1: Non-interactive configuration. Project names must be alphanumeric and/or hyphenated.
ddev config --docroot=web --project-name="project" --project-type=drupal9 --webserver-type="nginx-fpm" --create-docroot

# Option 2: Interactive configuration
ddev config
```

* Project name ( as above this is typically the first part of the domain name.)
* Docroot Location = web
* Project Type = drupal9

#### Start DDEV <a href="#newprojectsetup-startddev" id="newprojectsetup-startddev"></a>

After configuration has been completed, start the ddev containers.

```
ddev start
```

#### (Optional) Setting Up NFS

Docker generally has poor performance on very large projects with many directories on MacOS and Windows hosts. Using NFS for volumes can lead to significant gains in performance and mitigate this issue. See the [DDEV-Local official documentation page](https://ddev.readthedocs.io/en/stable/users/performance/#using-nfs-to-mount-the-project-into-the-web-container) for more information on setup and configuration.

It's recommended to configure NFS globally during the during the initial ddev client setup.

</details>

### Initialize Project <a href="#newprojectsetup-initializeproject" id="newprojectsetup-initializeproject"></a>

Run the following commands to initialize the project.

```
./scripts/hobson project:init project.ddev.site
```

* This command ensures the `config/config.yml` is in place and has the domain set.

{% hint style="danger" %}
"Out of Memory" errors when using Composer

[If composer runs out of memory, try one of the following commands](https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors):

`# Bypass memory limits.`

``php -d memory_limit=-1 `which`` ``composer` install``
{% endhint %}

### Restart environment <a href="#newprojectsetup-restartddev" id="newprojectsetup-restartddev"></a>

If DDEV is being used as the local environment, run the following command:

```
ddev restart
```

### Advanced Configuration <a href="#newprojectsetup-restartddev" id="newprojectsetup-restartddev"></a>

For additional configuration options, see our [Advanced configuration guide](advanced-configuration).

### &#x20;<a href="#newprojectsetup-restartddev" id="newprojectsetup-restartddev"></a>

{% hint style="success" %}
### Install the Rain Demo (optional) <a href="#newprojectsetup-restartddev" id="newprojectsetup-restartddev"></a>

The following command will run a full Composer install and site installation using the Rain Demo profile.

**`./scripts/build.sh`**

This will install the full Rain Demo experience with sample content.&#x20;
{% endhint %}

Congratulations, you have installed Rain CMS!&#x20;
