Skip to content

Setting up a new Lagoon Demo#

1. Clone base template#

Github repo for base templates: Lagoon Example Projects

Note: The templates in this repo are maintained by the Lagoon team and include latest security updates, etc. By default, you should grab base templates from here to start your demo.

Drupal#

# Drupal Base
git clone git@github.com:lagoon-examples/drupal-base

Node.js#

# Node.js Simple Demo
git clone git@github.com:amazeeio-demos/demo-node-simple.git

Note: We are currently using a simple node demo whose base resides in our amazeeio-demos repo instead of the lagoon-examples demo: https://github.com/amazeeio-demos/demo-node-simple.

Craft CMS#

# Craft CMS Simple Demo
git clone git@github.com:amazeeio-demos/demo-craft-simple.git

Note: We are currently using a simple craft cms demo whose base resides in our amazeeio-demos repo instead of the lagoon-examples demo: https://github.com/amazeeio-demos/demo-craft-simple.

NextDrupal#

# NextDrupal Simple Demo

# clone down the Drupal site
git clone git@github.com:amazeeio-demos/demo-nextdrupal-drupal.git

#clone down the NextJS site
git clone git@github.com:amazeeio-demos/demo-nextdrupal-nextjs.git

Note: We are currently using a simple nextdrupal demo whose base resides in our amazeeio-demos repo instead of the lagoon-examples demo: Drupal | NextJS

Laravel#

# Laravel Demo
git clone git@github.com:amazeeio-demos/laravel-demo.git

Note: We are currently using a simple laravel demo whose base resides in our amazeeio-demos repo instead of the lagoon-examples demo: https://github.com/amazeeio-demos/laravel-demo.

2. Replace old project name with new project name in all config files#

Search for and replace all occurences of the old file name in our local files:

# find all files with old project name
grep -rli [old-project-name]

# easy find and replace in files
sed -i '' -e 's/[old-project-name]/[new-project-name]/g' FILENAME
# eg. sed -i '' -e 's/bree/lullabot/g' .lagoon.yml
Common files to look for changes in: Drupal
  • ./TESTING_lando.md
  • ./.lando.yml
  • ./README.md
  • ./TESTING_dockercompose.md
  • ./.env
  • ./docker-compose.yml
  • ./.lagoon.yml
  • ./composer.json

3. Build locally#

Drupal#

Set up Drupal demo locally. Pygmy
...using Pygmy
# start up pygmy
pygmy up

# build and start containers
docker-compose build
docker-compose up -d

# if project uses COMPOSER

  # install composer dependencies from OUTSIDE THE CLI container
  docker-compose exec cli composer install

  # OR install composer dependencies from INSIDE THE CLI container
  docker-compose exec cli bash
  composer install

# visit project-name.docker.amazee.io

# if DRUPAL

  # if it's a NEW SITE, run site install

    # from OUTSIDE THE CLI container
    docker-compose exec cli drush si -y

    # OR from INSIDE THE CLI container
    docker-compose exec cli bash
    drush si -y

    # Note: to install umami demo on site install, syntax is
    # drush si demo_umami -y


  # if it's an EXISTING SITE
    # SYNC the DB and FILES down

    # get drush aliases
    docker-compose exec cli drush la

    # sync db down
    docker-compose exec cli drush sql-sync @lagoon.[project]-[env] @self

    # sync files down
    docker-compose exec cli drush rsync @lagoon.[project]-[env]:%files @self:%files
Lando
...using Lando
# if you are using lando, it's probably drupal... so most of this is drupal-specific

# spin up containers
lando start

# if it's a NEW SITE, run site install
lando drush si -y
# install umami: lando drush si demo_umami -y

# if it's an EXISTING SITE, SYNC the DB and FILES down

# get drush aliases
lando drush la

# sync db down
lando drush sql-sync @lagoon.[project]-[env] @self

