diff --git a/.github/workflows/create.yml b/.github/workflows/create.yml index b0e3f1d56..c1b1bf2a2 100644 --- a/.github/workflows/create.yml +++ b/.github/workflows/create.yml @@ -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 }} diff --git a/.gitignore b/.gitignore index 878a77cd4..83ace146c 100755 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ sftp-config.json *.sublime-workspace .phpintel selenium-debug.log -.lando.wp-cli.yml -.lando.yml -/wordpress \ No newline at end of file +.lando.local.yml +/wordpress +/slow.log +/profiler-output \ No newline at end of file diff --git a/.lando.yml b/.lando.yml new file mode 100644 index 000000000..84e5f3cfb --- /dev/null +++ b/.lando.yml @@ -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 --admin_email=lando@rtcamp.com --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 \ No newline at end of file diff --git a/.lando/php.ini b/.lando/php.ini new file mode 100644 index 000000000..f6350ede6 --- /dev/null +++ b/.lando/php.ini @@ -0,0 +1,2 @@ +memory_limit = 1G +xdebug.start_with_request = trigger \ No newline at end of file diff --git a/.lando/wp-cli.yml b/.lando/wp-cli.yml new file mode 100644 index 000000000..cd9c12c27 --- /dev/null +++ b/.lando/wp-cli.yml @@ -0,0 +1 @@ +path: /app/wordpress diff --git a/.lando/xdebug.sh b/.lando/xdebug.sh new file mode 100755 index 000000000..9fda6d2b6 --- /dev/null +++ b/.lando/xdebug.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +if [ "$#" -ne 1 ]; then + echo "Xdebug has been turned off, please use the following syntax: 'lando xdebug '." + 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