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

Composer based install fails for DOCROOT != public #54

Open
marble opened this issue Mar 11, 2022 · 5 comments
Open

Composer based install fails for DOCROOT != public #54

marble opened this issue Mar 11, 2022 · 5 comments

Comments

@marble
Copy link

marble commented Mar 11, 2022

Intro

I hope I'm reporting this problem at the proper location.
This is Ubuntu 20.04.4, ddev version v1.18.2, Composer version 2.2.6 2022-02-04 17:00:38

Task, intention

Do a composer based installation with DDEV as recommended first place at get.typo3.org

Problem

I've been desperately trying to find a procedure that allows a custom name for the docroot folder. No success. If I stick with the default name public it works. If I try with public_html it doesn't.

How to reproduce

I'm using these steps, top down, as far as I can get:

PROJECT=~/ddevprojects/dummy-project/dummy

PUBLIC_FOLDER=public

# http://dummy.ddev.site:8071
# http://dummy.ddev.site:44371


## Remove the project, in case it exists
true \
   &&  [[ ! -z "${PROJECT}" ]] \
   &&  ddev poweroff \
   &&  cd ${PROJECT}  \
   &&  ddev delete --omit-snapshot --yes \
   &&  cd ..  \
   &&  rm -rf ${PROJECT}


## Create project

true \
   &&  [[ ! -z "${PROJECT}" ]] \
   &&  mkdir -p ${PROJECT} \
   &&  cd ${PROJECT} \
   &&  ddev config \
       --create-docroot \
       --docroot=public \
       --http-port=8071 \
       --https-port=44371 \
       --php-version="7.4" \
       --project-type=typo3 \
       --xdebug-enabled=false \
   &&  echo '{}' >composer.json \
   &&  ddev composer config "extra.typo3/cms.web-dir" ${PUBLIC_FOLDER} \
   &&  ddev composer config "extra.typo3/cms.root-dir" ${PUBLIC_FOLDER} \
   &&  ddev composer create "typo3/cms-base-distribution:^10.4"  \
   &&  ddev typo3cms install:setup

Question(s)

  • What does it take to get public_html as docroot folder?
  • Where is that problem located?
@gilbertsoft
Copy link
Contributor

Not sure why you are asking the same question again here, I've posted you the solution here TYPO3/get.typo3.org#291 (comment)

Here the order of the commands is just wrong. Please stick to my example instead.

Now to your current problem here.

   &&  echo '{}' >composer.json \
   &&  ddev composer config "extra.typo3/cms.web-dir" ${PUBLIC_FOLDER} \
   &&  ddev composer config "extra.typo3/cms.root-dir" ${PUBLIC_FOLDER} \
   &&  ddev composer create "typo3/cms-base-distribution:^10.4"  \

These lines will:

  • create a composer.json
  • add some extra values
  • remove your files and create a new composer.json from the base-dist

@marble
Copy link
Author

marble commented Mar 12, 2022

In TYPO3/get.typo3.org#291 I am reporting that THE TEXT on the download page of get.typo3.org is ambiguous. IMHO that should be addressed. To the least, just make clear, that people don't change the value but use the lines EXACTLY as they are.

Why I'm asking here "again"? It's not again, it's something different. Here I'm asking about technical background that I want to learn and just get to work. You were kind enough over there to give some technical help. However, whatever I tried, I didn't get it working. And I reported that back in TYPO3/get.typo3.org#291 (comment) , "Still problematic", "Problem" So I think it's fair to continue asking.

I want to have a clear understanding of:

  1. Is it possible to give the docroot a different name?
  2. Is it supposed to be possible?
  3. If it should be possible: Can somebody provide an example that just works? I tried a lot of variations and couldn't find ONE way that works. So I want to know if it's just me doing something wrong. And how to overcome this.
  4. If it is not possible to use something different to public - then I'll just accept that and we can stop here. However, in that case it should really be a default value and should not appear as an option in the script at all.

@marble
Copy link
Author

marble commented Mar 12, 2022

Another try

Here is another try with a different order.

PROJECT=~/ddevprojects/dummy-project/dummy
PUBLIC_FOLDER=public_html

# http://dummy.ddev.site:8071
# http://dummy.ddev.site:44371


## Remove the project, in case it exists
true \
   &&  [[ ! -z "${PROJECT}" ]] \
   &&  ddev poweroff \
   &&  cd ${PROJECT}  \
   &&  ddev delete --omit-snapshot --yes \
   &&  cd ..  \
   &&  rm -rf ${PROJECT}


## Create project
true \
   &&  [[ ! -z "${PROJECT}" ]] \
   &&  mkdir -p ${PROJECT} \
   &&  cd ${PROJECT} \
   &&  ddev config \
       --create-docroot \
       --docroot=${PUBLIC_FOLDER} \
       --http-port=8071 \
       --https-port=44371 \
       --php-version="7.4" \
       --project-type=typo3 \
       --xdebug-enabled=false \
   &&  ddev composer create "typo3/cms-base-distribution:^10.4" --no-install \
   &&  ddev composer config "extra.typo3/cms.web-dir" ${PUBLIC_FOLDER} \
   &&  ddev composer install \
   &&  ddev typo3cms install:setup

Encountering this problem

036

Questions

  • Can it be done? docroot!=public?
  • How?

@bmack
Copy link
Member

bmack commented Mar 12, 2022

