mhirdes
mhirdes

Reputation: 303

DDEV (and TYPO3): Where to store .htaccess, .env and DB and how to install them on ddev start

Currently when I clone the git repository where .ddev is set I need to install the DB and copy the .env and .htaccess file afterwards. I would like to do this with a hook and a specific command, like here: https://github.com/codeFareith/ddev-typo3cms-boilerplate/blob/master/.ddev/commands/host/autoinstall

  1. Is there any recommended folder where to store these assets (I've seen /data, /.fixture)?
  2. Is there a recommended way how to deal with .htaccess and .env.

a) Instead of using the .env use the web_environment config in ddev? https://ddev.readthedocs.io/en/latest/users/extend/customization-extendibility/#providing-custom-environment-variables-to-a-container

b) Instead of copy the .htaccess have it directly in git? I would not really prefere this.

Upvotes: 0

Views: 1252

Answers (1)

rfay
rfay

Reputation: 12975

That's a lot of questions at once. (In issues and questions, try to ask just one question at a time, and try to make it as specific as possible.)

  1. Where should I store database dumps or file tarballs? I use the .tarballs folder, which is gitignored in DDEV. But it's entirely up to you. There is not a recommended folder, unless the .gitignore's exclusion of .tarballs matters to you.
  2. .htaccess and .env: First, note that .htaccess is only for Apache sites, and DDEV uses nginx-fpm by default (which ignores .htaccess). But if you're using Apache, .htaccess is part of your code isn't it? So I'd expect you to check it in. Second, .env files can work, but they're a bit of a special case and need to be enabled using docker-compose magic, see https://ddev.readthedocs.io/en/stable/users/extend/customization-extendibility/#providing-custom-environment-variables-to-a-container, whereas using web_environment puts the environment variable in your .ddev/config.yaml where it's easy to check in.

Upvotes: 2

Related Questions