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

Automate Drupal setup #33

Closed
wants to merge 2 commits into from
Closed

Conversation

tyler36
Copy link
Collaborator

@tyler36 tyler36 commented Jun 4, 2024

This PR is an attempt to automate the steps for installtion on Drupal.

This address issues #30 .

Hopefully, this will trigger similar PRs for other frameworks when this is merge.

@tyler36 tyler36 marked this pull request as ready for review June 4, 2024 07:26
@tyler36
Copy link
Collaborator Author

tyler36 commented Jun 4, 2024

Was asked on slack

I ... wonder... can it just ask if you want to autoconfigure?

Thoughts?

@rfay
Copy link
Member

rfay commented Jun 5, 2024

It is possible to ask questions at install time, but it's tweaky. ddev-platformsh asks for config items (keys).

and

@tyler36
Copy link
Collaborator Author

tyler36 commented Aug 6, 2024

Hopefully, we can do something when ddev/ddev/pull/6406 gets merged.

@sreichel
Copy link
Contributor

sreichel commented Oct 31, 2024

Mabe we can split this to make it work for all?

For Drupal it seems to be required to update the settings.php ... for OpenMage it would be enough to copy default settings - ddev.xhgui.php - to app/etc/includes path, thats autoloaded. I guess other frameworks have custom autoload paths too. (?)

For me this works perfect ... no need to edit Mage.php as i added to README :(

if (getenv('IS_DDEV_PROJECT') && getenv('NO_XHGUI') !== '1') {
    if (file_exists($xhgui = '/mnt/ddev_config/xhgui/collector/xhgui.collector.php')) {
        require_once $xhgui;
    }
}

Note: NO_XHGUI env

With having xhgui.collector included phpunit (9.6, php7.4) fails with ...

running testsSerialization of 'Closure' is not allowed

To fix, i added this to phpunit.xml.dist

    <php>
        <env name="NO_XHGUI" value="1"/>
    </php>

@sreichel
Copy link
Contributor

@rfay why confused?

@rfay
Copy link
Member

rfay commented Oct 31, 2024

Sorry @sreichel , I don't understand your question or what it's referring to.

@rfay why confused?

@sreichel
Copy link
Contributor

I asked why you reacted with a "confused" emoji.

@rfay
Copy link
Member

rfay commented Oct 31, 2024

I don't have very good vision. I thought it was a smiley.

Comment on lines +26 to +27
chmod +x xhgui/scripts/setup-drupal.sh
xhgui/scripts/setup-drupal.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
chmod +x xhgui/scripts/setup-drupal.sh
xhgui/scripts/setup-drupal.sh
chmod +x xhgui/scripts/setup.sh
xhgui/scripts/setup.sh

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you suggesting to use a generic setup script?

The original though was that each framework would use it's own setup file, if required.
This would help isolate all the framework-specific command making it easier to add/update/remove as required.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that was my idea.

I thought it would be easier to maintain.

For OpenMage it would be enough to copy settings.ddev.xhgui.php to a given location thats autoloaded.

@sreichel
Copy link
Contributor

Made some suggestions. setup.sh needs to be updated, to switch project types ...i'll try to make PR later.

Comment on lines +12 to +13
- xhgui/scripts/setup-drupal.sh
- xhgui/scripts/settings.ddev.xhgui.php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- xhgui/scripts/setup-drupal.sh
- xhgui/scripts/settings.ddev.xhgui.php
- xhgui/scripts/setup.sh
- xhgui/scripts/ddev.xhgui.php

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sreichel
Copy link
Contributor

Untested seetup.sh (drupal versions needs to be fixed)

#!/usr/bin/env bash
#ddev-generated
set -e

XHGUI_SETTINGS=ddev.xhgui.php

case $DDEV_PROJECT_TYPE in

  magento)
    # Copy over settings
    cp xhgui/scripts/$XHGUI_SETTINGS $DDEV_APPROOT/$DDEV_DOCROOT/app/etc/includes/
    ;;

  drupal | drupal)
    # Early return if disable_settings_management is true.
    if ( ddev debug configyaml 2>/dev/null | grep 'disable_settings_management:\s*true' >/dev/null 2>&1 ) ; then
      exit 0
    fi
    
    # Copy over settings
    cp xhgui/scripts/$XHGUI_SETTINGS $DDEV_APPROOT/$DDEV_DOCROOT/sites/default/
    
    # Add settings
    SETTINGS_FILE_NAME="${DDEV_APPROOT}/${DDEV_DOCROOT}/sites/default/settings.php"
    echo "Settings file name: ${SETTINGS_FILE_NAME}"
    grep -qF $XHGUI_SETTINGS $SETTINGS_FILE_NAME || echo "
    // Include settings required for XHGUI.
    if ((file_exists(__DIR__ . '/$XHGUI_SETTINGS') && getenv('IS_DDEV_PROJECT') == 'true')) {
      include __DIR__ . '/$XHGUI_SETTINGS';
    }" >> $SETTINGS_FILE_NAME
    ;;
  *)
    # echo -n "?"
    ;;
esac

# Add perftools/php-profiler
if ( ddev composer show --all | grep -v perftools/php-profiler >/dev/null 2>&1 ) ; then
  ddev composer require perftools/php-profiler --dev
fi

@sreichel
Copy link
Contributor

Hopefully, this will trigger similar PRs for other frameworks when this is merge

Can i help?

@stasadev
Copy link
Member

Hi @sreichel,

Thank you for your suggestion. We apologize for the delay in addressing your changes. The maintainer is currently unavailable but is expected to return in about a week. Your patience is greatly appreciated!

@tyler36
Copy link
Collaborator Author

tyler36 commented Dec 17, 2024

Thank you for your patience.

I'm still wondering if I prefer the suggested single script approach of the per-framework approach.

There is also a TYPO-3 budget discussion about wether to incorporate XHGui directly into DDEV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants