Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Lando local development environment config #1924

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
ASSETS_DIR: wpassets
EXCLUDE_LIST: .bowerrc .gitattributes .gitignore .jshintrc .travis.yml CONTRIBUTING.md
Gruntfile.js README.md bin deploy.sh package-lock.json package.json phpcs.xml phpunit.xml
tests
tests .lando .lando.yml
SLUG: buddypress-media
WORDPRESS_PASSWORD: ${{ secrets.WORDPRESS_PASSWORD }}
WORDPRESS_USERNAME: ${{ secrets.WORDPRESS_USERNAME }}
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ sftp-config.json
*.sublime-workspace
.phpintel
selenium-debug.log
.lando.wp-cli.yml
.lando.yml
/wordpress
.lando.local.yml
/wordpress
/slow.log
/profiler-output
64 changes: 64 additions & 0 deletions .lando.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: rtmedia
recipe: wordpress
config:
via: nginx
php: 7.4
webroot: wordpress
database: mariadb
xdebug: true
config:
php: .lando/php.ini
services:
appserver:
overrides:
environment:
# Make this environment variable empty or else runtime xdebug mode change will not work
XDEBUG_MODE: ''
# Support debugging Drush with XDEBUG.
PHP_IDE_CONFIG: "serverName=appserver"
PROFILER_OUTPUT_DIR: "profiler-output" # If changing this value, change in .gitignore also
volumes:
- '.lando/wp-cli.yml:/wp-cli.yml'
- '.:/app/wordpress/wp-content/plugins/buddypress-media'
- '/app/wordpress/wp-content/plugins/buddypress-media/wordpress'
- '/app/wordpress/wp-content/plugins/buddypress-media/node_modules'
build_as_root:
- curl -sL https://deb.nodesource.com/setup_14.x | bash -
- apt-get install -y nodejs
- npm install -g npm@latest
build:
- wp core download --force --skip-content
- npm install
run:
- wp config create --dbname=wordpress --dbuser=wordpress --dbpass=wordpress --dbhost=database --skip-check --force
- wp config set WP_DEBUG true --raw
- wp config set WP_DEBUG_LOG true --raw
- wp config set WP_DEBUG_DISPLAY false --raw
- wp config set WP_DISABLE_FATAL_ERROR_HANDLER true --raw
- wp config set WP_ENVIRONMENT_TYPE 'local'
- sleep 2 # For some reason, we have to wait at least a second till database is up.
- | # If core is not installed, install it
if ! wp core is-installed; then
wp core install --url=https://$LANDO_APP_NAME.$LANDO_DOMAIN --title=$LANDO_APP_NAME --admin_user=rtcamp [email protected] --admin_password=goodwork
wp theme install --activate twentytwenty
wp plugin install --activate query-monitor
wp rewrite structure '/%postname%/'
# Not activating rtMedia directly when building containers because it does not allow us to debug
# issues that are specific to first time plugin activation
# wp plugin activate buddypress-media
fi
mailhog:
type: mailhog
portforward: false
hogfrom:
- appserver
tooling:
xdebug:
description: Loads Xdebug in the selected mode.
cmd:
- appserver: /app/.lando/xdebug.sh
user: root
node:
service: appserver
npm:
service: appserver
2 changes: 2 additions & 0 deletions .lando/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
memory_limit = 1G
xdebug.start_with_request = trigger
1 change: 1 addition & 0 deletions .lando/wp-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
path: /app/wordpress
20 changes: 20 additions & 0 deletions .lando/xdebug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

if [ "$#" -ne 1 ]; then
echo "Xdebug has been turned off, please use the following syntax: 'lando xdebug <mode>'."
echo "Valid modes: https://xdebug.org/docs/all_settings#mode."
echo xdebug.mode = off > /usr/local/etc/php/conf.d/zzz-lando-xdebug.ini
pkill -o -USR2 php-fpm
else
mode="$1"
echo xdebug.mode = "$mode" > /usr/local/etc/php/conf.d/zzz-lando-xdebug.ini
if [[ $mode = *"profile"* ]]; then
if [ ! -d "$PROFILER_OUTPUT_DIR" ]; then
mkdir "$PROFILER_OUTPUT_DIR"
chown $LANDO_HOST_UID:$LANDO_HOST_GID "$PROFILER_OUTPUT_DIR"
fi
echo xdebug.output_dir = "/app/$PROFILER_OUTPUT_DIR" >> /usr/local/etc/php/conf.d/zzz-lando-xdebug.ini
fi
pkill -o -USR2 php-fpm
echo "Xdebug is loaded in "$mode" mode."
fi