localgovdrupal / localgov_project

Project template for Drupal 10 sites built with the LocalGov Drupal distribution.
https://localgovdrupal.org
GNU General Public License v2.0
10 stars 8 forks source link

Don't require Lando users to have Composer\PHP on their host system #59

Open j4-m opened 2 years ago

j4-m commented 2 years ago

Hi folks

I'd like to gather some views on a problem. Presently the first step in our local development set up is:

composer create-project --stability dev localgovdrupal/localgov-project MY_PROJECT --remove-vcs

While this is a low-friction way to get started it does have the following problems:

The major advantage of using Lando is we only require users\developers to have Lando\Docker installed furthermore if the user composer installs on a different version of PHP to what's being used in Lando this has the potential to cause compatibility problems.

There is an issue on Lando's Github which relevant; as you can see there is presently no feature in Lando to address this though it does sound like this is something DDev has solved there's potential for this feature to be added to Lando.

In the meantime I believe we have some options to workaround this and give a better DX to boot. For example, we could have a one-liner such as:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/localgovdrupal/localgov_project/master/tools/install.sh)"

With install.sh looking something like:

#!/bin/bash
read -p 'directory name: ' DIRNAME
TARURL=$( curl -s https://api.github.com/repos/localgovdrupal/localgov_project/releases/latest | grep -o -P 'https://api.github.com/repos/localgovdrupal/localgov_project/tarball/\d\.\d\.\d')
echo "Downloading project template..."
echo $TARURL
curl $TARURL -L -o template.tar.gz
echo "Extracting project template..."
tar -xf template.tar.gz
echo "Removing archive..."
rm template.tar.gz
TARDIR=$(ls -l | grep -o 'localgovdrupal-localgov_project-.*')
mv $TARDIR $DIRNAME
echo "Starting Lando and installing LocalGov Drupal..."
cd $DIRNAME && lando start
lando composer install
lando drush si localgov -y
lando drush uli
echo "Congratulations! You have installed LocalGov Drupal"

Though I'm sure there's other, and better, ways we could do this hence this issue.

Admittedly, this isn't a problem which is relatively high priority at the moment but as the PHP version required by Drupal core rolls on and the LGD user base grows it has the potential to be a sticking point.

andybroomfield commented 2 years ago

Isn't the purpose of the create project for people to actually use as the basis for building their own sites? We cannot assume everyone uses Lando, BHCC Does not except for explicit development on Localgov Drupal (Mute point though since we arn't using the project and integrating modules in our own site). I assume the tests install through create-project without installing Lando on Github.

There is also the issue on Docker Desktop (required by Lando on Windows / Mac) is going pay for more users, and may have impact for councils if we force Lando as the only development solution.

Perhaps the way forward is to include both sets of instructions, one if you have composer and are building a new site, and one for if you are building with Lando for developing Localgov Drupal.

j4-m commented 2 years ago

Thanks for your feedback @andybroomfield, I totally agree. As you say, it's reasonable that someone will want to install LGD without using Lando and we should make that as easy as possible so having different guides, one for Lando another installing on a host, seems like the way forward.

I do still think the original sentiment of this issue stands however, if a user does want to use Lando then we shouldn't require them to have Composer\PHP installed locally...

finnlewis commented 2 years ago

I got caught out by not having a php module installed on my host machine, so composer dependencies bailed.

I'd be happy if we could offer a way to install without needing PHP on the host machine.

Fancy putting together a pull request based on your suggestions above @j4-m ?

finnlewis commented 1 year ago

Hey @j4-m ! Would you like to take this one further?

j4-m commented 1 year ago

Yes I do. Should only involve a small update to the installation doc.

gitressa commented 3 months ago

I agree that it's best to use DDEV or Lando's PHP/Composer, and not require it on the host machine. These simple steps work well in DDEV:

mkdir localgov && cd localgov
ddev config --project-type=drupal --php-version=8.3 --docroot=web
ddev start
ddev composer create localgovdrupal/localgov-project
ddev drush site:install localgov -y

Originally posted in How to create a local install with DDEV.