> For the complete documentation index, see [llms.txt](https://allierays.gitbook.io/drupal-project-resources/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://allierays.gitbook.io/drupal-project-resources/ace-acsf/acsf-first-pull-request.md).

# ACSF - First Pull Request

### Prerequisites and Assumptions

1\) You have an ACSF subscription \
2\) You have set up your SSH keys: [Setup GitHub SSH Keys](https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/) and [Setup Acquia Cloud SSH Keys](https://docs.acquia.com/acquia-cloud/ssh/generate)\
3\) You are using BLT and Lighting\
4\) You are using the Drupal Vm for local development \
5\)  Your computer meets the minimum installation requirements (and then install the required applications). See the [System Requirements](http://blt.readthedocs.io/en/8.x/INSTALL/).\
6\) You have access to your or Acquia-PSO's [Github](https://github.com/)\
7\) You have access to your project's Acquia Cloud Environment

### **Step One**: Sign into Acquia Cloud and the ACSF Management Console&#x20;

[Sign in](https://docs.acquia.com/site-factory/manage/login/) to your Site Factory Management Console using an account with either the [developer](https://docs.acquia.com/site-factory/manage/users/admin/developer/) or [release engineer](https://docs.acquia.com/site-factory/manage/users/admin/release-engineer/) role.&#x20;

* Sign into Acquia Cloud&#x20;
* Navigate from the ACE interface to the Site Factory Management Console
* Sign into the ACSF management console with ACSF site username and password. (This is different from your ACE and Drupal site login)

### **Step Two:** Create a site inside of the ACSF site collection&#x20;

* &#x20;If you have not already, create a group / site collection and name it `ACSFdemo`
* Name your site and pick a distribution profile, for this demo we are using lightning&#x20;

### **Step Three: Local** Prerequisites

If you are using the Drupal Vm you must download [Vagrant](https://www.vagrantup.com/downloads.html) and [VirtualBox](https://www.virtualbox.org/) before you can continue.&#x20;

### **Step Four**: Setting up your git repo

* Log into your github account and create a git repo or use the one provided by Acquia&#x20;
* Create a fork of the main project's repository to follow git flows best practices&#x20;
* Clone your fork

```
$ git clone git@github.com:<your repository>/<your project name>.git
```

* Add the parent repository as an upstream

```bash
$ git remote add upstream git@github.com:acquia-pso/<your project name>.git
```

* Install Composer Dependencies (warning: this can take some time based on internet speeds. If you have problems delete the vendor folder and rerun the command.)

```bash
$ composer install
```

* Create a new branch, for this demo we will use PSO-000-ACSF-Init

```bash
git branch -b PSO-000-ACSF-Init
```

* Update the DrupalVm's configuration file to match your configuration needs: Here is an example:&#x20;

{% code title="config.yml" %}

```yaml
# Update the hostname to the local development environment hostname.
vagrant_hostname: local.ACSFdemo.com
vagrant_machine_name: ACSFdemo

# Set the IP address so it doesn't conflict with other Drupal VM instances.
vagrant_ip: 192.168.90.80

# Use Ubuntu 16.04 LTS to match Acquia Cloud environments.
vagrant_box: geerlingguy/ubuntu1604
workspace: /root

# Set drupal_site_name to the project's human-readable name.
drupal_site_name: "ACSF Demo"

# Provide the path to the project root to Vagrant.
vagrant_synced_folders:
  # Set the local_path for the first synced folder to `.`.
  - local_path: .
    # Set the destination to the Acquia Cloud subscription machine name.
    destination: /var/www/acsfdemo
    type: nfs

drupal_build_composer_project: false
# Toggling this to `true` would invoke `composer install` with the
# projects own `composer.json` successfully.
drupal_build_composer: false
drupal_composer_path: false
drupal_composer_install_dir: "/var/www/acsfdemo"
drupal_core_path: "/var/www/acsfdemo/docroot"
ssh_home: /var/www/acsfdemo

# Multisite installations should configure additional domains here.
apache_vhosts:
  # Drupal VM's default domain, evaluating to whatever `vagrant_hostname` is set to (drupalvm.dev by default).
  - servername: "{{ drupal_domain }}"
    serveralias: "www.{{ drupal_domain }}"
    documentroot: "{{ drupal_core_path }}"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"
  # Domain for the Drupal VM Dashboard
  - servername: "dashboard.{{ drupal_domain }}"
    serveralias: "www.dashboard.{{ drupal_domain }}"
    documentroot: "/var/www/dashboard"
    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"
#  - servername: "local.second-drupal-site.com"
#    documentroot: "{{ drupal_core_path }}"
#    extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

# Multisite installations should configure additional databases here.
# It's recommended to prefix database names with 'drupal'. Otherwise,
# you'll need to add additional users in the 'mysql_users' section.
mysql_databases:
  - name: drupal
    encoding: utf8
    collation: utf8_general_ci
#  - name: drupal_two
#    encoding: utf8
#    collation: utf8_general_ci

mysql_users:
  - name: drupal
    host: "%"
    password: drupal
    priv: "drupal%.*:ALL"

mysql_wait_timeout: 28800
mysql_max_allowed_packet: 50M

# Set this to 'false' if you don't need to install drupal (using the drupal_*
# settings below), but instead copy down a database (e.g., using drush sql-sync).
drupal_install_site: false

# Drupal VM automatically creates a drush alias file in your ~/.drush folder if
# this variable is 'true'.
configure_drush_aliases: false

# This is required for front-end building tools.
nodejs_version: "8.x"
nodejs_npm_global_packages:
  - name: bower
  - name: gulp-cli
  - name: yarn
nodejs_install_npm_user: "{{ drupalvm_user }}"
npm_config_prefix: "/home/{{ drupalvm_user }}/.npm-global"
installed_extras: [adminer, selenium, drush, mailhog, memcached, nodejs, xdebug]

# PHP 7.1.
php_version: "7.1"
php_packages_extra:
  - "php{{ php_version }}-bz2"
  - "php{{ php_version }}-imagick"
  - imagemagick

# XDebug configuration.
php_xdebug_version: 2.5.0
# Change this value to 1 in order to enable xdebug by default.
php_xdebug_default_enable: 0
php_xdebug_coverage_enable: 0
php_xdebug_cli_disable: yes
php_xdebug_remote_enable: 1
php_xdebug_remote_connect_back: 1
# Use PHPSTORM for PHPStorm, sublime.xdebug for Sublime Text.
php_xdebug_idekey: PHPSTORM
php_xdebug_max_nesting_level: 256
php_xdebug_remote_port: "9000"
php_memory_limit: "512M"
php_max_execution_time: 300

# Acquia Search defaults to 4.5.1.
# solr_version: "4.5.1"

post_provision_scripts:
#  - "../../../acquia/blt/scripts/drupal-vm/configure-solr.sh"
  - "../../../acquia/blt/scripts/drupal-vm/post-provision.php"
```

{% endcode %}

Once you have setup your DrupalVm config files. Configure your BLT configuration file to match your site specific variables

{% code title="project\_root/blt/blt.yml" %}

```yaml
project:
  machine_name: acsfdemo
  prefix: acsfdemo
  human_name: 'ACSF Demo'
  profile:
    name: lightning
  local:
    protocol: http
    hostname: 'local.${project.machine_name}.com'
git:
  default_branch: master
  remotes: {  }
deploy:
  tag_source: true
drush:
  aliases:
    remote: '${project.machine_name}.test'
    local: self
    ci: self
  default_alias: '${drush.aliases.local}'
modules: null
cloud:
  appId: <cloud api id>
command-hooks:
  frontend-reqs:
    dir: '${docroot}/themes/custom/acsfdemo'
    command: 'npm run install-tools'
  frontend-assets:
    dir: '${docroot}/themes/custom/acsfdemo'
    command: 'npm run build'
cm:
  core:
    install_from_config: true
simplesamlphp: true
disable-targets.tests.security.check.updates: true


```

{% endcode %}

You can then use BLT to setup your local Drupal VM  (warning: this can take some time based on internet speeds)

```
$ blt vm
```

* SSH into your vagrant environment.

```
$ vagrant ssh
```

### **Step Five**: Use BLT to create the necessary ACSF files&#x20;

Use the BLT ACSF recipe to create the files necessary for ACSF deployments&#x20;

```bash
blt recipes:acsf:init:all
```

This will create the following files & changes&#x20;

* sites.php

{% hint style="info" %}
Do not modify settings.php or sites.php. These files must match in order for sites to work on ACSF.&#x20;
{% endhint %}
