-
-
Notifications
You must be signed in to change notification settings - Fork 579
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
Explicit Craft CMS support #3594
Comments
Absolutely awesome! What usually goes with explicit CMS support is a specific nginx config, auto-detection, and settings creation, along with optional nonstandard defaults, like db or php version and automated testing . If you can lay those out it will help this move forward. A PR would be lovely... That's how we got Magento and Magento 2. |
Another interim step would be to just do a quick start in the docs. |
Awesome! To start:
Some of this is outside my comfort zone but I'm happy to learn and to put time in on this if it helps. Also totally happy to stand back and let the expert(s) figure it out if that's easier. |
A great start! |
I will gladly help here, if i can. In my experience however, there is not much to do (nothing in fact) to support Craft CMS in ddev out of the box. @JPBarringer could you specify what configuration did you found missing for Craft using ddev? |
I have to agree with @juban, I'm working with Craft daily and have to say the support for Craft in DDEV is phenomenal. Haven't experienced any issues running Craft 2, 3 or 4 with the default PHP project type. Everything is set up as it should be set up and everything works flawlessly (and really fast, too!) If you want to see (or use) an example of a Craft 4 + DDEV project, I've set up a scaffolding project you might want to check out. |
With the announcement of Craft CMS retiring their docker based environment Nitro, I'm sure the Craft CMS dev team will be interested in providing smooth Craft CMS support. DDEV has even been touted as a replacement for those currently running Nitro (me included) to move to DDEV. Although it does look like the plain PHP project option seems to work well without specifics. |
Reasons for explicit CraftCMS support:
|
Hi @rfay
I've been using DDEV with Craft (v2, v3 and v4) for almost 4 years now without any issues and no specific DDEV setup needed. The only thing I do is adding image processing libs to ease the use of certain Craft plugins like ImageOptimize (by adding Don't get me wrong, I'm not saying there's no room for improvements in DDEV documentation regarding Craft, in the QuickStart section for instance, but I'm wondering if we really need these specific extra configurations (maybe a bit overkill IMO). |
In doing support for people I've run across a couple of situations where DDEV could make craft usage easier for folks that don't already know everything about craft, and I'd like to capture those so will continue to update above. |
OK, makes sense. I guess we could come up with a specific Craft CMS support which could add the craft command and add a default .env file with a db connections preset. You convinced me :) That said, all in all, Craft is a pretty easy living CMS for developers and does not require much specific setup (if not none), and I can confirm that the default Ngnix configuration just work just fine as is. |
The default How I know it doesn't work?I haven't set the |
Ah yes, upload_dir. Added that to the list above. DDEV has no idea where upload_dir is by default in a craft project that's set to project type php. Added to the list. And for other project types, DDEV would have figured it out even with a custom docroot. |
Well in fact, there is none as Craft do not assume anything about your projet needs. It's up to developer or admin to choose the "upload_dir" (somewhere within the |
How is the upload dir configured? In most CMSs, configuration like this is provided somewhere in code. Can the database configuration be provided in code, like Drupal does settings.php or WordPress does wp-config.php? |
In Craft, you define Volumes and Assets elements using the project configuration. |
Regarding database configuration, as said before, the best place would be the .env file to define |
So a Craft project type could create a .env file like is done for Laravel... |
Could you please provide links to the docs about upload_dir and db config? |
Exactly 👍
For the DB part: https://craftcms.com/docs/4.x/config/db-settings.html For assets management, there is no documentation for an Something like: environment_variables:
projectpath: /var/www/staging/${DDEV_PROJECT}/current
craftmedia: web/media
clearfolders: 'library'
auth_command:
command: |
set -eu -o pipefail
tsh --proxy=myteleportserver.com ls
service: host
db_pull_command:
command: |
set -eu -o pipefail
tsh ssh myserver.com php8.0 ${projectpath}/craft db/backup ${projectpath}/db.sql
tsh ssh myserver.com gzip -c "${projectpath}/db.sql > ${projectpath}/db.sql.gz"
tsh scp myserver.com:${projectpath}/db.sql.gz .ddev/.downloads/
service: host
files_pull_command:
command: |
set -eu -o pipefail
tsh ssh myserver.com tar --dereference -czf ${projectpath}/files.tar.gz -C ${projectpath}/${craftmedia} .
tsh scp myserver.com:${projectpath}/files.tar.gz .ddev/.downloads/
service: host
files_import_command:
command: |
set -eu -o pipefail
mkdir -p ${craftmedia}
rm -rf ${craftmedia}/{${clearfolders}}
tar -zxf .ddev/.downloads/files.tar.gz -C ${craftmedia}
service: host
|
TYPO3 also can have more than one "uploads", and Drupal has both public and private, so DDEV's single dir is a long-term mistake :) Thanks for the help! |
We got you :) |
…ddev#4176)" This reverts commit fa782e9.
Is your feature request related to a problem? Please describe.
I manage a lot of Craft CMS (and Bedrock/WP) sites. It would be nice if DDEV had a Craft recipe/support built in.
(craftcms.com)
Describe the solution you'd like
Built-in detection of and support for Craft sites. It's basically just a composer-managed LAMP app but it would be nice if existing .env files could be parsed (and new environment variables set or .env generated) for setup.
Describe alternatives you've considered
Building it myself. -- not super familiar with the process here or with golang, however. (Or with setting environment variables in the container.)
Craft also has their own local, containerized runtime called Nitro. But I'd prefer to standardize around a single local dev setup.
Additional context
Installation instructions: https://craftcms.com/docs/3.x/installation.html
Configuration: https://craftcms.com/docs/3.x/config/
Craft has a full-featured CLI: https://craftcms.com/docs/3.x/console-commands.html
It occurs to me that handling .env files and/or setting env variables in the container might be useful for Bedrock (WP) support as well – no need to modify wp-config in that case.
The text was updated successfully, but these errors were encountered: