Skip to content

Instantly share code, notes, and snippets.

@stpaultim
Last active September 22, 2022 19:44
Show Gist options
  • Save stpaultim/f630617920725cdeb60246f1ed60a4c5 to your computer and use it in GitHub Desktop.
Save stpaultim/f630617920725cdeb60246f1ed60a4c5 to your computer and use it in GitHub Desktop.
Lando config: Backdrop sandbox
name: sandbox
# Use existing Backdrop recipe, then customise below.
recipe: backdrop
config:
# Where Backdrop resides, relative to this file.
webroot: .
# Prefer MariaDB over MySQL.
database: mysql:8.0
php: 7.4
services:
# Install phpMyAdmin.
phpmyadmin:
type: phpmyadmin
# Link it to the default database service (see `lando info`).
hosts: database
appserver:
build:
- ssh --service appserver --user root --command "apt-get update && apt install vim -y"
# Install Backdrop Console (`b`).
- 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
tooling:
bee:
service: appserver
cmd: /usr/local/bin/bee/bee.php
# Allow Drush to be run from any directory.
drush:
service: appserver
cmd: drush --root=/app --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
- cd /app/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/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
- echo 'Site reset successfully'
proxy:
# Add a custom sub-domain for phpMyAdmin.
phpmyadmin:
- db.sandbox.lndo.site
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment