Run prettier on all *.md files
```
prettier '{app,source}/**/**.md' --write
```
This commit is contained in:
parent
a3ceeaf0f3
commit
85a10c545b
170 changed files with 5127 additions and 2282 deletions
|
|
@ -1,7 +1,10 @@
|
|||
---
|
||||
title: Running Drupal 8.8 with the Symfony Local Server
|
||||
date: ~
|
||||
tags: [drupal, drupal-8, symfony]
|
||||
tags:
|
||||
- drupal
|
||||
- drupal-8
|
||||
- symfony
|
||||
draft: true
|
||||
---
|
||||
|
||||
|
|
@ -11,7 +14,8 @@ https://symfony.com/doc/current/setup/symfony_server.html
|
|||
|
||||
## Installation
|
||||
|
||||
The Symfony server is bundled as part of the `symfony` binary that is available to download from <https://symfony.com/download>.
|
||||
The Symfony server is bundled as part of the `symfony` binary that is available
|
||||
to download from <https://symfony.com/download>.
|
||||
|
||||
To install it, run this command:
|
||||
|
||||
|
|
@ -23,17 +27,24 @@ It works with any project, not just Symfony.
|
|||
|
||||
## Different PHP Versions
|
||||
|
||||
One of the most useful features of the Symfony server is that it [supports multiple versions of PHP](https://symfony.com/doc/current/setup/symfony_server.html#different-php-settings-per-project) if you have them installed (e.g. via Homebrew on macOS), and a different version can be selected per directory.
|
||||
One of the most useful features of the Symfony server is that it
|
||||
[supports multiple versions of PHP](https://symfony.com/doc/current/setup/symfony_server.html#different-php-settings-per-project)
|
||||
if you have them installed (e.g. via Homebrew on macOS), and a different version
|
||||
can be selected per directory.
|
||||
|
||||
This is done simply by adding a `.php-version` file to the root of the project that contains the PHP version to use - e.g. `7.3`.
|
||||
This is done simply by adding a `.php-version` file to the root of the project
|
||||
that contains the PHP version to use - e.g. `7.3`.
|
||||
|
||||
Next time the server is started, this file will be read and the correct version of PHP will be used.
|
||||
Next time the server is started, this file will be read and the correct version
|
||||
of PHP will be used.
|
||||
|
||||
[Further PHP customisations can be made per project](https://symfony.com/doc/current/setup/symfony_server.html#overriding-php-config-options-per-project) by adding a `php.ini` file.
|
||||
[Further PHP customisations can be made per project](https://symfony.com/doc/current/setup/symfony_server.html#overriding-php-config-options-per-project)
|
||||
by adding a `php.ini` file.
|
||||
|
||||
## Securing Sites Locally
|
||||
|
||||
The Symfony server allows for serving sites via HTTPS by installing its own local certificate authority.
|
||||
The Symfony server allows for serving sites via HTTPS by installing its own
|
||||
local certificate authority.
|
||||
|
||||
To install it, run this command:
|
||||
|
||||
|
|
@ -43,13 +54,16 @@ symfony server:ca:install
|
|||
|
||||
Any HTTP traffic will be automatically redirected to HTTPS.
|
||||
|
||||
If you then need to run a site with just HTTP, add the `--no-tls` option to the `server:start` command.
|
||||
If you then need to run a site with just HTTP, add the `--no-tls` option to the
|
||||
`server:start` command.
|
||||
|
||||
## Adding Databases with Docker
|
||||
|
||||
The Symfony server has an integration with Docker for providing extra services - such as databases that we’ll need for Drupal.
|
||||
The Symfony server has an integration with Docker for providing extra services -
|
||||
such as databases that we’ll need for Drupal.
|
||||
|
||||
This is my `docker-compose.yaml` file which defines a `database` service for MySQL:
|
||||
This is my `docker-compose.yaml` file which defines a `database` service for
|
||||
MySQL:
|
||||
|
||||
```yaml
|
||||
version: '2.1'
|
||||
|
|
@ -67,9 +81,12 @@ volumes:
|
|||
mysql-data:
|
||||
```
|
||||
|
||||
Because port 3306 is exposed, the server recognises it as a database service and automatically creates environment variables prefixed with `DATABASE_`.
|
||||
|
||||
A list of all the environment variables can be seen by running `symfony var:export` (add `| tr " " "\n"` if you want to view each one on a new line):
|
||||
Because port 3306 is exposed, the server recognises it as a database service and
|
||||
automatically creates environment variables prefixed with `DATABASE_`.
|
||||
|
||||
A list of all the environment variables can be seen by running
|
||||
`symfony var:export` (add `| tr " " "\n"` if you want to view each one on a new
|
||||
line):
|
||||
|
||||
```dotenv
|
||||
DATABASE_DATABASE=main
|
||||
|
|
@ -87,7 +104,8 @@ SYMFONY_TUNNEL=
|
|||
SYMFONY_TUNNEL_ENV=
|
||||
```
|
||||
|
||||
Now I can use these environment variables within my `settings.php` file to allow Drupal to connect to the database service.
|
||||
Now I can use these environment variables within my `settings.php` file to allow
|
||||
Drupal to connect to the database service.
|
||||
|
||||
```php
|
||||
// web/sites/default/settings.php
|
||||
|
|
@ -117,7 +135,8 @@ if ($_SERVER['SYMFONY_DOCKER_ENV']) {
|
|||
|
||||
`symfony php ../vendor/bin/drush st`
|
||||
|
||||
This will ensure that the correct PHP version and configuration is used, and that the appropriate environment variables are available.
|
||||
This will ensure that the correct PHP version and configuration is used, and
|
||||
that the appropriate environment variables are available.
|
||||
|
||||
## Custom Domain Names
|
||||
|
||||
|
|
@ -132,7 +151,8 @@ cp web/sites/default web/sites/umami
|
|||
`symfony proxy:domain:attach umami`
|
||||
|
||||
> The proxy is now configured with the following domains for this directory:
|
||||
> * http://umami.wip
|
||||
>
|
||||
> - http://umami.wip
|
||||
|
||||
```php
|
||||
// web/sites/sites.php
|
||||
|
|
@ -150,7 +170,6 @@ labels:
|
|||
symfony-server-drupal-test_database_1
|
||||
symfony-server-drupal-test_database_umami_1
|
||||
|
||||
|
||||
```bash
|
||||
symfony php ../vendor/bin/drush si demo_umami \
|
||||
-l umami \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue