drupal-vm icon indicating copy to clipboard operation
drupal-vm copied to clipboard

Multiple sites in different folders

Open artatum opened this issue 8 years ago • 1 comments

Issue Type

  • Support Request

Summary

Hi, Could you post a config.yml sample with settings for two websites plz ? For example, I wonder how to create a new directory for each website under /web. I tried this for adding a second website hon_stage, with its own database hon_stage and folder /hon_stage : apache_vhosts:

  • servername: "{{ drupal_domain }}" serveralias: "www.{{ drupal_domain }}" documentroot: "{{ drupal_core_path }}/vanilla" extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

  • servername: "hon_stage.com" serveralias: "www.hon_stage.com" documentroot: "{{ drupal_core_path }}/hon_stage" extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"

  • servername: "adminer.{{ vagrant_hostname }}" documentroot: "{{ adminer_install_dir }}" extra_parameters: "{{ apache_vhost_php_fpm_parameters }}" ...

mysql_databases:

  • name: "{{ drupal_db_name }}" encoding: utf8mb4 collation: utf8mb4_general_ci mysql_databases:
  • name: "hon_stage" encoding: utf8mb4 collation: utf8mb4_general_ci ... But none of the directories were created, and the database hon_stage is missing also. Trying to create this db manually in adminer brings : Access denied for user 'drupal'@'%' to database 'hon_stage'... No luck What is wrong ? How can we set this ? A full sample config.yml would be really cool...

artatum avatar Dec 09 '17 12:12 artatum

@artatum - Please see the documentation on multisite here: http://docs.drupalvm.com/en/latest/deployment/multisite/

Basically, for multiple codebases, instead of using the same docroot for each site, you'd customize the docroot (in apache or nginx vhost settings), and you'd also need to share the different folders into the VM, so you'd need to also modify:

vagrant_synced_folders:
  # The first synced folder will be used for the default Drupal installation, if
  # any of the build_* settings are 'true'. By default the folder is set to
  # the drupal-vm folder.
  - local_path: /my/first/codebase/here
    destination: /var/www/first_site
    type: nfs
  - local_path: /my/second/codebase/here
    destination: /var/www/second_site
    type: nfs

Then you'd use /var/www/first_site for the first site vhost documentroot, etc.

geerlingguy avatar Dec 22 '17 22:12 geerlingguy