Add all files needed to bring up VM and run agaric.com locally

This commit is contained in:
benjamin melançon 2018-08-20 10:45:20 -04:00
parent 52c8b60bac
commit 4d2bc0ee24
742 changed files with 24037 additions and 0 deletions

View file

@ -0,0 +1,50 @@
Drupal VM's configuration is designed to work with RedHat and Debian-compatible operating systems. Therefore, if you switch the `vagrant_box` in `config.yml` to any compatible OS, Drupal VM and all it's configuration should _Just Work™_... but that's not always the case.
Currently-supported OSes are:
- Ubuntu 16.04 'Xenial' (default)
- Ubuntu 14.04 'Precise'
- RedHat Enterprise Linux / CentOS 7
- RedHat Enterprise Linux / CentOS 6 (limited support)
- Debian 9 'Stretch'
- Debian 8 'Jessie'
For certain OSes, there are a couple other caveats and tweaks you may need to perform to get things running smoothly—the main features and latest development is only guaranteed to work with the default OS as configured in `default.config.yml`.
Some other OSes should work, but are not regularly tested with Drupal VM, including Debian 8/Jessie (`debian/jessie64`) and Debian 7/Wheezy (`debian/wheezy64`).
## Ubuntu 16.04 Xenial LTS
Everything should work out of the box with Ubuntu 16.04.
## Ubuntu 14.04 Trusty LTS
Everything should work out of the box with Ubuntu 14.04.
## RedHat Enterprise Linux / CentOS 7
Everything should work out of the box with RHEL 7.
## RedHat Enterprise Linux / CentOS 6
- **Apache without FastCGI**: If you want to use Apache with CentOS 6 on Drupal VM, you will need to modify the syntax of your `apache_vhosts` and remove the `extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"` line from each one. Alternatively, you can use Nginx with the default configuration by setting `drupalvm_webserver: nginx` inside `config.yml`.
- **PHP OpCache**: PHP's OpCache (if you're using PHP > 5.5) requires the following setting to be configured in `config.yml` (see upstream bug: [CentOS (6) needs additional php-opcache package](https://github.com/geerlingguy/ansible-role-php/issues/39)):
```yaml
php_opcache_enabled_in_ini: false
```
- **Firewalld**: [Firewalld](http://www.firewalld.org/) is not available on CentOS 6, so the Drupal VM setting `firewall_disable_firewalld`, which defaults to `true`, must be overridden in `config.yml` and set to `false`:
```yaml
firewall_disable_firewalld: false
```
## Debian 9 Stretch
Everything should work out of the box with Debian 9.
## Debian 8 Jessie
Everything should work out of the box with Debian 8.

View file

@ -0,0 +1,28 @@
Since Drupal VM is built in a modular fashion, and the upstream Ansible Role that installs and configures MySQL is built in a way that works with any MySQL-compatible replacement, you can easily swap out MySQL for MariaDB.
The simplest way is to add the following lines after the `# MySQL Configuration.` line in `config.yml`:
```yaml
mysql_packages:
- mariadb-client
- mariadb-server
- python-mysqldb
```
This set of packages works out of the box with Ubuntu 14.04 as well as the default Ubuntu 16.04 installation that comes with Drupal VM.
Alternatively, if you want to use RedHat 7 or CentOS 7 instead of Ubuntu, you can set the following variables to install and configure MariaDB instead of MySQL:
```yaml
mysql_packages:
- mariadb
- mariadb-server
- mariadb-libs
- MySQL-python
- perl-DBD-MySQL
mysql_daemon: mariadb
mysql_socket: /var/lib/mysql/mysql.sock
mysql_log_error: /var/log/mariadb/mariadb.log
mysql_syslog_tag: mariadb
mysql_pid_file: /var/run/mariadb/mariadb.pid
```

View file

@ -0,0 +1,20 @@
By default, this VM is set up so you can manage MySQL databases on your own. The default root MySQL user credentials are `drupal` for username and password, but you can change the password via `config.yml` (changing the `drupal_db_password` variable). I use [Sequel Pro](http://www.sequelpro.com/) (macOS-only) to connect to and manage databases, and Drush to sync databases (sometimes I'll just do a dump and import, but Drush is usually quicker, and is easier to do over and over again when you need it).
## Connect using Adminer
If you have `adminer` listed as one of the `installed_extras` inside `config.yml`, you can use Adminer's web-based interface to interact with databases. With Drupal VM running, visit [http://adminer.drupalvm.test/](http://adminer.drupalvm.test/), and log in with `drupal` as the username and the password you set in `config.yml` (`drupal_db_password`). Leave the "Server" field blank. The "Database" field is optional.
More about how to use Adminer: [Adminer website](http://www.adminer.org/).
## Connect using Sequel Pro (or a similar client):
1. Use the SSH connection type.
2. Set the following options:
- MySQL Host: `127.0.0.1`
- Username: `drupal`
- Password: `drupal` (or the password configured in `config.yml`)
- SSH Host: `192.168.88.88` (or the IP configured in `config.yml`)
- SSH User: `vagrant`
- SSH Key: (browse to your `~/.vagrant.d/` folder and choose `insecure_private_key`)
You should be able to connect as the root user and add, manage, and remove databases and users.

View file

@ -0,0 +1,9 @@
Since Drupal VM is built in a modular fashion, you can swap out the database engine and use [PostgreSQL](https://www.postgresql.org/) instead of MySQL (as long as the version of Drupal you're using supports it!).
To switch from MySQL to PostgreSQL, switch the `drupal_db_backend` setting in your local `config.yml` to `pgsql`:
```yaml
drupal_db_backend: pgsql
```
For more PostgreSQL configuration options, see the [`geerlingguy.postgresql` Ansible role's README](https://github.com/geerlingguy/ansible-role-postgresql#readme).

View file

@ -0,0 +1,22 @@
Drupal VM defaults to PHP 7.1, but you can also install and use 5.6, 7.0 or 7.2.
## Ubuntu
Ondřej Surý's PPA for PHP is used to install PHP 7.1, but you can switch version by changing `php_version` inside `config.yml` to `"5.6"`, `"7.0"` or `"7.2"`.
If you're using Apache with `mod_php` you should also add `libapache2-mod-php5.6` or `libapache2-mod-php7.0` to the `extra_packages` list.
_Note: XHProf does currently not work with PHP 7.1+, make sure you don't have it listed in `installed_extras`._
## RedHat/CentOS 7
Remi's RPM repository is included with Drupal VM, and you can make the following changes to use it to install a different version of PHP than 7.1:
1. Make sure you've followed the directions for switching to CentOS 7 in the [use a different base OS](base-os.md) guide.
2. Change `php_version` inside `config.yml` to `"5.6"`, `"7.0"` or `"7.2"`.
## Using default distribution packages
If you want parity with your production environment and wish to install the default distribution packages, set `php_version: ''` inside your `config.yml` to avoid adding Remi's or Ondřej's repositories. Doing this will use the default packages set in the [`geerlingguy.php`](https://github.com/geerlingguy/ansible-role-php) Ansible role.
_Note: If you're using a base OS with a PHP version older than what's assumed in the `geerlingguy.php` role, you will also need to override some of the default variables set by that role in your `config.yml`. See the [`geerlingguy.php` Ansible role's README](https://github.com/geerlingguy/ansible-role-php-#readme) for more information._

View file

@ -0,0 +1,37 @@
Drupal VM's configuration works with multiple operating systems _and_ with multiple webservers. You can switch between Apache and Nginx (depending on which server you prefer) with ease. Apache is the webserver used out of the box.
You have complete control over all aspects of Apache VirtualHosts using the `apache_vhosts` configuration. A few simple examples are shown in `default.config.yml`, but this configuration can be much more complex.
See the examples included in the [`geerlingguy.apache` Ansible role's README](https://github.com/geerlingguy/ansible-role-apache#readme) for more info, as well as many other variables you can override to configure Apache exactly how you like it.
## Enable SSL Support with Apache
To enable SSL support for you virtual hosts you first need a certificate file. You can generate a self-signed certificate with a command like
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout example.key -out example.crt
_If you're using an actual production certificate you should of course **NOT** track it in git but transfer it to the VM before running `vagrant provision`_
Add the following to your `config.yml`:
```yaml
apache_vhosts_ssl:
- servername: "{{ drupal_domain }}"
documentroot: "{{ drupal_core_path }}"
certificate_file: "/vagrant/example.crt"
certificate_key_file: "/vagrant/example.key"
extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"
```
### Using Ubuntu's snakeoil certificate
If you are using Ubuntu as your base OS and you want to get started quickly with a local development environment you can use the snakeoil certificate that is already generated.
```yaml
apache_vhosts_ssl:
- servername: "{{ drupal_domain }}"
documentroot: "{{ drupal_core_path }}"
certificate_file: "/etc/ssl/certs/ssl-cert-snakeoil.pem"
certificate_key_file: "/etc/ssl/private/ssl-cert-snakeoil.key"
extra_parameters: "{{ apache_vhost_php_fpm_parameters }}"
```

View file

@ -0,0 +1,81 @@
To use Nginx instead of Apache, change the `drupalvm_webserver` variable inside your customized `config.yml`, from `apache` to `nginx`.
Because Nginx server directives behave a little differently than Apache's VirtualHosts, Drupal VM includes a custom Drupal-optimized Nginx server block configuration, and you can control all the servers ('virtual hosts') Nginx will run using the `nginx_vhosts` configuration. A few simple examples are shown in `default.config.yml`, but you have some extra flexibility if you need it. See the `nginx-vhost.conf.j2` template for more information.
Also, see the examples included in the [`geerlingguy.nginx` Ansible role's README](https://github.com/geerlingguy/ansible-role-nginx#readme) for more info, as well as many other variables you can override to configure Nginx exactly how you like it.
_Note: if you're using php-fpm, you may want to reflect your use of nginx by setting `php_fpm_pool_user` and `php_fpm_pool_group` in your `config.yml`._
## Enable SSL Support with Nginx
To enable SSL support for you virtual hosts you first need a certificate file. See the same section under the [Apache documentation](webservers-apache.md#enable-ssl-support-with-apache) for how to generate a self-signed certficiate.
Modify your nginx host configuration by adding the following `extra_parameters` to the first entry in `nginx_vhosts`:
```yaml
- server_name: "{{ drupal_domain }} www.{{ drupal_domain }}"
root: "{{ drupal_core_path }}"
is_php: true
extra_parameters: |
listen 443 ssl;
ssl_certificate /vagrant/example.crt;
ssl_certificate_key /vagrant/example.key;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
```
### Using Ubuntu's snakeoil certificate
If you are using Ubuntu as your base OS and you want to get started quickly with a local development environment you can use the snakeoil certificate that is already generated.
```yaml
- server_name: "{{ drupal_domain }} www.{{ drupal_domain }}"
root: "{{ drupal_core_path }}"
is_php: true
extra_parameters: |
listen 443 ssl;
ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;
```
## Customizing server block configuration
If you can't customize via variables because an option isn't exposed, you can override the template used to generate the the virtualhost configuration file.
```yaml
nginx_vhost_template: "{{ config_dir }}/templates/nginx-vhost.conf.j2"
```
You can either copy and modify the provided `nginx-vhost.conf.j2` template, or extend it and use [template inheritace](http://jinja.pocoo.org/docs/2.9/templates/#template-inheritance) to override the specific template block you need to change.
_If you extend Drupal VM's provided base template, the path referenced should to be relative to playbook.yml._
```
{% extends 'templates/nginx-vhost.conf.j2' %}
{% block location_primary %}
location / {
try_files $uri @rewrite; # For Drupal <= 6
}
{% endblock %}
{% block location_image_styles %}
location ~ ^/sites/.*/files/imagecache/ {
try_files $uri @rewrite; # For Drupal <= 6
}
{% endblock %}
```
If you need to append or prepend content to a block, you can use the `{{ super() }}` Jinja2 function to return the original block content from the base template.
```
{% block location_deny %}
{{ super() }}
location ~* \.(txt|log)$ {
allow 192.168.0.0/16;
deny all;
}
{% endblock %}
```