From 413e01a44d3f4abe85624d7c0670fb818f8094f4 Mon Sep 17 00:00:00 2001 From: Nikhil Joshua Date: Mon, 17 Apr 2023 19:21:12 +0530 Subject: [PATCH] Add lando config --- .gitignore | 2 - .lando.yml | 96 +++++++++++++++++++++++++++++++++++++++++++++++ .lando/mysql.cnf | 16 ++++++++ .lando/nginx.conf | 84 +++++++++++++++++++++++++++++++++++++++++ .lando/php.ini | 2 + .lando/wp-cli.yml | 1 + .lando/xdebug.sh | 26 +++++++++++++ 7 files changed, 225 insertions(+), 2 deletions(-) create mode 100644 .lando.yml create mode 100644 .lando/mysql.cnf create mode 100644 .lando/nginx.conf create mode 100644 .lando/php.ini create mode 100644 .lando/wp-cli.yml create mode 100755 .lando/xdebug.sh diff --git a/.gitignore b/.gitignore index 878a77cd4..0a75acd22 100755 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,4 @@ sftp-config.json *.sublime-workspace .phpintel selenium-debug.log -.lando.wp-cli.yml -.lando.yml /wordpress \ No newline at end of file diff --git a/.lando.yml b/.lando.yml new file mode 100644 index 000000000..5d4887b21 --- /dev/null +++ b/.lando.yml @@ -0,0 +1,96 @@ +name: rtmedia +recipe: wordpress +config: + via: nginx + php: "8.0" + webroot: wordpress + database: mariadb + # Keep it empty, to enable xdebug use `lando xdebug ` instead + xdebug: "" + config: + php: .lando/php.ini + database: .lando/mysql.cnf + vhosts: .lando/nginx.conf +services: + database: + volumes: + mariadb: { } + type: compose + creds: + user: wordpress + password: wordpress + database: wordpress + services: + image: mariadb:10.6.5 + command: docker-entrypoint.sh mariadbd + volumes: + - mariadb:/var/lib/mysql + environment: + MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: 1 + MARIADB_DATABASE: wordpress + MYSQL_DATABASE: wordpress + MARIADB_USER: wordpress + MARIADB_PASSWORD: wordpress + rediscache: + type: redis + mailhog: + type: mailhog + portforward: false + hogfrom: + - appserver + appserver: + overrides: + environment: + # 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' + - './mu-plugins:/app/wordpress/wp-content/mu-plugins' + - './plugins:/app/wordpress/wp-content/plugins' + - './rt-config:/app/wordpress/wp-content/rt-config' + - './themes:/app/wordpress/wp-content/themes' + - './uploads:/app/wordpress/wp-content/uploads' + build_as_root: + - curl -sL https://deb.nodesource.com/setup_14.x | bash - + - apt-get install -y nodejs + build: + - wp core download --force --skip-content + run: + - sleep 5 # For some reason, we have to wait at least a second till database is up. + - | # Create WordPress config file and add necessary constants and custom config + wp config create --dbhost=database --dbname=wordpress --dbuser=wordpress --dbpass=wordpress --dbprefix=wp_ --force --extra-php <'." + echo "Valid modes: https://xdebug.org/docs/all_settings#mode." + echo xdebug.mode = off > /usr/local/etc/php/conf.d/zzz-lando-xdebug.ini + if [ -f "/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini" ]; then + rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + fi + pkill -o -USR2 php-fpm +else + mode="$1" + echo xdebug.mode = "$mode" > /usr/local/etc/php/conf.d/zzz-lando-xdebug.ini + if [ ! -f "/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini" ]; then + docker-php-ext-enable xdebug + fi + 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