Skip to content

Instantly share code, notes, and snippets.

@laryn
Last active January 2, 2023 18:42
Show Gist options
  • Select an option

  • Save laryn/3746763cd10ed3be4f652c4c3670acfd to your computer and use it in GitHub Desktop.

Select an option

Save laryn/3746763cd10ed3be4f652c4c3670acfd to your computer and use it in GitHub Desktop.

Revisions

  1. laryn revised this gist Jan 2, 2023. 1 changed file with 41 additions and 6 deletions.
    47 changes: 41 additions & 6 deletions .lando.yml
    Original file line number Diff line number Diff line change
    @@ -1,40 +1,75 @@
    # Opinionated Lando + Backdrop + XDebug sandbox configuration file.

    name: sandbox
    # Use existing Backdrop recipe, then customise below.
    recipe: backdrop

    config:
    # Where Backdrop resides, relative to this file.
    webroot: www
    webroot: web
    # Prefer MariaDB over MySQL.
    database: mariadb
    # Optionally set specific PHP version.
    php: '8.1'

    services:
    # Install phpMyAdmin.
    phpmyadmin:
    type: phpmyadmin
    # Link it to the default database service (see `lando info`).
    hosts: database
    appserver:
    webroot: web
    xdebug: debug
    config:
    php: .vscode/php.ini
    build_as_root:
    # Install Backdrop Console (`bee`).
    - wget -qO bee.zip https://github.com/backdrop-contrib/bee/archive/1.x-1.x.zip
    - unzip -q bee.zip && rm bee.zip
    - mv bee-1.x-1.x /usr/local/bin/bee
    overrides:
    environment:
    XDEBUG_MODE:
    database:
    portforward: 3307

    tooling:
    # Allow Drush to be run from any directory.
    # Allow Bee and Drush to be run from any directory.
    bee:
    service: appserver
    cmd: /usr/local/bin/bee/bee.php --root=/app/web
    drush:
    service: appserver
    cmd: drush --root=/app/www --uri=http://sandbox.lndo.site
    cmd: drush --root=/app/web --uri=http://sandbox.lndo.site
    xdebug-on:
    service: appserver
    description: Enable xdebug for Apache.
    cmd: rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && docker-php-ext-enable xdebug && /etc/init.d/apache2 reload && echo "Xdebug enabled"
    user: root
    xdebug-off:
    service: appserver
    description: Disable xdebug for Apache.
    cmd: rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && /etc/init.d/apache2 reload && echo "Xdebug disabled"
    user: root
    phpunitdebug:
    service: appserver
    cmd: php -d xdebug.remote_port=9003 vendor/bin/phpunit
    # Create a snapshot of the site.
    snapshot:
    service: appserver
    description: Create a snapshot of the site
    cmd:
    - mysqldump --add-drop-database -Bu root -h database -P 3306 backdrop > /app/backdrop.sql
    - gzip -f /app/backdrop.sql
    - cd /app/www/files/config_* && tar -czf /app/config.tar.gz active
    - cd /app/web/files/config_* && tar -czf /app/config.tar.gz active
    - echo 'Snapshot created successfully'
    # Reset the site using the snapshot.
    reset:
    service: appserver
    description: Reset the site using the snapshot
    cmd:
    - cd /app/www/files/config_* && rm -r active && tar -xzf /app/config.tar.gz
    - cd /app/web/files/config_* && rm -r active && tar -xzf /app/config.tar.gz
    - gunzip /app/backdrop.sql.gz
    - mysql -u root -h database -P 3306 backdrop < /app/backdrop.sql
    - gzip -f /app/backdrop.sql
    @@ -43,4 +78,4 @@ tooling:
    proxy:
    # Add a custom sub-domain for phpMyAdmin.
    phpmyadmin:
    - db.sandbox.lndo.site
    - db.sandbox.lndo.site
  2. @BWpanda BWpanda revised this gist Jul 24, 2019. 1 changed file with 5 additions and 4 deletions.
    9 changes: 5 additions & 4 deletions .lando.yml
    Original file line number Diff line number Diff line change
    @@ -13,17 +13,17 @@ services:
    phpmyadmin:
    type: phpmyadmin
    # Link it to the default database service (see `lando info`).
    hosts:
    - database
    hosts: database

    tooling:
    # Allow Drush to be run from any directory.
    drush:
    service: appserver
    cmd: drush --root=/app/www --uri=https://sandbox.lndo.site
    cmd: drush --root=/app/www --uri=http://sandbox.lndo.site
    # Create a snapshot of the site.
    snapshot:
    service: appserver
    description: Create a snapshot of the site
    cmd:
    - mysqldump --add-drop-database -Bu root -h database -P 3306 backdrop > /app/backdrop.sql
    - gzip -f /app/backdrop.sql
    @@ -32,8 +32,9 @@ tooling:
    # Reset the site using the snapshot.
    reset:
    service: appserver
    description: Reset the site using the snapshot
    cmd:
    - cd /app/www/files/config_* && tar -xzf /app/config.tar.gz
    - cd /app/www/files/config_* && rm -r active && tar -xzf /app/config.tar.gz
    - gunzip /app/backdrop.sql.gz
    - mysql -u root -h database -P 3306 backdrop < /app/backdrop.sql
    - gzip -f /app/backdrop.sql
  3. @BWpanda BWpanda revised this gist Jul 11, 2019. 1 changed file with 16 additions and 18 deletions.
    34 changes: 16 additions & 18 deletions .lando.yml
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,4 @@
    name: sandbox

    # Use existing Backdrop recipe, then customise below.
    recipe: backdrop

    @@ -9,39 +8,38 @@ config:
    # Prefer MariaDB over MySQL.
    database: mariadb

    services:
    # Install phpMyAdmin.
    phpmyadmin:
    type: phpmyadmin
    # Link it to the default database service (see `lando info`).
    hosts:
    - database

    tooling:
    # Allow Drush to be run from any directory.
    drush:
    service: appserver
    cmd: drush --root=www --uri=https://sandbox.lndo.site
    cmd: drush --root=/app/www --uri=https://sandbox.lndo.site
    # Create a snapshot of the site.
    snapshot:
    service: appserver
    cmd:
    - mysqldump -u root -h database -P 3306 backdrop > backdrop.sql
    - gzip -f backdrop.sql
    - cd www/files/config_* && tar -czf /app/config.tar.gz active
    - mysqldump --add-drop-database -Bu root -h database -P 3306 backdrop > /app/backdrop.sql
    - gzip -f /app/backdrop.sql
    - cd /app/www/files/config_* && tar -czf /app/config.tar.gz active
    - echo 'Snapshot created successfully'
    # Reset the site using the snapshot.
    reset:
    service: appserver
    cmd:
    - cd www/files/config_* && tar -xzf /app/config.tar.gz
    - gunzip backdrop.sql.gz
    - mysql -u root -h database -P 3306 backdrop < backdrop.sql
    - gzip -f backdrop.sql
    - cd /app/www/files/config_* && tar -xzf /app/config.tar.gz
    - gunzip /app/backdrop.sql.gz
    - mysql -u root -h database -P 3306 backdrop < /app/backdrop.sql
    - gzip -f /app/backdrop.sql
    - echo 'Site reset successfully'

    services:
    # Install phpMyAdmin.
    phpmyadmin:
    type: phpmyadmin
    # Link it to the default database service (see `lando info`).
    hosts:
    - database

    proxy:
    # Add a custom sub-domain for phpMyAdmin.
    phpmyadmin:
    - db.sandbox.lndo.site

  4. @BWpanda BWpanda revised this gist Jul 5, 2019. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion .lando.yml
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,7 @@ tooling:
    # Allow Drush to be run from any directory.
    drush:
    service: appserver
    cmd: drush --root=www
    cmd: drush --root=www --uri=https://sandbox.lndo.site
    # Create a snapshot of the site.
    snapshot:
    service: appserver
    @@ -44,3 +44,4 @@ proxy:
    # Add a custom sub-domain for phpMyAdmin.
    phpmyadmin:
    - db.sandbox.lndo.site

  5. @BWpanda BWpanda created this gist Jul 5, 2019.
    46 changes: 46 additions & 0 deletions .lando.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    name: sandbox

    # Use existing Backdrop recipe, then customise below.
    recipe: backdrop

    config:
    # Where Backdrop resides, relative to this file.
    webroot: www
    # Prefer MariaDB over MySQL.
    database: mariadb

    tooling:
    # Allow Drush to be run from any directory.
    drush:
    service: appserver
    cmd: drush --root=www
    # Create a snapshot of the site.
    snapshot:
    service: appserver
    cmd:
    - mysqldump -u root -h database -P 3306 backdrop > backdrop.sql
    - gzip -f backdrop.sql
    - cd www/files/config_* && tar -czf /app/config.tar.gz active
    - echo 'Snapshot created successfully'
    # Reset the site using the snapshot.
    reset:
    service: appserver
    cmd:
    - cd www/files/config_* && tar -xzf /app/config.tar.gz
    - gunzip backdrop.sql.gz
    - mysql -u root -h database -P 3306 backdrop < backdrop.sql
    - gzip -f backdrop.sql
    - echo 'Site reset successfully'

    services:
    # Install phpMyAdmin.
    phpmyadmin:
    type: phpmyadmin
    # Link it to the default database service (see `lando info`).
    hosts:
    - database

    proxy:
    # Add a custom sub-domain for phpMyAdmin.
    phpmyadmin:
    - db.sandbox.lndo.site