# sync files down
lando drush rsync @lagoon.[project]-[env]:%files @self:%files

Demo Node Simple#

Set up Node demo locally.
pygmy up
docker-compose build
docker-compose up -d
pygmy status

Gatsby#

Set up Gatsby demo locally. Retool the node.dockerfile
vi node.dockerfile
Delete everything in there and paste in the following:
FROM uselagoon/node-18-builder:latest
COPY package.json package-lock.json /app/

RUN npm install
RUN npm install -g gatsby-cli

COPY . /app/

RUN mkdir /home/.config/ && fix-permissions /home/.config && fix-permissions /home/.npm

EXPOSE 3000

CMD [“/app/scripts/runGatsbyDevelop.sh”]
Save your changes and close the fle. Burn it down, start again, and install npm in the container
docker-compose build
docker-compose run -u 1002 node sh
$ npm install     <==== in the container
$ ctrl-d      
docker-compose up

Craft CMS#

Set up Craft CMS demo locally.
pygmy up
git clone git@github.com:amazeeio-demos/demo-craft-simple.git
cd demo-craft-simple
cp .env.local.example .env.local
docker-compose build

docker-compose run cli bash
# In the container running BASH
$ composer install
# Exit the container
$ exit (to log out of the container)

# Start up the containers locally
docker-compose up

# Jump back into the container running BASH
docker-compose run cli bash
# To setup a new DB and Craft (run in the container)
$ ./craft install (if this is a new installation, not copying an existing DB or something)
# To copy the DB and files from the demo project in lagoon (run in the container)
$ lagoon-sync sync mariadb -e main
$ lagoon-sync sync files -e main
# Exit the container
$ exit

#Locally now
browse to http://demo-craft-simple.docker.amazee.io

Source: https://github.com/amazeeio-demos/demo-craft-simple#readme

NextDrupal#

Set up NextDrupal demo locally.

NextDrupal: Drupal#

Set up Drupal back end
# demo-nextdrupal-drupal
git clone git@github.com:amazeeio-demos/demo-nextdrupal-drupal.git
cd demo-nextdrupal-drupal
If customizing for a client... update local files
docker-compose.yml
# docker-compose.yml
diff --git a/docker-compose.yml b/docker-compose.yml
index 75a74fa..1839b66 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -10,7 +10,7 @@ x-volumes:
x-environment:
  &default-environment
    # Route that should be used locally, if you are using pygmy, this route *must* end with .docker.amazee.io
-    LAGOON_ROUTE: &default-url http://${COMPOSE_PROJECT_NAME:-demo-nextdrupal-drupal}.docker.amazee.io
+    LAGOON_ROUTE: &default-url http://${COMPOSE_PROJECT_NAME:-demo-[PROJECTNAME]-nextdrupal-drupal}.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`
@@ -33,7 +33,7 @@ services:
    build:
      context: .
      dockerfile: lagoon/cli.dockerfile
-    image: &cli-image ${COMPOSE_PROJECT_NAME:-demo-nextdrupal-drupal}-cli # this image will be reused as `CLI_IMAGE` in subsequent Docker builds
+    image: &cli-image ${COMPOSE_PROJECT_NAME:-demo-[PROJECTNAME]-nextdrupal-drupal}-cli # this image will be reused as `CLI_IMAGE` in subsequent Docker builds
    labels:
      # Lagoon Labels
      lagoon.type: cli-persistent
@@ -67,7 +67,7 @@ services:
    networks:
      amazeeio-network:
        aliases:
-          - drupal-composetheweb
+          - drupal-[PROJECTNAME]-composetheweb
      default:

  php:
.lagoon.yml
# .lagoon.yml
diff --git a/.lagoon.yml b/.lagoon.yml
index c66db61..b158705 100644
--- a/.lagoon.yml
+++ b/.lagoon.yml
@@ -1,6 +1,6 @@
docker-compose-yaml: docker-compose.yml

-project: demo-nextdrupal-drupal
+project: demo-[PROJECTNAME]-nextdrupal-drupal

tasks:
#   pre-rollout:
@@ -11,20 +11,20 @@ tasks:

  post-rollout:
    - run:
-        name: IF no Drupal installed and we are not main branch, sync from main brancy
+        name: IF no Drupal installed and we are not main branch, sync from main branch
        command: |
            if tables=$(drush sqlq 'show tables;') && [ -z "$tables" ] && [[ "$LAGOON_GIT_BRANCH" != "main" ]]; then
                # no drupal installed, sync DB from main branch
-                drush -y sql-sync @lagoon.demo-nextdrupal-drupal-main @self
-                drush -y rsync @lagoon.demo-nextdrupal-drupal-main:%files @self:%files
+                drush -y sql-sync @lagoon.demo-[PROJECTNAME]-nextdrupal-drupal-main @self
+                drush -y rsync @lagoon.demo-[PROJECTNAME]-nextdrupal-drupal-main:%files @self:%files
                drush -y cr
            fi
        service: cli
        shell: bash
-    - run:
-        name: drush cim
-        command: drush -y cim
-        service: cli
+#    - run:
+#        name: drush cim
+#        command: drush -y cim
+#        service: cli
    - run:
        name: drush updb
        command: drush -y updb
@@ -36,12 +36,11 @@ tasks:

environments:
  main:
-    routes:
-      - nginx:
-        - "drupal.demo.composetheweb.com":
-            tls-acme: true
-            insecure: Redirect
+#    routes:
+#      - nginx:
+#        - "drupal.demo.composetheweb.com":
+#            tls-acme: true
+#            insecure: Redirect    
  cronjobs:
        name: drush cron
        schedule: "*/15 * * * *"
        command: drush cron
.env
# .env
diff --git a/.env b/.env
index 7603178..29ed59e 100644
--- a/.env
+++ b/.env
@@ -1,2 +1,2 @@
 # Local project name - setting this here aligns container names with routes
-COMPOSE_PROJECT_NAME=demo-nextdrupal-drupal
+COMPOSE_PROJECT_NAME=demo-[PROJECTNAME]-nextdrupal-drupal
.lando.yml
# .lando.yml
diff --git a/.lando.yml b/.lando.yml
index 8eac675..7105579 100644
--- a/.lando.yml
+++ b/.lando.yml
@@ -1,4 +1,4 @@
-name: demo-nextdrupal-drupal
+name: demo-[PROJECTNAME]-nextdrupal-drupal
 recipe: lagoon
 config:
   flavor: drupal
# start up services + containers
pygmy up
docker-compose up -d
docker-compose exec cli composer install
docker-compose exec cli drush la
docker-compose exec cli drush sql-sync @lagoon.demo-nextdrupal-drupal-main @self
docker-compose exec cli drush rsync @lagoon.demo-nextdrupal-drupal-main:%files @self:%files
pygmy status
# enable modules
docker-compose exec cli drush uli
docker-compose exec cli drush en jsonapi_menu_items jsonapi_views next_jsonapi
docker-compose exec cli drush cex

NextDrupal: NextJS#

Set up NextJS front end
# demo-nextdrupal-nextjs
git clone git@github.com:amazeeio-demos/demo-nextdrupal-nextjs.git
cd demo-nextdrupal-nextjs
cp .env.example .env.local
If customizing for a client... update local files
docker-compose.yml
diff --git a/docker-compose.yml b/docker-compose.yml
index 0aa94f1..dd4393c 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -15,7 +15,7 @@ services:
       - ./:/app:delegated
     environment:
       - LAGOON_LOCALDEV_HTTP_PORT=3000
-      - LAGOON_ROUTE=http://demo-nextdrupal-nextjs.docker.amazee.io
+      - LAGOON_ROUTE=http://demo-[PROJECTNAME]-nextdrupal-nextjs.docker.amazee.io

 networks:
   amazeeio-network:
