-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73937b3
commit 101c8a1
Showing
23 changed files
with
12,662 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.git | ||
vendor | ||
web/sites/default/files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Local project name - setting this here aligns container names with routes | ||
COMPOSE_PROJECT_NAME=drupal-cachebackend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Drupal test routine | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'dev' | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
test-suite: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: "0" | ||
- name: install Lando | ||
run: | | ||
wget https://files.lando.dev/installer/lando-x64-stable.deb | ||
sudo dpkg --ignore-depends=docker-ce -i lando-x64-stable.deb | ||
- name: Report versions | ||
run: | | ||
docker version | ||
docker compose version | ||
lando version | ||
node -v | ||
yarn -v | ||
- name: get user ids | ||
run: | | ||
ls -al . | ||
whoami | ||
id | ||
id -u | ||
id -g | ||
getent group $(id -g) | ||
groups | ||
- name: Update codebase to follow CI configuration | ||
run: | | ||
sed -i -e "/###/d" docker-compose.yml | ||
- name: Pull all images | ||
run: | | ||
docker compose pull --ignore-pull-failures | ||
- name: Install test harness | ||
run: | | ||
yarn add leia-parser mocha chai@4 command-line-test | ||
- name: Generate test files | ||
run: | | ||
yarn leia "TESTING*.md" test -r 2 -s 'Start up tests' -t 'Verification commands' -c 'Destroy tests' --split-file | ||
- name: Run docker compose tests | ||
run: | | ||
yarn mocha --timeout 900000 test/*compose*.func.js | ||
# - name: Run Lando tests | ||
# timeout-minutes: 10 | ||
# continue-on-error: true | ||
# run: | | ||
# yq e -i '.services.cli.overrides.environment.LANDO_WEBROOT_USER = "runner"' .lando.yml | ||
# yq e -i '.services.cli.overrides.environment.LANDO_WEBROOT_GROUP = "docker"' .lando.yml | ||
# yq e -i '.services.php.overrides.environment.LANDO_WEBROOT_USER = "runner"' .lando.yml | ||
# yq e -i '.services.php.overrides.environment.LANDO_WEBROOT_GROUP = "docker"' .lando.yml | ||
# yarn mocha --timeout 900000 test/*lando*.func.js | ||
# - name: Show Lando logs | ||
# continue-on-error: true | ||
# run: | | ||
# docker-compose -p drupalcachebackend logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Sync main branch | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
jobs: | ||
sync-branch: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Merge main -> php81 | ||
uses: devmasx/merge-branch@master | ||
with: | ||
type: now | ||
from_branch: main | ||
target_branch: php81 | ||
github_token: ${{ github.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Ignore directories generated by Composer | ||
/.drush-lock-update | ||
/drush/Commands/contrib/ | ||
/drush/sites/lagoon.site.yml | ||
/vendor/ | ||
/web | ||
|
||
# Ignore directories generated by yarn | ||
/node_modules/ | ||
/test/ | ||
/yarn.lock | ||
/package.json | ||
|
||
# Ignore Drupal's file directory | ||
/web/sites/*/files/ | ||
|
||
# Ingore files that are only for the current local environment | ||
web/sites/*/settings.local.php | ||
web/sites/*/services.local.yml | ||
|
||
# Ignore SimpleTest multi-site environment. | ||
web/sites/simpletest | ||
|
||
# Ignore files generated by PhpStorm | ||
/.idea/ | ||
/.editorconfig | ||
/.gitattributes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
docker-compose-yaml: docker-compose.yml | ||
|
||
project: drupal-cachebackend | ||
|
||
tasks: | ||
pre-rollout: | ||
# - run: | ||
# name: drush sql-dump | ||
# # Takes a pre-rollout backup of production sites only. | ||
# command: mkdir -p /app/web/sites/default/files/private/ && drush sql-dump --ordered-dump --gzip --result-file=/app/web/sites/default/files/private/pre-deploy-dump.sql.gz || true | ||
# service: cli | ||
# when: LAGOON_ENVIRONMENT_TYPE=="production" | ||
|
||
post-rollout: | ||
- run: | ||
name: drush updb | ||
# This will only run if the database exists. | ||
command: | | ||
if [[ $(drush status --field=Database) == "Connected" ]]; then drush -y updb; fi | ||
service: cli | ||
# - run: | ||
# name: drush cim | ||
# # Enable once config sync has been setup. | ||
# command: drush -y cim | ||
# service: cli | ||
- run: | ||
name: drush cr | ||
command: drush -y cr | ||
service: cli | ||
|
||
environments: | ||
main: | ||
cronjobs: | ||
- name: drush hourly cron | ||
schedule: "M * * * *" | ||
command: drush cron | ||
service: cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name: drupal-cachebackend | ||
recipe: lagoon | ||
config: | ||
flavor: drupal | ||
build: | ||
- composer install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,128 @@ | ||
# drupal-example-simple | ||
# Base template for Drupal projects hosted on Lagoon | ||
|
||
This template includes everything necessary to run on [Lagoon](https://www.github.com/uselagoon/lagoon) (in both the local development environments or on hosted Lagoon clusters.) | ||
|
||
This project template should provide a kickstart for managing your site | ||
dependencies with [Composer](https://getcomposer.org/). It is based on the [original Drupal Composer Template](https://github.com/drupal-composer/drupal-project), | ||
|
||
## Included Services | ||
|
||
This example contains the following services: | ||
* Drupal 10.x | ||
* PHP 8 | ||
* NGINX | ||
* MariaDB 10.11 | ||
|
||
To see similar projects with additional services, please visit https://github.com/lagoon-examples and to find out more about the services, please visit the documentation at https://docs.lagoon.sh/lagoon | ||
|
||
## Requirements | ||
|
||
* [docker](https://docs.docker.com/install/) | ||
* [pygmy-go](https://www.github.com/pygmystack/pygmy) | ||
|
||
**OR** | ||
|
||
* [Lando](https://docs.lando.dev/basics/installation.html#system-requirements) | ||
|
||
## Local environment setup - pygmy- | ||
|
||
1. Checkout this project repo and confirm the path is in Docker's file sharing config - https://docs.docker.com/docker-for-mac/#file-sharing | ||
|
||
```bash | ||
git clone https://github.com/lagoon-examples/drupal-cachebackend.git drupal-cachebackend && cd $_ | ||
``` | ||
|
||
2. Make sure you don't have anything running on port 80 on the host machine (like a web server) then run `pygmy-go up` | ||
3. Build and start the build images: | ||
```bash | ||
docker-compose up -d | ||
docker-compose exec cli composer install | ||
``` | ||
4. Visit the new site @ `http://drupal-cachebackend.docker.amazee.io` | ||
* If any steps fail, you're safe to rerun from any point. | ||
Starting again from the beginning will just reconfirm the changes. | ||
|
||
## Local environment setup - Lando | ||
|
||
This repository is set up with a `.lando.yml` file, which allows you to use Lando instead of pygmy for your local development environment. | ||
|
||
1. [Install Lando](https://docs.lando.dev/basics/installation.html#system-requirements). | ||
|
||
2. Checkout the project repo and confirm the path is in Docker's file sharing config - https://docs.docker.com/docker-for-mac/#file-sharing | ||
```bash | ||
git clone https://github.com/lagoon-examples/drupal-cachebackend.git drupal-cachebackend && cd $_ | ||
``` | ||
3. Make sure you have pygmy-go stopped. Run `pygmy stop` to be sure. | ||
4. We already have a Lando file in this repository, so we just need to run the following command to get Lando up: | ||
```bash | ||
lando start | ||
``` | ||
5. Install your Drupal site with Drush: | ||
```bash | ||
lando drush si -y | ||
``` | ||
6. Visit the new site @ `http://drupal-cachebackend.lndo.site` | ||
7. For more information on how to configure your site, check out the [documentation](https://docs.lando.dev/config/lagoon.html). | ||
## What does the template do? | ||
When installing the given `composer.json` some tasks are taken care of: | ||
* Drupal will be installed in the `web`-directory. | ||
* Autoloader is implemented to use the generated composer autoloader in `vendor/autoload.php`, | ||
instead of the one provided by Drupal (`web/vendor/autoload.php`). | ||
* Modules (packages of type `drupal-module`) will be placed in `web/modules/contrib/` | ||
* Themes (packages of type `drupal-theme`) will be placed in `web/themes/contrib/` | ||
* Profiles (packages of type `drupal-profile`) will be placed in `web/profiles/contrib/` | ||
* Creates the `web/sites/default/files`-directory. | ||
* Latest version of [Drush](https://www.drush.org/latest/) is installed locally for use at `vendor/bin/drush`. | ||
* Latest version of [Drupal Console](http://www.drupalconsole.com) is installed locally for use at `vendor/bin/drupal`. | ||
* The correct scaffolding for your Drupal core version is installed, along with Lagoon-specific scaffolding from [amazeeio/drupal-integrations](https://github.com/amazeeio/drupal-integrations) project and the `assets/` directory in this repo. For more information see [drupal/core-composer-scaffold](https://github.com/drupal/core-composer-scaffold) | ||
## Updating Drupal Core | ||
Follow the steps below to update your core files. Scaffolding is managed by Drupal core. See the `assets/` directory for more information. | ||
1. Run `composer update drupal/core-recommended drupal/core-dev-pinned --with-dependencies` | ||
## FAQ | ||
### Should I commit the contrib modules I download? | ||
Composer recommends **no**. They provide [argumentation against but also | ||
workarounds if a project decides to do it anyway](https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md). | ||
### How can I apply patches to downloaded modules? | ||
If you need to apply patches (depending on the project being modified, a pull | ||
request is often a better solution), you can do so with the | ||
[composer-patches](https://github.com/cweagans/composer-patches) plugin. | ||
To add a patch to drupal module foobar insert the patches section in the extra | ||
section of composer.json: | ||
```json | ||
"extra": { | ||
"patches": { | ||
"drupal/foobar": { | ||
"Patch description": "URL to patch" | ||
} | ||
} | ||
} | ||
``` | ||
### What are the "TESTING" files in this repo? | ||
These files are used by Github actions to run a basic suite of tests specific to this template. They utilise the excellent [Leia](https://github.com/lando/leia) tool to generate a set of mocha-compatible tests. Have a look through the markdown for both files, and you will see what they do. These tests can also be generated and run locally. |
Oops, something went wrong.