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

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

Open
j4-m opened this issue Sep 22, 2021 · 6 comments
Open

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

j4-m opened this issue Sep 22, 2021 · 6 comments
Assignees

Comments

@j4-m
Copy link

j4-m commented Sep 22, 2021

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 user will need to have Composer installed on their machine, presumably version 2
  • The user will need to have PHP installed on their machine and it should meet the version required by the version of Drupal core we're using
  • Any PHP extensions required by LocalGov Drupal or any of it's dependencies will also need to be installed

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
Copy link
Contributor

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
Copy link
Author

j4-m commented Sep 30, 2021

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
Copy link
Member

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
Copy link
Member

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

@j4-m
Copy link
Author

j4-m commented Feb 1, 2023

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

@gitressa
Copy link

gitressa commented Apr 29, 2024

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.

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

No branches or pull requests

4 participants