About 80% of the TYPO3 projects I'm working on since around 4 years do have a custom web-dir (not "public") so, the first question is "yes". Also with DDEV, however, I'm not using a bash script as you do. In addition, the option "web-dir" stems from the composer plugin https://github.com/TYPO3/CmsComposerInstallers - the Base Distribution is actually just a simple wrapper around a few TYPO3 Core packages.

composer create "typo3/cms-base-distribution:^10.4" --no-install bennitest
cd bennitest
composer config "extra.typo3/cms.web-dir" public_html
composer install
ddev config
> I define Docroot Location (current directory): public_html
ddev start

The folder structure looks good so far.

@marble
Copy link
Author

marble commented Mar 13, 2022

Great, ...

thank you @bmack , your 'bennitest' example is great for me: it works, it's educative and gives me a lot of freedom, personally I will use variations of your example. With my bash-like scripts I only want to document exactly what I'm doing.

What worries me

The very first installation method we - highly - recommend on the Get TYPO3 download page is this one:

ddev config --project-type=typo3 --docroot=public --create-docroot
ddev composer create "typo3/cms-base-distribution:^11.5"
ddev typo3cms install:setup
ddev launch

This looks like a great start, but IMHO it is not. It is to fragile. It suggests, that you can specify a docroot other than public. But you CANNOT, or it'll break. It'll also break as soon as you have somethe like ddev create ... --no-install and so on. It is just too fragile. There seems to be a conflict between ddev create and the implicite composer create-project.

IMHO something should be done about this on get.typo3.org!

A working solution with DDEV and no local composer

The point of the installation method at get.typo3.org seems to be that it ONLY uses DDEV and Docker, no local Composer.
Now, after having invested so much time into this, I had the ambition to find a way that works and to see whether I have understood things correctly.

And this is what is now working for me::

PROJECT_FOLDER_NAME=bennitest
PROJECT=~/ddevprojects/${PROJECT_FOLDER_NAME}-project/${PROJECT_FOLDER_NAME}
PUBLIC_FOLDER=public_html
PORT_DIGITS=73

# http://dummy.ddev.site:8073
# http://dummy.ddev.site:44373

## Remove the project, in case it exists
true \
   &&  [[ ! -z "${PROJECT}" ]] \
   &&  ddev poweroff \
   &&  cd ${PROJECT}  \
   &&  ddev delete --omit-snapshot --yes \
   &&  cd ..  \
   &&  rm -rf ${PROJECT}


## Create project
true \
   &&  [[ ! -z "${PROJECT}" ]] \
   &&  mkdir -p ${PROJECT} \
   &&  cd ${PROJECT} \
   &&  ddev config \
       --auto \
       --create-docroot \
       --docroot=${PUBLIC_FOLDER} \
       --project-name=${PROJECT_FOLDER_NAME} \
       --http-port=80${PORT_DIGITS} \
       --https-port=443${PORT_DIGITS} \
       --php-version="7.4" \
       --project-type=typo3 \
       --xdebug-enabled=false \
   &&  ddev start \
   &&  ddev exec 'composer create-project "typo3/cms-base-distribution:^10.4" --no-install' \
   &&  ddev exec 'mv cms-base-distribution/* .' \
   &&  ddev exec 'mv cms-base-distribution/.git* .' \
   &&  ddev exec 'rmdir cms-base-distribution' \
   &&  ddev composer config "extra.typo3/cms.web-dir" ${PUBLIC_FOLDER} \
   &&  ddev composer install \
   &&  ddev exec "touch ${PUBLIC_FOLDER}/FIRST_INSTALL" \
   &&  ddev launch

And this is what I get as a result of this:
037

I'm taken to the install tool website. I like that better than doing the site installation with the TYPO3 Console.

To do

  • Investigate about the conflict of ddev create and composer create-project. Problem: Somewhere on the way AdditionConfiguration.php goes missing ...
  • Present a foolproof recipe at get.typo3.org.
  • Add stuff to our installation guide?

marble added a commit to TYPO3-Documentation/TYPO3CMS-Tutorial-GettingStarted that referenced this issue Mar 16, 2022
People should know that they can't use a different value for 'docroot'. 
See also:
* TYPO3/get.typo3.org#291
* TYPO3/TYPO3.CMS.BaseDistribution#54
* ddev/ddev#3701
marble added a commit to TYPO3-Documentation/TYPO3CMS-Tutorial-GettingStarted that referenced this issue Mar 22, 2022
People should know that they can't use a different value for 'docroot'. 
See also:
* TYPO3/get.typo3.org#291
* TYPO3/TYPO3.CMS.BaseDistribution#54
* ddev/ddev#3701
mbrodala pushed a commit to TYPO3-Documentation/TYPO3CMS-Tutorial-GettingStarted that referenced this issue Mar 24, 2022
People should know that they can't use a different value for 'docroot'. 
See also:
* TYPO3/get.typo3.org#291
* TYPO3/TYPO3.CMS.BaseDistribution#54
* ddev/ddev#3701
linawolf pushed a commit to TYPO3-Documentation/TYPO3CMS-Tutorial-GettingStarted that referenced this issue Apr 7, 2022
People should know that they can't use a different value for 'docroot'.
See also:
* TYPO3/get.typo3.org#291
* TYPO3/TYPO3.CMS.BaseDistribution#54
* ddev/ddev#3701

(cherry picked from commit de2b98c)
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

3 participants