Skip to content

Commit 88b99ef

Browse files
authored
Merge pull request #135 from wunderio/feature/WNDR-399
WNDR-399: Update internal documentation
2 parents 529d4a9 + 776fab4 commit 88b99ef

6 files changed

Lines changed: 49 additions & 168 deletions

File tree

docs/anatomy_of_a_silta_project.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,10 @@ This file is actually not part of the repository, but gets mounted into the runn
158158
It loads the database credential and additional Silta-specific configuration. You don't need to modify it (you can't), but you need to make sure
159159
that it gets included from your settings.php.
160160

161-
### Lando configuration file
162-
This file is not actually needed to deploy a project to Silta, but it configures the project for
163-
usage in local developemnt environments with Lando. Silta doesn't specify how you should run your code locally, but Lando and Silta have compatible of working.
161+
### DDEV configuration file
162+
This file is not required to deploy a project to Silta, but it configures the project for use in local development environments with DDEV. Silta does not specify how you should run your code locally, but DDEV and Silta are compatible ways of working.
164163

165-
There is no plan to consolidate Silta and Lando, as they have very different requirements (for example Lando mounts the codebase as a volume, whereas Silta copies it into dedicated Docker images).
164+
There is no plan to consolidate Silta and DDEV, as they have very different requirements (for example, DDEV mounts the codebase as a volume, whereas Silta copies it into dedicated Docker images).
166165

167166
### phpcs.xml
168167
This file is also not required for Silta, but we use phpcs for validation by default.

docs/creating_a_new_project.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ title: Creating a new project
66

77
- Make a copy of Wunder's [drupal-project](https://github.com/wunderio/drupal-project), and push it as a new repository within the wunderio Github organisation.
88
- Setup your project:
9-
- Run your project locally with [lando](https://docs.devwithlando.io): `lando start` (follow local environment setup instructions at https://github.com/wunderio/drupal-project#setup)
10-
- Install composer dependencies with `lando composer install` and commit composer.lock and generated files in the `web` folder. If Drupal adds additional database credentials in settings.php, these should not be committed and can be discarded.
9+
- Run your project locally with [DDEV](https://docs.ddev.com/en/stable/): `ddev start` (follow local environment setup instructions at https://github.com/wunderio/drupal-project#setup)
10+
- Install composer dependencies with `ddev composer install` and commit composer.lock and generated files in the `web` folder. If Drupal adds additional database credentials in settings.php, these should not be committed and can be discarded.
1111
- Install javascript dependencies with `npm install` and commit the package-lock.json file.
12-
- Install Drupal with `lando drush site-install` and export the default configuration with `lando drush config-export`.
12+
- Install Drupal with `ddev drush site-install` / `ddev drush si` and export the default configuration with `ddev drush config-export` / `ddev drush cex`.
1313
- Log in to CircleCI with your Github credentials, select "wunderio" and [enable your project](https://circleci.com/add-projects/gh/wunderio).
1414
- Watch your project build, the CircleCI output has a link to your deployed environment.
1515

docs/migrating_existing_project.md

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,8 @@ title: Migrating an existing Drupal project
1717
```bash
1818
curl -s https://raw.githubusercontent.com/wunderio/silta/master/scripts/drupal-migrate.sh | bash
1919
```
20-
For Drupal 7 with composer.json run
21-
```bash
22-
curl -s https://raw.githubusercontent.com/wunderio/silta/master/scripts/drupal7-migrate.sh | bash
23-
```
24-
Please check [troubleshooting](troubleshooting.md) for other Drupal 7 cases
25-
26-
Migration script will create `.circleci/config.yml` file for CircleCI builds. You might need to adapt branch names or contexts.
2720

28-
**Important**
29-
Add this to silta.yml config if You use Drupal 7
30-
```yaml
31-
php:
32-
drupalCoreVersion: "7"
33-
```
21+
Migration script will create `.circleci/config.yml` file for CircleCI builds. You might need to adapt branch names or contexts.
3422

3523
1. Read through the output of the script and check for any instructions to perform manual steps.
3624

@@ -60,40 +48,4 @@ title: Migrating an existing Drupal project
6048
This is the _reference environment_ by default, meaning that new environments
6149
will be created with a copy of this content.
6250

63-
1. Congratulations, your project is now up and running! Please share any issues you had or ideas for improvements.
64-
65-
## Drupal 7 migration tips
66-
67-
### Project uses make file for builds
68-
Have something like this in .circleci/config.yml
69-
```yaml
70-
codebase-build:
71-
- run:
72-
name: Build from makefile
73-
command: |
74-
composer install
75-
vendor/drush/drush/drush make ~/project/drupal/conf/site.make ~/project/drupal/web/
76-
mkdir -p web/sites/all/modules
77-
cp -r code/modules/custom web/sites/all/modules/
78-
```
79-
80-
### Missing drush
81-
Add composer.json in Drupal folder
82-
```json
83-
{
84-
"require": {
85-
"drush/drush": "8.*"
86-
},
87-
"extra": {
88-
"installer-paths": {
89-
"web/": ["type:drupal-core"]
90-
}
91-
}
92-
}
93-
```
94-
95-
And then in .circleci/config.yml add
96-
```yaml
97-
command: |
98-
composer install
99-
```
51+
1. Congratulations, your project is now up and running! Please share any issues you had or ideas for improvements.

docs/troubleshooting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ Some known references are:
275275
- `composer.json` & `composer.lock`
276276
- `.dockerignore`
277277
- `.gitignore`
278-
- `.lando.yml`
278+
- `.ddev/config.yaml`
279279
- `grumphp.yml`
280280
- `phpcs.xml`
281281

scripts/drupal-migrate.sh

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,51 @@ echo "This script will convert your Drupal project to be compatible with Silta."
44
echo "Make sure you are in the git root of your project."
55

66
echo "Checking dependencies"
7+
if ! command -v git >/dev/null 2>&1; then
8+
echo "git not found. Please install git first."
9+
exit 1
10+
fi
11+
712
git --version
8-
composer --version
913

10-
if grep -q "drupal/core" "drupal/composer.json" ; then
11-
echo 'Drupal 8+ detected' ;
14+
if command -v composer >/dev/null 2>&1; then
15+
composer --version
16+
else
17+
echo "composer not found. Continuing, but some generated build steps may need composer."
18+
fi
19+
20+
drupal_root=""
21+
22+
if [ -f composer.json ] && grep -q "drupal/core" composer.json; then
23+
drupal_root="."
24+
elif [ -f drupal/composer.json ] && grep -q "drupal/core" drupal/composer.json; then
25+
drupal_root="drupal"
1226
else
13-
echo 'Unsupported Drupal version. Please follow documentation how to migrate projects' ;
14-
exit ;
27+
composer_path=$(find . -name composer.json -not -path "*vendor*" -not -path "*modules*" -not -path "*core*" -not -path "*test*" | head -n 1)
28+
if [ -n "$composer_path" ] && grep -q "drupal/core" "$composer_path"; then
29+
drupal_root=$(dirname "$composer_path")
30+
fi
31+
fi
32+
33+
if [ -z "$drupal_root" ]; then
34+
echo "Unsupported Drupal version or composer.json not found. Please follow documentation how to migrate projects"
35+
exit 1
1536
fi
1637

38+
echo "Drupal 8+ detected in $drupal_root"
39+
1740
mkdir -p .circleci
1841

19-
if [ -f drupal/composer.json ] && [ -f drupal/build.sh ]
42+
if [ -f "$drupal_root/composer.json" ] && [ -f "$drupal_root/build.sh" ]
2043
then
2144
echo "This looks like a D8 Wundertools project."
22-
drupal_root="drupal"
2345
echo "Adding Wunderools CircleCI configuration"
2446
curl -s https://raw.githubusercontent.com/wunderio/Wundertools/master/.circleci/config.yml > .circleci/config.yml
2547
else
2648
echo "Adding standard CircleCI configuration"
2749
curl -s https://raw.githubusercontent.com/wunderio/drupal-project/master/.circleci/config.yml > .circleci/config.yml
2850

29-
# Try to detect the default path
30-
composer_path=`find . -name composer.json -not -path "*vendor*" -not -path "*modules*" -not -path "*core*" -not -path "*test*"`
31-
drupal_root_guess=`dirname $composer_path`
51+
drupal_root_guess="$drupal_root"
3252

3353
while ! [[ $drupal_root ]] || ! [ -d $drupal_root ]
3454
do
@@ -46,7 +66,7 @@ else
4666
done
4767
fi
4868

49-
cd $drupal_root
69+
cd "$drupal_root"
5070

5171
echo "Adding Dockerfiles"
5272
mkdir -p silta
@@ -70,11 +90,11 @@ else
7090
echo "Your existing phpcs configuration was kept."
7191
fi
7292

73-
if [ ! -f .lando.yml ]; then
74-
echo "Adding our standard .lando.yml"
75-
curl -s https://raw.githubusercontent.com/wunderio/drupal-project/master/.lando.yml > .lando.yml
93+
if [ ! -f .ddev/config.yal ]; then
94+
echo "Adding our standard .ddev/config.yaml"
95+
curl -s https://raw.githubusercontent.com/wunderio/drupal-project/master/.ddev/config.yaml > .ddev/config.yaml
7696
else
77-
echo "Your existing lando configuration was kept."
97+
echo "Your existing DDEV configuration was kept."
7898
fi
7999

80100
if [ -f composer.json ]; then
@@ -90,18 +110,18 @@ else
90110
echo "You don't seem to be using composer, this is currently not supported out of the box."
91111
fi
92112

93-
if ! grep -q "settings.lando.php" web/sites/default/settings.php
113+
if ! grep -q "settings.ddev.php" web/sites/default/settings.php
94114
then
95115
echo '
96116
/**
97-
* Lando configuration overrides.
117+
* DDEV configuration overrides.
98118
*/
99-
if (getenv("LANDO_INFO") && file_exists($app_root . "/" . $site_path . "/settings.lando.php")) {
100-
include $app_root . "/" . $site_path . "/settings.lando.php";
119+
if (getenv("DDEV_INFO") && file_exists($app_root . "/" . $site_path . "/settings.ddev.php")) {
120+
include $app_root . "/" . $site_path . "/settings.ddev.php";
101121
}
102122
' >> web/sites/default/settings.php
103123
fi
104-
curl -s https://raw.githubusercontent.com/wunderio/drupal-project/master/web/sites/default/settings.lando.php > web/sites/default/settings.lando.php
124+
curl -s https://raw.githubusercontent.com/wunderio/drupal-project/master/web/sites/default/settings.php > web/sites/default/settings.php
105125

106126
echo "Updating settings.php"
107127
if ! grep -q "settings.silta.php" web/sites/default/settings.php

scripts/drupal7-migrate.sh

Lines changed: 0 additions & 90 deletions
This file was deleted.

0 commit comments

Comments
 (0)