Getting started for local development
Flightdeck has been extensively tested on macOS and Linux, and should work on Windows without issue.
Installing Docker
Flightdeck is based on Docker. Docker allows you to spin up multiple, lightweight virtual environments on your system called “containers”. You can find out more about containers on training.docker.org.
For macOS and Windows:
- Download Docker for macOS or Docker for Windows.
- Run the installer and follow on-screen instructions.
- Restart your computer when finished.
For Linux:
- Consult your distribution’s documentation for the proper installation method.
Adding Flightdeck to your project
When using Flightdeck, it’s best to add it permanently to your project repository. That way, anyone working on that project has access to the some stack of containers.
- Reorganize your repository such that the site docroot is in a subdirectory of your project root. This is assumed to be
src
by default:/path/to/my_project ├── .git/ └── src/ ├── core/ └── index.php
- Using the sample project, add
db-backups/.gitignore
to your project./path/to/my_project ├── .git/ ├── db-backups/ │ └── .gitignore └── src/ ├── core/ └── index.php
- Using the sample project, copy the
docker-compose.yml
,docker-compose.override.yml.example
, andflight-deck.yml
into the root of your project./path/to/my_project ├── .git/ ├── db-backups/ │ └── .gitignore ├── docker-compose.yml ├── docker-compose.override.yml.example ├── flight-deck.yml └── src/ ├── core/ └── index.php
- If using Solr, create the
solr-conf/yourSolrVersion
to the root of your project to hold Solr core configs:/path/to/my_project ├── .git/ ├── db-backups/ │ └── .gitignore ├── docker-compose.yml ├── docker-compose.override.yml.example ├── flight-deck.yml ├── solr-conf │ └── 8.x └── src/ ├── core/ └── index.php
- For Drupal sites, create the
config/
directory:/path/to/my_project ├── .git/ ├── db-backups/ │ └── .gitignore ├── config/ │ └── .gitkeep ├── docker-compose.yml ├── docker-compose.override.yml.example ├── flight-deck.yml └── src/ ├── core/ └── index.php
Using Flightdeck outside your site repo
Some hosting providers such as Pantheon, prefer that your site docroot and repository root are the same directory. In those cases, you cannot install Flightdeck as described above. In those cases, you can use Flightdeck as a separate project.
- Set up the directory structure as laid out above, minus the
src
directory. - Clone your site repo into a directory named
source
in your Flightdeck directory. - Alternatively, create a symlink named
src
in your Flightdeck directory to your site repository. - Add
src
to the Flightdeck.gitignore
, if persisting it to a repository.
Database connection
As a set of Docker containers, the database connection information for your site is somewhat different than you may expect. While all the containers are running on your host OS and are accessible via localhost
, the site sees itself on a server named web
, and the database is on another server named db
. As a result, we need to configure the site to access the database remotely.
Configuration for Drupal
If Drupal is already installed:
- Use your text editor of choice to open you
settings.php
orsettings.local.php
file. - Update the $database variable to the following. This will instruct Drupal to use the MySQL login specified in the
.env
file:$databases['default']['default'] = array( 'database' => getenv('MYSQL_NAME'), 'username' => getenv('MYSQL_USER'), 'password' => getenv('MYSQL_PASS'), 'host' => 'db', 'port' => '', 'driver' => 'mysql', 'prefix' => '', );
- Save the file.
If Drupal is not installed:
- Open the
docker-compose.yml
file. Note the values ofMYSQL_NAME
,MYSQL_USER
, andMYSQL_PASS
. - Start Flightdeck using
docker-compose
:docker-compose up -d
- Begin the installation process as normal.
- On the Database configuration page, enter the Database name, username, and password as specified in the
docker-compose.yml
file. - Open Advanced Options. For the Host enter
db
. - Continue with the installation.
Create a URL alias
Accessing Flightdeck using localhost
poses a number of problems. The biggest of which is that it’s a special domain name, which creates problems for complex CMSes like Drupal. Many sites also rely on .htaccess
rewrite rules to redirect traffic to an HTTPS or www.
-prefixed domain.
To solve these issues, it’s highly recommended to create a URL alias.
On Linux and macOS:
- Open a terminal emulator.
- Open the
/etc/hosts
file using your favorite text editor. Be sure to usesudo
to run the command as the root user:sudo vi /etc/hosts
- Notice there are two columns of text, one is IP address, the other is host names.
- At the end of the file, enter a new row. Use
127.0.0.1
as the IP address, anddocker.test
as the hostname:127.0.0.1 docker.test
- Check the file for typos, particularly “docker.text”.
On Windows:
- Using the Start Menu, locate the Notepad application.
- Right click Notepad, and select Run as administrator.
- Open the following file for editing:
C:\Windows\System32\Drivers\etc\hosts
- Notice there are two columns of text, one is IP address, the other is host names.
- At the end of the file, enter a new row. Use
127.0.0.1
as the IP address, anddocker.test
as the hostname:127.0.0.1 docker.test
- Check the file for typos, particularly “docker.text”.
You only need to create the docker.test
alias once, no matter how many Flightdeck-powered projects you have on your system. You may also choose to add a different URL alias such as ‘docker.test’, ‘[your_site_name].test’, and so on.
Using Flightdeck
See using.
XDebug configuration
See xdebug.