.lagoon.yml
diff --git a/.lagoon.yml b/.lagoon.yml
index ac81d7c..7bcae6d 100644
--- a/.lagoon.yml
+++ b/.lagoon.yml
@@ -1,10 +1,10 @@
 docker-compose-yaml: docker-compose.yml
-project: demo-nextdrupal-nextjs
+project: demo-[PROJECTNAME]-nextdrupal-nextjs

-environments:
-  main:
-    routes:
-      - node:
-        - "next.demo.composetheweb.com":
-            tls-acme: true
-            insecure: Redirect
+#environments:
+#  main:
+#    routes:
+#      - node:
+#        - "next.demo.composetheweb.com":
+#            tls-acme: true
+#            insecure: Redirect
.lagoon.env.main
diff --git a/.lagoon.env.main b/.lagoon.env.main
index 4c569bb..168c85d 100644
--- a/.lagoon.env.main
+++ b/.lagoon.env.main
@@ -1,7 +1,7 @@
-NEXT_PUBLIC_DRUPAL_BASE_URL=https://drupal.demo.composetheweb.com
-NEXT_IMAGE_DOMAIN=drupal.demo.composetheweb.com
+NEXT_PUBLIC_DRUPAL_BASE_URL=https://nginx.main.demo-[PROJECTNAME]-nextdrupal-drupal.us2.amazee.io
+NEXT_IMAGE_DOMAIN=nginx.main.demo-[PROJECTNAME]-nextdrupal-drupal.us2.amazee.io
 DRUPAL_PREVIEW_SECRET=secret
 NEXTAUTH_SECRET=
-NEXTAUTH_URL=https://drupal.demo.composetheweb.com
+NEXTAUTH_URL=https://nginx.main.demo-[PROJECTNAME]-nextdrupal-drupal.us2.amazee.io
 DRUPAL_CLIENT_ID=
 DRUPAL_CLIENT_SECRET=
.env.local
NEXT_PUBLIC_DRUPAL_BASE_URL=http://drupal-[PROJECTNAME]-composetheweb:8080
NEXT_IMAGE_DOMAIN=drupal-if-composetheweb
DRUPAL_PREVIEW_SECRET=secret
NEXTAUTH_SECRET=
NEXTAUTH_URL=http://demo-[PROJECTNAME]-nextdrupal-drupal.docker.amazee.io
DRUPAL_CLIENT_ID=
DRUPAL_CLIENT_SECRET=
# start up services + containers
docker-compose build
docker-compose run -u 1002 node sh
$ npm install     <==== in the container
$ ctrl-d      
docker-compose up

Laravel#

Set up Laravel demo locally.
pygmy up
git clone git@github.com:amazeeio-demos/laravel-demo.git
cd laravel-demo
cp .env.example .env
# Add APP_KEY to .env 
  # for now, get this from saved output in bree's history/notes
  # future step: ask Blaize how we generate this ourselves?

docker-compose -f lagoon-docker-compose.yml up
# ^this will keep running actively in the terminal window. 
# you need a separate window for running future commands
# in a separate terminal window
docker-compose -f lagoon-docker-compose.yml exec cli bash
$ composer install
$ exit

Magento#

🚧 IN PROGRESS. FORMATTING IS ROUGH! 🚧

Set up Magento locally. Clone repo.
git clone git@github.com:lagoon-examples/magento2.git
cd magento2
git fetch --all
git checkout feature/configchanges
Rename project.
grep -rli magento2
./.lagoon.yml
./docker-compose.yml
Build, start, and composer install locally.
docker-compose build
docker-compose up -d
pygmy status
docker-compose exec cli composer install
Visit local site should show [setup screen](../images/magento-setup.png) ![Magento setup screen](../images/magento-setup.png) Magento installation.
# https://github.com/amazeeio-demos/demo-bree-magento#installation
docker-compose exec cli bash
$ cp /repo/app/etc/* /app/app/etc/
$ /app/bin/magento setup:install --base-url="${LAGOON_ROUTE:-http://magento.docker.amazee.io}" \
--db-host="${MARIADB_HOST:-mariadb}" \
--db-name="${MARIADB_DATABASE:-lagoon}" \
--db-user="${MARIADB_USERNAME:-lagoon}" \
--db-password="${MARIADB_PASSWORD:-lagoon}" \
--admin-firstname="Admin" \
--admin-lastname="User" \
--admin-email="admin@example.com" \
--admin-user="admin" \
--admin-password="admin123" \
--elasticsearch-host="elasticsearch" \
--elasticsearch-port=9200 \
--use-rewrites=1 \
--search-engine=elasticsearch7

#Success output should give admin url.
Screenshot 2023-07-05 at 11.04.36 AM.png
Get admin URL if you missed it.
docker-compose exec cli bash
$ /app/bin/magento info:adminuri

Python#

🚧 IN PROGRESS. 🚧

Python Demo
pygmy up
git clone git@github.com:amazeeio-demos/demo-python-simple-flask.git
cd demo-python-simple-flask
docker-compose build
docker-compose up -d

4. Create new repo#

Github Organization: amazeeio-demos

New repo quicklink: https://github.com/organizations/amazeeio-demos/repositories/new

Naming convention: demo-[who-its-for]-[what-tech-its-for]

  • eg. demo-vagov-drupal where vagov is the client name and drupal is the tech
  • more examples: demo-henk-drupal, demo-vagov-gatsby
Bitbucket

Bitbucket workspace: amazeeio-demos

5. Set new repo as remote origin on local site#

git remote rm origin
git remote add origin git@github:amazeeio-demos/[project-name].git

6. Push local to new repo#

git branch -M main
git push -u origin main

7. Create Lagoon project#

SYNTAX CHANGING

The syntax for adding a project has changed now that Organizations have been rolled out, and further CLI changes are forthcoming. This syntax will change, keep an eye out for updates. See refactor: restructure organization commands by CGoodwin90

SYNTAX

lagoon add organization project \
-O [ORGANIZATION NAME] \
-p [PROJECT NAME] \
--branches [BRANCHES ENABLED] \
--git-url [GIT URL] \
--openshift [DEPLOY TARGET ID] \
--pullrequests [true/false] \
--production-environment [PRODUCTION BRANCH NAME]

Source: https://uselagoon.github.io/lagoon-cli/commands/lagoon_add_organization_project/

EXAMPLE:

Tip

Organization aio-sales is for use by the AIO Sales team only. Please consult your administrator if you do not know your Organization name.

Tip

Flag --openshift 126 will use the deploy target us2, which is in AWS Virginia. To use jp1, the id is 175. For other Cluster IDs, aio staff can consult aio internal documentation here: https://amazeeio.atlassian.net/wiki/spaces/AMAZEEIO/pages/3281485848/Infrastructure+Overview.

lagoon add organization project -O aio-sales -p demo-[client]-[tech] --branches "^(main|dev|feature.*)$" --git-url git@github.com:amazeeio-demos/[project-name].git --openshift 126 --pullrequests true --production-environment main

Note: For low-chance demos, set main branch to non-prod so it always idles and project costs us less.

8. [OPTIONAL] Add a group to the Organization, then add the project to the group#

Projects may be organized into groups within Organizations, or may belong to the Organization directly. If you are creating multiple demos for a single customer, you may choose to organize these within a group so that you can manage access and permissions at the group level versus at the individual project level.

SYNTAX CHANGING

The syntax for adding a group has changed now that Organizations have been rolled out, and further CLI changes are forthcoming. Keep an eye out for updates.

Create a group within an Organization#

SYNTAX

lagoon add organization group -O [ORGANIZATION NAME] -N [GROUP NAME]

Source: https://uselagoon.github.io/lagoon-cli/commands/lagoon_add_organization_group/

EXAMPLE

Tip

Organization aio-sales is for use by the AIO Sales team only. Please consult your administrator if you do not know your Organization name.

lagoon add organization group -O aio-sales -N [group-name]

Add a project to a group#

SYNTAX

lagoon add project-group -p [PROJECT NAME] -N [GROUP NAME]

Source: https://uselagoon.github.io/lagoon-cli/commands/lagoon_add_project-group/

EXAMPLE

Tip

Group amazeeio-sales is for use by the AIO Sales team only. Please consult your administrator if you need to know which existing groups to use, or if you are unsure about creating a new one.

lagoon add project-group -p [project-name] -N amazeeio-sales

When a new project is added to Lagoon, a default group for that project is already created. The group name follows the format project-[project-name].

To find the group, use this command:

lagoon list groups | grep [project-name]
List all projects in a group
lagoon list group-projects -N [group-name]
Source: https://uselagoon.github.io/lagoon-cli/commands/lagoon_list_group-projects/

9. Add users to Lagoon group#

Only Platform Admins can update users

While Organization owners can create users, they cannot update user information if they enter it incorrectly on creation.

Non-admin users can only update their own user information.

Therefore, if user information needs to be corrected, the user should update their own information from within the Lagoon dashboard.

Add a new user to Lagoon:

lagoon add user -E [user email] -F [first name] -L [last name]
Source: https://uselagoon.github.io/lagoon-cli/commands/lagoon_add_user/

Add user to an Organization:

lagoon add organization user -O [organization name] -E [user email]
Source: https://uselagoon.github.io/lagoon-cli/commands/lagoon_add_organization_user/

Add a user to a project group:

Tip

We usually add customer users to project/client-specific groups only (not directly to the Organization, as this would give them access to ALL projects within the Organization), and with the role of owner. Other options include maintainer, developer, reporter, guest.

lagoon add user-group -E [user email] -N [group name] -R [role]
Source: https://uselagoon.github.io/lagoon-cli/commands/lagoon_add_user-group/

List all groups you have access to
lagoon list groups
List all users in a certain group
lagoon list users -N [group-name]

Note: We usually add customer users to project/client-specific groups only (not directly to the Organization, as this would give them access to ALL projects within the Organization), and with the role of owner. Other options include maintainer, developer, reporter, guest.

10. Connect Git repo to Lagoon project#

Generate deploy key:

lagoon get project-key -p [project-name]

Add deploy key to git repo at settings/keys/news.

Add web hook to git repo at settings/hooks:

  • Payload URL: https://hooks.lagoon.amazeeio.cloud
  • Content type: application/json
  • Secret: Leave this blank
  • Select individual events to trigger web hook:
    • Pull requests
    • Pushes
  • Active: true
Bitbucket

Deploy key: admin/access-keys

Webhooks: /admin/webhooks

11. Trigger your first build#

Make some file changes, or optionally make an empty commit:

git commit -m "Trigger build." --allow-empty

Making changes for a demo#

Updating Drupal#

If Drupal, export config: Pygmy
# outside cli container
docker-compose exec cli drush cex -y

#inside cli container
docker-compose exec cli bash # now you are in the container...
drush cex -y # ...and you can run drush directly
Lando
lando drush cex -y

Updating Node-simple#

If Node (simple), make text file changes:
figlet -w 110 -f defleppard "hello world" > src/words.txt

Updating Laravel#

If Laravel, make a simple change: Option 1: Update message.txt and git commit
git checkout -b feature-message
echo "howdy partner." > message.txt
git add message.txt
git commit -m "updating message."
git push origin feature-message

#reset message.txt
cat backup.message.txt > message.txt

# **Note:** 
# This _will_ update locally, and allow you to demonstrate
# how a git push triggers an automatic deployment. 
Option 2: Override messages.txt in persistent storage >_**Note:** This will not update locally. It will only update on main (prod). Additionally, this will take precedence over any message you have committed with Option 1._
Lagoon ssh -p laravel-demo -e main
$ cd storage
$ ls
$ echo “hithere” > override.message.txt

# unset override
$ rm override.message.txt

# **Note:** 
# This will _not_ update locally. 
# It will only update on main (prod). 
# Additionally, this will take precedence over any message you have committed with Option 1.
Option 3: Set Lagoon variable
lagoon add variable -N LAGOON_MESSAGE -V “testing env var message” -p laravel-demo -S runtime

#unset variable
lagoon update variable -N LAGOON_MESSAGE -V “testing env var message” -p laravel-demo -S runtime

# **Note:** 
# This will _not_ update locally.
# It will only update on main (prod). 
# Additionally, this will take precedence over any message you have committed with Option 2. 
# And, finally, you must trigger a deployment for any change in lagoon variables to update.
Tips & Tricks
# Check if LAGOON_MESSAGE is set
lagoon ssh -p laravel-demo -e main
$ env | sort | grep -i lagoon

Commit & Push#

Commit file changes:

git add .
git commit -m "your commit message here."

Push your changes to your repo:

git push origin main

Note: On push, git will trigger Lagoon via the webhook, which in turn will begin the deployment.

12. Configure post-rollout tasks (Drupal-specific)#

Once you have your main environment up and running both locally and on Lagoon, it's time to add some handy drupal-specific post-rollout tasks.

.lagoon.yml

docker-compose-yaml: docker-compose.yml

project: demo-CLIENTNAME-drupal

# The ssh and api settings are needed to configure Lagoon outside of amazeeio.cloud infrastructure
# ssh: ssh.amazeeio.cloud:32222
# api: https://api.amazeeio.cloud/graphql

tasks:
#   pre-rollout:
#     - run:
#         name: drush sql-dump
#         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

  post-rollout:
    - run:
        name: IF no Drupal installed and we are not main branch, sync from main branch
        command: |
            if tables=$(drush sqlq 'show tables;') && [ -z "$tables" ] && [[ "$LAGOON_GIT_BRANCH" != "main" ]]; then
                # no drupal installed, sync DB from main branch
                drush -y sql-sync @lagoon.demo-CLIENTNAME-drupal-main @self
                drush -y rsync @lagoon.demo-CLIENTNAME-drupal-main:%files @self:%files
                drush -y cr
            fi
        service: cli
        shell: bash
    # Enable once config sync has been setup.
    # - run:
    #     name: drush cim
    #     command: drush -y cim
    #     service: cli
    - run:
        name: drush updb
        command: drush -y updb
        service: cli
    - run:
        name: drush cr
        command: drush -y cr
        service: cli

environments:
  main:
    # routes:
    cronjobs:
      - name: drush cron
        schedule: "*/30 * * * *"
        command: drush cron
        service: cli
~

13. Logging (Kibana)#

Logging in Drupal#

logging: logs.amazeeio.cloud

custom: Search for your group. Example: amazeeiosales or annai-sales

Discover -> enable lagoon logs module on demo sites

Tips & Tricks#

Spin down your local

  • pygmy
docker-compose down
pygmy down
  • lando
lando stop # stops your app
lando poweroff # spins down all lando containers and services

DESTROY your local

  • pygmy
docker-compose down -v
  • lando
lando destroy

Force rebuild

docker-compose up -d --force-recreate
#or
docker-compose up –build -d

Build with no cache:

docker-compose build —force-rm  —no-cache

Note: “&default-volumes” at top and then “<< : *default-volumes”- loads the local files into the container.

Install pygmy

brew tap pygmystack/pygmy && brew install pygmy
pygmy up
pygmy addkey --key ~/.ssh/id_rsa

Print out your local urls with pygmy:

pygmy status