Project

General

Profile

Actions

Feature #76723

closed

Composer installation without symlinks

Added by Benjamin Hirsch over 8 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
composer
Target version:
-
Start date:
2016-06-22
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

I’m trying to setup TYPO3 on the Microsoft Azure Platform as a so called App Service / Web App. This is a fully managed and highly scalable environment running a IIS on Windows. For security reasons there are no symlinks or junctions allowed.

Actual scenario:

  • The whole project is versioned with GIT
  • TYPO3, Templates and even project related extension are in the same repository

Because of the security related problem with the symlinks, I need to configure the composer.json like this:

{
  "repositories": [
    {
      "type": "composer",
      "url": "https://composer.typo3.org" 
    }
  ],
  "require": {
    "typo3/cms-composer-installers": "1.3.0-rc1",
    "typo3/cms": "^7.0" 
  },
  "extra": {
    "typo3/cms": {
      "prepare-web-dir": false,
      "cms-package-dir": "{$vendor-dir}/typo3/cms",
      "web-dir": "public" 
    }
  }
}

This is working as intended, everything goes into the web-dir and no symlink is required. But the downside with this solution is, that every pre-existing folder / file like templates or extensions (web-dir/typo3conf/ext) are getting deleted.

When I’m trying it with the following settings:

{
  "repositories": [
    {
      "type": "composer",
      "url": "https://composer.typo3.org" 
    }
  ],
  "require": {
    "typo3/cms-composer-installers": "1.3.0-rc1",
    "typo3/cms": "^7.0" 
  },
  "extra": {
    "typo3/cms": {
      "cms-package-dir": "{$vendor-dir}/typo3/cms",
      "web-dir": "public" 
    }
  }
}

Composer stops with an exception because he can’t create symlinks. This is because of: https://github.com/TYPO3/CmsComposerInstallers/commit/7d5aea6148354169165642078e792cc76b359438
This was a patch which prevents composer from copying all related files/folders rather then trying to symlink. The problem is, that this patch is obviously necessary because a simple copy of the files / folders seems not to be enough to get TYPO3 up and running.

Does anyone have good solution for this type of problem? I’m currently a bit stuck with this. Maybe for the future it would be nice when the handling of the frontend and the backend request is done by simple rewrites, so it wouldn’t be necessary anymore to have a typo3 folder / symlink in the web-dir?

Actions #1

Updated by Helmut Hummel over 8 years ago

  • Status changed from New to Accepted
Actions #2

Updated by Benjamin Hirsch over 8 years ago

I accidentally added the wrong composer.json. The first one should look like this:

{
  "repositories": [
    {
      "type": "composer",
      "url": "https://composer.typo3.org" 
    }
  ],
  "require": {
    "typo3/cms-composer-installers": "1.3.0-rc1",
    "typo3/cms": "^7.0" 
  },
  "extra": {
    "typo3/cms": {
      "prepare-web-dir": false,
      "cms-package-dir": "public",
      "web-dir": "public" 
    }
  }
}
Actions #3

Updated by Helmut Hummel over 8 years ago

every pre-existing folder / file like templates or extensions (web-dir/typo3conf/ext) are getting deleted.

Can you elaborate on that please?

Actions #4

Updated by Helmut Hummel over 8 years ago

  • Status changed from Accepted to Needs Feedback
Actions #5

Updated by Helmut Hummel over 8 years ago

"cms-package-dir": "public",
"web-dir": "public"

Ah, well, this does not make sense and cannot work like that.

What you would need to do currently, is copy the typo3 folder, the index.php file and the vendor folder to the document root.

Make sure you deny access to vendor folder though for web requests.

Actions #6

Updated by Riccardo De Contardi about 8 years ago

  • Status changed from Needs Feedback to Accepted
Actions #7

Updated by Benni Mack about 8 years ago

  • Status changed from Accepted to Needs Feedback

Hey Benjamin,

the composer installer now allows to disable the symlinking process in order for you to set up your own configuration - does this solve your issue?

Actions #8

Updated by Helmut Hummel about 8 years ago

  • Status changed from Needs Feedback to Accepted

@Benni Mack That is what he used already. The thing is, you can't copy the typo3 folder as it would not work

Actions #9

Updated by Benjamin Hirsch almost 8 years ago

I think Johannes Goslar is on the right track with it's changes:
https://github.com/ksjogo/CmsComposerInstallers/commit/5fe63bc9f0401581092854c416b70d7c21b6cd8c

plus additional changes (snippet of a batch file, because it's from it's Azure template)`

:: fix autoload paths for the entry points
:: as these paths are different when not symlinked (why?)

call replace "(\.\./)*vendor/autoload.php" "../../../../../../../vendor/autoload.php" web\typo3\sysext\backend\Resources\Private\Php\backend.php web\typo3\sysext\backend\Resources\Private\Php\cli.php web\typo3\sysext\frontend\Resources\Private\Php\frontend.php
call replace "(\.\./)*vendor/autoload.php" "../../../../../vendor/autoload.php" web\typo3\sysext\install\Start\Install.php
call replace "(\.\./)*vendor/autoload.php" "../../../../../vendor/autoload.php" web\typo3\sysext\core\bin\typo3
call replace "(\.\./)*vendor/autoload.php" "../../../vendor/autoload.php" web\typo3\install\index.php
call replace "(\.\./)+vendor/autoload.php" "../../vendor/autoload.php" vendor\helhum\typo3-console\Scripts\typo3cms.php

@Helmut
The above listed paths should be the reason why simply copying fails.

Actions #10

Updated by Helmut Hummel over 7 years ago

  • Status changed from Accepted to Resolved

This is now resolved with version 1.4.x of typo3/cms-composer-installers and the generation of entry scripts in TYPO3 master.

It would also be possible with a few lines of code, to make this work older TYPO3 versions

Actions #11

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF