Skip to content

Commit

Permalink
#2013: Split up pantheon example for test speed gainz
Browse files Browse the repository at this point in the history
  • Loading branch information
pirog committed Mar 6, 2020
1 parent e9863c2 commit f9831a1
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 100 deletions.
1 change: 1 addition & 0 deletions examples/pantheon-drupal7/.gitignore
@@ -0,0 +1 @@
drupal7
102 changes: 3 additions & 99 deletions examples/pantheon/README.md → examples/pantheon-drupal7/README.md
@@ -1,9 +1,9 @@
Pantheon Example
================
Pantheon Druapl 7 Example
=========================

This example exists primarily to test the following documentation:

* [Pantheon Recipe](https://docs.devwithlando.io/tutorials/pantheon.html)
* [Pantheon Recipe - Drupal 7](https://docs.devwithlando.io/tutorials/pantheon.html)

**Note that you will need to replace (or export) `$PANTHEON_MACHINE_TOKEN` and `--pantheon-site` to values that make sense for you.**

Expand All @@ -16,26 +16,14 @@ Run the following commands to get up and running with this example.
# Should poweroff
lando poweroff

# Should initialize the lando pantheon test wordpress site
rm -rf wordpress && mkdir -p wordpress && cd wordpress
lando init --source pantheon --pantheon-auth "$PANTHEON_MACHINE_TOKEN" --pantheon-site landobot-wordpress

# Should initialize the lando pantheon test drupal7 site
rm -rf drupal7 && mkdir -p drupal7 && cd drupal7
lando init --source pantheon --pantheon-auth "$PANTHEON_MACHINE_TOKEN" --pantheon-site landobot-drupal7

# Should start up our wordpress site successfully
cd wordpress
lando start

# Should start up our drupal7 site successfully
cd drupal7
lando start

# Should pull down database and files for our wordpress site
cd wordpress
lando pull --code none --database dev --files dev

# Should pull down database and files for our drupal7 site
cd drupal7
lando pull --code none --database dev --files dev --rsync
Expand All @@ -47,75 +35,6 @@ Verification commands
Run the following commands to validate things are rolling as they should.

```bash
# Should be able to bootstrap wordpress
cd wordpress/web
lando wp eval "phpinfo();"

# Should have wp cli
cd wordpress
lando wp cli version

# Should use custom webroot when set in pantheon.yml
cd wordpress
lando ssh -s appserver -c "curl -L http://appserver_nginx" | grep "WordPress for Lando"
lando ssh -s appserver -c "curl -kL https://appserver_nginx" | grep "WordPress for Lando"
lando ssh -s appserver -c "env" | grep "LANDO_WEBROOT=/app/web"

# Should set /var/www/.wp-cli/config.yml with LANDO_WEBROOT as PATH
cd wordpress
lando ssh -s appserver -c "cat /var/www/.wp-cli/config.yml | grep path | grep /app/web"

# Should have terminus
cd wordpress
lando terminus -V

# Should be logged in
cd wordpress
lando terminus auth:whoami | grep landobot@devwithlando.io

# Should use custom php version if set in pantheon.yml
cd wordpress
lando php -v | grep "PHP 7.3"

# Should set the correct wordpress specific pantheon environment
cd wordpress
lando ssh -c "env" | grep FRAMEWORK | grep wordpress
lando ssh -c "env" | grep FILEMOUNT | grep "wp-content/uploads"

# Should disable edge, index or cache containers and tools when specified
docker ps --filter label=com.docker.compose.project=landobotwordpress | grep landobotwordpress_appserver_nginx_1
docker ps --filter label=com.docker.compose.project=landobotwordpress | grep landobotwordpress_appserver_1
docker ps --filter label=com.docker.compose.project=landobotwordpress | grep landobotwordpress_database_1
docker ps --filter label=com.docker.compose.project=landobotwordpress | grep landobotwordpress_cache_1 || echo $? | grep 1
docker ps --filter label=com.docker.compose.project=landobotwordpress | grep landobotwordpress_index_1 || echo $? | grep 1
docker ps --filter label=com.docker.compose.project=landobotwordpress | grep landobotwordpress_edge_1 || echo $? | grep 1

# Should still be logged in even after a rebuild
cd wordpress
lando terminus auth:whoami | grep landobot@devwithlando.io
lando rebuild -y
lando terminus auth:whoami | grep landobot@devwithlando.io

# Should serve proxy from nginx
cd wordpress
curl -LI http://landobot-wordress.lndo.site | grep Via || echo $? | grep 1

# Should have phantomjs 2.1.1 installed at /srv/bin/phantomjs-2.1.1
cd wordpress
lando ssh -s appserver -c "/srv/bin/phantomjs-2.1.1 --version" | grep "2.1.1"

# Should have phantomjs 1.7.0 installed at /srv/bin/phantomjs
cd wordpress
lando ssh -s appserver -c "/srv/bin/phantomjs --version" | grep "1.7.0"

# Should have apache tika1.18 installed /srv/bin/tika-app-1.18.jar
cd wordpress
lando ssh -s appserver -c "java -jar /srv/bin/tika-app-1.1.jar --version" | grep "Apache Tika 1.1"

# Should have wkhtmltopdf installed at /srv/bin/wkhtmltopdf
cd wordpress
lando ssh -s appserver -c "/srv/bin/wkhtmltopdf --version"

# Should be able to bootstrap drupal7
cd drupal7
lando drush status | grep "Connected"
Expand Down Expand Up @@ -203,11 +122,6 @@ lando ssh -s appserver -c "curl https://index:449/sites/self/environments/lando/
cd drupal7
lando ssh -s appserver -c "git rev-parse HEAD > test.log"
lando push --code dev --database none --files none --message "Testing commit $(git rev-parse HEAD)"
cd ..
cd wordpress
lando ssh -s appserver -c "git rev-parse HEAD > test.log"
lando push --code dev --database none --files none --message "Testing commit $(git rev-parse HEAD)"
cd ..
```

Destroy tests
Expand All @@ -218,20 +132,10 @@ Run the following commands to trash this app like nothing ever happened.
```bash
# Should be able to remove our pantheon ssh keys
cp -r remove-keys.sh drupal7/remove-keys.sh
cp -r remove-keys.sh wordpress/remove-keys.sh
cd wordpress
lando ssh -s appserver -c "/app/remove-keys.sh $(hostname)"
cd ..
cd drupal7
lando ssh -s appserver -c "/app/remove-keys.sh $(hostname)"
cd ..
rm -rf drupal7/remove-keys.sh
rm -rf wordpress/remove-keys.sh

# Should be able to destroy our wordpress site with success
cd wordpress
lando destroy -y
lando poweroff

# Should be able to destroy our drupal7 site with success
cd drupal7
Expand Down
File renamed without changes.
@@ -1,2 +1 @@
wordpress
drupal7
129 changes: 129 additions & 0 deletions examples/pantheon-wordpress/README.md
@@ -0,0 +1,129 @@
Pantheon WordPress Example
==========================

This example exists primarily to test the following documentation:

* [Pantheon Recipe - WordPress](https://docs.devwithlando.io/tutorials/pantheon.html)

**Note that you will need to replace (or export) `$PANTHEON_MACHINE_TOKEN` and `--pantheon-site` to values that make sense for you.**

Start up tests
--------------

Run the following commands to get up and running with this example.

```bash
# Should poweroff
lando poweroff

# Should initialize the lando pantheon test wordpress site
rm -rf wordpress && mkdir -p wordpress && cd wordpress
lando init --source pantheon --pantheon-auth "$PANTHEON_MACHINE_TOKEN" --pantheon-site landobot-wordpress

# Should start up our wordpress site successfully
cd wordpress
lando start

# Should pull down database and files for our wordpress site
cd wordpress
lando pull --code none --database dev --files dev
```

Verification commands
---------------------

Run the following commands to validate things are rolling as they should.

```bash
# Should be able to bootstrap wordpress
cd wordpress/web
lando wp eval "phpinfo();"

# Should have wp cli
cd wordpress
lando wp cli version

# Should use custom webroot when set in pantheon.yml
cd wordpress
lando ssh -s appserver -c "curl -L http://appserver_nginx" | grep "WordPress for Lando"
lando ssh -s appserver -c "curl -kL https://appserver_nginx" | grep "WordPress for Lando"
lando ssh -s appserver -c "env" | grep "LANDO_WEBROOT=/app/web"

# Should set /var/www/.wp-cli/config.yml with LANDO_WEBROOT as PATH
cd wordpress
lando ssh -s appserver -c "cat /var/www/.wp-cli/config.yml | grep path | grep /app/web"

# Should have terminus
cd wordpress
lando terminus -V

# Should be logged in
cd wordpress
lando terminus auth:whoami | grep landobot@devwithlando.io

# Should use custom php version if set in pantheon.yml
cd wordpress
lando php -v | grep "PHP 7.3"

# Should set the correct wordpress specific pantheon environment
cd wordpress
lando ssh -c "env" | grep FRAMEWORK | grep wordpress
lando ssh -c "env" | grep FILEMOUNT | grep "wp-content/uploads"

# Should disable edge, index or cache containers and tools when specified
docker ps --filter label=com.docker.compose.project=landobotwordpress | grep landobotwordpress_appserver_nginx_1
docker ps --filter label=com.docker.compose.project=landobotwordpress | grep landobotwordpress_appserver_1
docker ps --filter label=com.docker.compose.project=landobotwordpress | grep landobotwordpress_database_1
docker ps --filter label=com.docker.compose.project=landobotwordpress | grep landobotwordpress_cache_1 || echo $? | grep 1
docker ps --filter label=com.docker.compose.project=landobotwordpress | grep landobotwordpress_index_1 || echo $? | grep 1
docker ps --filter label=com.docker.compose.project=landobotwordpress | grep landobotwordpress_edge_1 || echo $? | grep 1

# Should still be logged in even after a rebuild
cd wordpress
lando terminus auth:whoami | grep landobot@devwithlando.io
lando rebuild -y
lando terminus auth:whoami | grep landobot@devwithlando.io

# Should serve proxy from nginx
cd wordpress
curl -LI http://landobot-wordress.lndo.site | grep Via || echo $? | grep 1

# Should have phantomjs 2.1.1 installed at /srv/bin/phantomjs-2.1.1
cd wordpress
lando ssh -s appserver -c "/srv/bin/phantomjs-2.1.1 --version" | grep "2.1.1"

# Should have phantomjs 1.7.0 installed at /srv/bin/phantomjs
cd wordpress
lando ssh -s appserver -c "/srv/bin/phantomjs --version" | grep "1.7.0"

# Should have apache tika1.18 installed /srv/bin/tika-app-1.18.jar
cd wordpress
lando ssh -s appserver -c "java -jar /srv/bin/tika-app-1.1.jar --version" | grep "Apache Tika 1.1"

# Should have wkhtmltopdf installed at /srv/bin/wkhtmltopdf
cd wordpress
lando ssh -s appserver -c "/srv/bin/wkhtmltopdf --version"

# Should be able to push commits to pantheon
cd wordpress
lando ssh -s appserver -c "git rev-parse HEAD > test.log"
lando push --code dev --database none --files none --message "Testing commit $(git rev-parse HEAD)"
```

Destroy tests
-------------

Run the following commands to trash this app like nothing ever happened.

```bash
# Should be able to remove our pantheon ssh keys
cp -r remove-keys.sh wordpress/remove-keys.sh
cd wordpress
lando ssh -s appserver -c "/app/remove-keys.sh $(hostname)"
rm -rf wordpress/remove-keys.sh

# Should be able to destroy our wordpress site with success
cd wordpress
lando destroy -y
lando poweroff
```
7 changes: 7 additions & 0 deletions examples/pantheon-wordpress/remove-keys.sh
@@ -0,0 +1,7 @@
#!/bin/bash
HOSTNAME="$1"

for KEY in $(terminus ssh-key:list --fields=Description,ID 2>/dev/null | grep "$HOSTNAME" | sort -r | sed -e 's/ *[^ ]* *//'); do
echo "Trying to remove key $KEY"
terminus ssh-key:remove $KEY
done

0 comments on commit f9831a1

Please sign in to comment.