Skip to content

Commit

Permalink
update docker compose version
Browse files Browse the repository at this point in the history
  • Loading branch information
tobybellwood committed Jan 24, 2024
1 parent d03b348 commit f7fced4
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 44 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/drupal-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
run: |
docker version
docker-compose version
docker compose version
lando version
node -v
yarn -v
Expand All @@ -42,14 +43,14 @@ jobs:
sed -i -e "/###/d" docker-compose.yml
- name: Pull all images
run: |
docker-compose pull --ignore-pull-failures
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
- name: Run docker compose tests
run: |
yarn mocha --timeout 900000 test/*compose*.func.js
# - name: Run Lando tests
Expand All @@ -64,4 +65,4 @@ jobs:
# - name: Show Lando logs
# continue-on-error: true
# run: |
# docker-compose -p drupalsolr logs
# docker compose -p drupalsolr logs
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ To see similar projects with additional services, please visit https://github.co
3. Build and start the build images:
```bash
docker-compose up -d
docker-compose exec cli composer install
docker compose up -d
docker compose exec cli composer install
```
4. Visit the new site @ `http://drupal-solr.docker.amazee.io`
Expand Down
66 changes: 33 additions & 33 deletions TESTING_dockercompose.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Docker Compose Drupal 9 Solr option - php8, nginx, mariadb, solr
=================================================================

This is a docker-compose version of the Lagoon-example tests:
This is a docker compose version of the Lagoon-example tests:

Start up tests
--------------
Expand All @@ -12,10 +12,10 @@ Run the following commands to get up and running with this example.
# Should remove any previous runs and poweroff
sed -i -e "/###/d" docker-compose.yml
docker network inspect amazeeio-network >/dev/null || docker network create amazeeio-network
docker-compose down
docker compose down

# Should start up our Lagoon Drupal 9 site successfully
docker-compose build && docker-compose up -d
docker compose build && docker compose up -d

# Ensure mariadb pod is ready to connect
docker run --rm --net drupal-solr_default amazeeio/dockerize dockerize -wait tcp://mariadb:3306 -timeout 1m
Expand All @@ -28,69 +28,69 @@ Run the following commands to validate things are rolling as they should.

```bash
# Should be able to site install via Drush
docker-compose exec -T cli bash -c "drush si -y"
docker-compose exec -T cli bash -c "drush cr -y"
docker-compose exec -T cli bash -c "drush status" | grep "Drupal bootstrap" | grep "Successful"
docker compose exec -T cli bash -c "drush si -y"
docker compose exec -T cli bash -c "drush cr -y"
docker compose exec -T cli bash -c "drush status" | grep "Drupal bootstrap" | grep "Successful"

# Should have all the services we expect
docker ps --filter label=com.docker.compose.project=drupal-solr | grep Up | grep drupal-solr_nginx_1
docker ps --filter label=com.docker.compose.project=drupal-solr | grep Up | grep drupal-solr_mariadb_1
docker ps --filter label=com.docker.compose.project=drupal-solr | grep Up | grep drupal-solr_php_1
docker ps --filter label=com.docker.compose.project=drupal-solr | grep Up | grep drupal-solr_cli_1
docker ps --filter label=com.docker.compose.project=drupal-solr | grep Up | grep drupal-solr_solr_1
docker ps --filter label=com.docker.compose.project=drupal-solr | grep Up | grep drupal-solr-nginx-1
docker ps --filter label=com.docker.compose.project=drupal-solr | grep Up | grep drupal-solr-mariadb-1
docker ps --filter label=com.docker.compose.project=drupal-solr | grep Up | grep drupal-solr-php-1
docker ps --filter label=com.docker.compose.project=drupal-solr | grep Up | grep drupal-solr-cli-1
docker ps --filter label=com.docker.compose.project=drupal-solr | grep Up | grep drupal-solr-solr-1

# Should ssh against the cli container by default
docker-compose exec -T cli bash -c "env | grep LAGOON=" | grep cli-drupal
docker compose exec -T cli bash -c "env | grep LAGOON=" | grep cli-drupal

# Should have the correct environment set
docker-compose exec -T cli bash -c "env" | grep LAGOON_ROUTE | grep drupal-solr.docker.amazee.io
docker-compose exec -T cli bash -c "env" | grep LAGOON_ENVIRONMENT_TYPE | grep development
docker compose exec -T cli bash -c "env" | grep LAGOON_ROUTE | grep drupal-solr.docker.amazee.io
docker compose exec -T cli bash -c "env" | grep LAGOON_ENVIRONMENT_TYPE | grep development

# Should be running PHP 8
docker-compose exec -T cli bash -c "php -v" | grep "PHP 8"
docker compose exec -T cli bash -c "php -v" | grep "PHP 8"

# Should have composer
docker-compose exec -T cli bash -c "composer --version"
docker compose exec -T cli bash -c "composer --version"

# Should have php cli
docker-compose exec -T cli bash -c "php --version"
docker compose exec -T cli bash -c "php --version"

# Should have drush
docker-compose exec -T cli bash -c "drush --version"
docker compose exec -T cli bash -c "drush --version"

# Should have npm
docker-compose exec -T cli bash -c "npm --version"
docker compose exec -T cli bash -c "npm --version"

# Should have node
docker-compose exec -T cli bash -c "node --version"
docker compose exec -T cli bash -c "node --version"

# Should have yarn
docker-compose exec -T cli bash -c "yarn --version"
docker compose exec -T cli bash -c "yarn --version"

# Should have a running Drupal 9 site served by nginx on port 8080
docker-compose exec -T cli bash -c "curl -kL http://nginx:8080" | grep "Drush Site-Install"
docker compose exec -T cli bash -c "curl -kL http://nginx:8080" | grep "Drush Site-Install"

# Should have a "drupal" Solr core
docker-compose exec -T cli bash -c "curl solr:8983/solr/admin/cores?action=STATUS&core=drupal"
docker compose exec -T cli bash -c "curl solr:8983/solr/admin/cores?action=STATUS&core=drupal"

# Should be able to reload "drupal" Solr core
docker-compose exec -T cli bash -c "curl solr:8983/solr/admin/cores?action=RELOAD&core=drupal"
docker compose exec -T cli bash -c "curl solr:8983/solr/admin/cores?action=RELOAD&core=drupal"

# Check Solr has 7.x config in "drupal" core
docker-compose exec -T solr bash -c "cat /opt/solr/server/solr/mycores/drupal/conf/schema.xml | grep solr-7.x"
docker compose exec -T solr bash -c "cat /opt/solr/server/solr/mycores/drupal/conf/schema.xml | grep solr-7.x"

# Should be able to db-export and db-import the database
docker-compose exec -T cli bash -c "drush sql-dump --result-file /app/test.sql"
docker-compose exec -T cli bash -c "drush sql-drop -y"
docker-compose exec -T cli bash -c "drush sql-cli < /app/test.sql"
docker-compose exec -T cli bash -c "rm test.sql*"
docker compose exec -T cli bash -c "drush sql-dump --result-file /app/test.sql"
docker compose exec -T cli bash -c "drush sql-drop -y"
docker compose exec -T cli bash -c "drush sql-cli < /app/test.sql"
docker compose exec -T cli bash -c "rm test.sql*"

# Should be able to show the drupal tables
docker-compose exec -T cli bash -c "drush sqlq \'show tables;\'" | grep users
docker compose exec -T cli bash -c "drush sqlq \'show tables;\'" | grep users

# Should be able to rebuild and persist the database
docker-compose build && docker-compose up -d
docker-compose exec -T cli bash -c "drush sqlq \'show tables;\'" | grep users
docker compose build && docker compose up -d
docker compose exec -T cli bash -c "drush sqlq \'show tables;\'" | grep users
```

Destroy tests
Expand All @@ -100,5 +100,5 @@ Run the following commands to trash this app like nothing ever happened.

```bash
# Should be able to destroy our Drupal 9 site with success
docker-compose down --volumes --remove-orphans
docker compose down --volumes --remove-orphans
```
12 changes: 6 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ x-environment:
LAGOON_ROUTE: &default-url http://${COMPOSE_PROJECT_NAME:-drupal-solr}.docker.amazee.io
# Uncomment if you like to have the system behave like in production
#LAGOON_ENVIRONMENT_TYPE: production
# Uncomment to enable xdebug and then restart via `docker-compose up -d`
# Uncomment to enable xdebug and then restart via `docker compose up -d`
#XDEBUG_ENABLE: "true"

x-user:
Expand Down Expand Up @@ -58,10 +58,10 @@ services:
lagoon.persistent: /app/web/sites/default/files/ # define where the persistent storage should be mounted too
lando.type: nginx-drupal
ports:
- "8080" # exposes the port 8080 with a random local port, find it with `docker-compose port nginx 8080`
- "8080" # exposes the port 8080 with a random local port, find it with `docker compose port nginx 8080`
<< : [*default-volumes, *default-user]
depends_on:
- cli # basically just tells docker-compose to build the cli first
- cli # basically just tells docker compose to build the cli first
environment:
<< : *default-environment # loads the defined environment variables from the top
LAGOON_LOCALDEV_URL: *default-url
Expand All @@ -82,7 +82,7 @@ services:
lando.type: php-fpm
<< : [*default-volumes, *default-user]
depends_on:
- cli # basically just tells docker-compose to build the cli first
- cli # basically just tells docker compose to build the cli first
environment:
<< : *default-environment # loads the defined environment variables from the top

Expand All @@ -92,7 +92,7 @@ services:
lagoon.type: mariadb
lando.type: mariadb-drupal
ports:
- "3306" # exposes the port 3306 with a random local port, find it with `docker-compose port mariadb 3306`
- "3306" # exposes the port 3306 with a random local port, find it with `docker compose port mariadb 3306`
<< : *default-user # uses the defined user from top
environment:
<< : *default-environment
Expand All @@ -105,7 +105,7 @@ services:
lagoon.type: solr
lando.type: solr-drupal
ports:
- "8983" # exposes the port 8983 with a random local port, find it with `docker-compose port solr 8983`
- "8983" # exposes the port 8983 with a random local port, find it with `docker compose port solr 8983`
environment:
<< : *default-environment
volumes:
Expand Down

0 comments on commit f7fced4

Please sign in to comment.