This is Deeson's framework for developing headless applications.
You will need Node 10 and PHP installed globally on your development machine. Assuming you are using a Mac then these can be installed with brew install node php
Code deployed to firebase will run under node version 10. To ensure compatibility when running the frontend server locally you should also use node version 10. Yyou can use a node version manager such as nvm or n to switch to version 10.15.
You will also need yarn for node and composer for PHP.
If correctly setup then both which yarn
and which composer
should return a file path to an executable.
You will need the Deeson Docker Proxy running.
You will also need to set an exported bash environment variable for USE_DOCKER
which could be done in a local .env.
file in the project directory or as a global variable in your ~/.bash_profile
e.g.
echo "export USE_DOCKER=1" >> ~/.bash_profile
source ~/.bash_profile
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
git clone [email protected]/teamdeeson/headless-drupal
cd headless-drupal
cp .env.example .env
make
Executing make
will download the project dependencies locally then create a Drupal and node runtime environment inside Docker containers.
The frontend is then available at: https://headless-drupal.localhost
The Drupal backend CMS is available at: https://cms.headless-drupal.localhost
Executing make
will create an SQLite database in your project root (local.sqlite)
The frontend is then available at: https://localhost:3000
The Drupal backend CMS is available at: https://localhost:8888
Once installed, you use the following command to start the project without installing all the dependencies:
Eslint and Prettier have been added to this project.
For Eslint run
make lint
To test the project using Jest, use:
make test
This project uses firebase for deployments.
To deploy to firebase run
firebase deploy
The Drush command line tool is available for querying all the Drupal environments. This is done using Drush aliases (the @ bit in any Drush command). The aliases available are:
- @local - your local Drupal.
- @dev - the development installation of Drupal.
- @test - the pre-production (test) version of Drupal.
- @prod - the production version of Drupal.
To see the status of an environment you can use, for example, ./vendor/bin/drush @local status
.
As this is a lot of typing, it's recommended you create an alias for drush in your .bashrc
file, e.g. alias drush=./vendor/bin/drush
To see a list of all Drush commands you can use drush @local list
and to see more details about a specific command you can use drush @local help command
Note, to access environments other than your own will require SSH access to the servers they are hosted on.
To login to Drupal as the administrator you can use drush @local uli
To retrieve a database from a Drupal environment you can use drush @local sql-dump > db.sql
To then import that database you can use pv db.sql | drush @local sql-cli
(you may need to install the pv cli tool or use cat instead)
You can get command line access to the database on any environment using drush @local sql-cli
. Locally this is sqlite, on the servers this will be mysql.
- Deeson