Open geerlingguy opened 4 years ago
(And just leaving a note since @jonpugh highlighted it—you can use loops
in ansible with include_role
so you can run a role multiple times (e.g. geerlingguy.drupal
), once for each configured drupal site. We could maybe automate that with a new feature, and do the loop if a list is provided, otherwise default to the old style where there are independent vars for each site...)
Hi, I was hoping to get something similar up. I am hoping to create a headless/backend/data Drupal 8 site w/CiviCRM & its API pointed at the head/frontend/public D8 site with Drutopia. Any links? I tried building them in separate VMs but I accidentally used the same database name which broke both of them. After vagrant destroy on the CiviCRM VM, the Drutopia part started working again. In an effort to update the site, I used a drush cr cmd after vagrant ssh into the VM but it broke the site. Now, the site says site under maintenance even after I halted & vagrant up again. I haven't been able to restore. Please advise. Would these multi-site or multi-VM issues be solved with the 6.0 drupalvm? Thanks a bunch.
Hi,
I use multiple websites(Drupal 7, Drupal 8 - 9, other software like Mautic, Matomo, etc...) per one DrupalVM and so far it has worked with no problem. It's pretty simple to set it up.
Hope the bellow configuration helps somebody:
You need to allocate a bit more RAM, CPU and a lot more disk space.
# Memory and CPU to use for this VM.
vagrant_memory: 4048
vagrant_cpus: 4
# The web server software to use. Can be either 'apache' or 'nginx'.
drupalvm_webserver: nginx
# The database system to use. Can be either 'mysql' or 'pgsql'.
drupal_db_backend: mysql
Do not install any Drupal by default.
drupal_build_composer: false
drupal_install_site: false
# Nginx hosts. Each site will get a server entry using the configuration defined
# here. Set the 'is_php' property for document roots that contain PHP apps like
# Drupal.
nginx_server_names_hash_bucket_size: "1024"
nginx_hosts:
- server_name: "{{ drupal_domain }} www.{{ drupal_domain }}"
root: "{{ drupal_core_path }}"
is_php: true
- server_name: "local.drupal7.local"
root: "/var/www/drupal7/docroot"
is_php: true
template: "{{ config_dir }}/scripts/templates/nginx-vhost-d7.conf.j2"
extra_parameters: |
listen 443 ssl;
ssl_certificate /home/vagrant/drupal7.crt;
ssl_certificate_key /home/vagrant/drupal7.key;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
ssl_prefer_server_ciphers on;
ssl_verify_client off;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 30m;
proxy_ssl_server_name on;
proxy_ssl_session_reuse off;
proxy_buffering on;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
- server_name: "local.drupal8.local"
root: "/var/www/drupal8/docroot"
is_php: true
extra_parameters: |
listen 443 ssl;
ssl_certificate /home/vagrant/drupal8.crt;
ssl_certificate_key /home/vagrant/drupal8.key;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
ssl_prefer_server_ciphers on;
ssl_verify_client off;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 30m;
proxy_ssl_server_name on;
proxy_ssl_session_reuse off;
proxy_buffering on;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
For Drupal7 you need a different nginx template to have it installed properly. https://gist.github.com/lexsoft00/7d728dc5971fb066b40138e32e6fd9e6
For Drupal7 drush9 does not work so you need to install drush8 with composer
composer require drush/drush:8.x
Then you will be able to use it inside docroot folder
../vendor/bin/drush cc all
# MySQL databases and users.
mysql_databases:
- name: "{{ drupal_db_name }}"
encoding: utf8mb4
collation: utf8mb4_general_ci
- name: "drupal7"
encoding: utf8mb4
collation: utf8mb4_general_ci
- name: "drupal8"
encoding: utf8mb4
collation: utf8mb4_general_ci
mysql_users:
- name: "{{ drupal_db_user }}"
host: "%"
password: "{{ drupal_db_password }}"
priv: "{{ drupal_db_name }}.*:ALL"
- name: drupal7
host: "%"
password: drupal7
priv: "drupal7.*:ALL"
- name: drupal8
host: "%"
password: drupal8
priv: "drupal8.*:ALL"
# PHP Configuration. Currently-supported versions: 7.2, 7.3, 7.4.
# See version-specific notes: http://docs.drupalvm.com/en/latest/configurations/php/
php_version: "7.2"
php_install_recommends: no
php_memory_limit: "4096M"
php_display_errors: "On"
php_display_startup_errors: "On"
php_realpath_cache_size: "1024K"
php_sendmail_path: "/opt/mailhog/mhsendmail"
php_post_max_size: "100M"
php_opcache_enabled_in_ini: true
php_opcache_memory_consumption: "1024"
php_opcache_max_accelerated_files: 4096
php_max_input_vars: "4000"
php_packages_extra:
- php7.2-bcmath
- php7.2-zip
- php7.2-intl
# Drupal VM defaults to using PHP-FPM with either Apache or Nginx. If you wish
# to instead use Apache + mod_php with an Ubuntu base box, make sure you add
# libapache2-mod-php7.0 to `extra_packages` elsewhere in this config file.
php_enable_php_fpm: true
php_fpm_listen: "127.0.0.1:9000"
@lexsoft00 Thanks for sharing that. Just to clarify, you are using multiple instances on the same VM or multiple VMs on the same host/computer? (1) I am trying to have 2 D8 partitions, one with Drutopia (frontend/public/head) & the other with CiviCRM (backend/data/headless). Any tips on having those communicate well together (eg, what kind of API)? (2) Also, any ideas of what might have happened when I did the drush cr (clearing cache) in the VM that cause the site to break (now only saying "site under maintenance"). (3) Should I use DrupalVM 6 (will it improve or increase my problems? Thanks for the info.
Hi @NYCdude2
chmod -R 775 /var/www/frontend
and chmod -R 775 /var/www/backend
composer install
if you are missing files.There are other steps and packages that you could enable but they are well documented in http://docs.drupalvm.com/en/latest/ and this topic is related only to having multiple website instances in one single DrupalVM
@lexsoft00 We use Ubuntu 20 on our host & DrupalVM is defaulted to Ubuntu 18. Fixed the drush issue. Just needed toggle the "site under maintenance" button in admin module. Probably need the Drupal8/CivicRM/backend's API to point to the Drutopia/D8/frontend. Do you have any experience with headless systems? especially on your single DrupalVM instances? Thanks for your help.
Issue Type
Summary
Recently on the #drupal Slack instance, someone was asking about how to get multiple Drupal sites (each one with a separate codebase) configured (and ideally, installed automatically) in a Drupal VM instance.
We currently have a docs page for Drupal multisite, where you have one codebase, and multiple sites (e.g.
local.testone.com
,local.testtwo.com
) all pointed at that one codebase.But some people want to run multiple independent Drupal sites (e.g. one Drupal 7 site and one Drupal 8 site—or Drupal 8 and Drupal 9!) with separate codebases... and I realized the documentation for that is lacking.
I'd like to add a docs page for this use case (and cross-link it with the multisite page), and also maybe drop a YouTube video showing how this is done.