DDEV is not listed here https://getkirby.com/docs/cookbook/setup/development-environment
Anyone have a guide/tutorial for setting it up with DDEV?
Just follow their instructions, and you should be good to go. I did a quick test, and it worked, although it creates a DB container not needed for Kirby, so waste of resources, but I guess you can configure that.
Instead of using DDEV, you can set up your own docker containers: Kirby meets Docker | Kirby CMS
Yes, as DDEV is becoming more and more popular, it would be great to have it mentioned in the docs. Quite simple, but a bit specific.
We have used DDEV for Kirby development recently, I can share the notes we took:
Once DDEV is installed and running:
- Create a project directory and cd into it
- Run
ddev config --php-version=8.2 --omit-containers=db
Via download:
- Extract the contents of the ZIP file into your project directory
- Run
ddev start
Via composer:
- Run
ddev start
- Run
ddev composer create getkirby/starterkit
. Do NOT run composer create-project on your local machine!
You can now access the site via https://<foldername>.ddev.site
.
When you access the panel for the first time via /panel
, you will probably see an error message:
You can fix that by adding this line 'panel.install' => true
to site/config/config.php
PS:
Saw a FR about that in https://kirby.nolt.io/410. Looks like that the client IP will finally not be 127.0.0.1 when a request is passed through the DDEV router.
I already had ddev & docker desktop installed for craft cms development. Getting Kirby up and running was very straightforward.
I was unaware of the --omit-containers=db
flag, that’s a good one to remember for the next one, thanks!
Forgot to mention the CMS Quickstarts page from the DDEV docs. I believe they are very open to add other systems like Kirby to that page. Could also have a certain marketing effect…
Got a couple of additional questions about DDEV setup for Kirby:
Does it have any implications that DDEV uses the nginx web server by default?
See Running Kirby on a Nginx web server
DDEV ships with a default nginx config file which should be fine for most cases. However, it does not protect the content|site|kirby folders.
You can:
1. Don’t care
This is only your local dev setup, which is (hopefully) not used in production.
2. Update the nginx config file
Edit .ddev/nginx_full/nginx-site.conf
Delete this line:
#ddev-generated
Add this line:
rewrite ^\/(content|site|kirby)/(.*)$ /error last;
Run ddev restart
3. Use a public folder setup (recommended anyway)
Run ddev config --docroot=public --create-docroot && ddev restart
Move all your assets into the public folder.
Create an index.php
file in the public folder with this content.
4. Switch back to Apache…
Run ddev config --webserver-type=apache-fpm && ddev restart
How to access the site from local network?
By default, the myproject.ddev.site domain is only accessible from your local computer. Couple of options here, we used this one:
Run ddev config --host-webserver-port=57001 --bind-all-interfaces && ddev restart
, where you can use any free port.
Update site/config/config.php
according to docs.
Adding 'url' => '/'
worked for us.
You can now access the site via http://<ip>:57001
from anywhere in your local network.
Hey peps!
Thanks for this helpful thread!
Are there any folks here, that have used DDEV for Multisite Setup yet?
If so, how did you do it?
It seems a bit over-engineered and not very smart to create one ddev setup per site folder. That would create so many more containers.
Always changing the docroot
in DDEV’s config.yml
and then restarting is also not really an option…
Would be cool if someone else has got some ideas about that
I could be wrong, but maybe have a look at the ‘additional project hostnames’ setting?
(at least that’s what I use for multisite craftcms sites for local development)
There’s also a very active community on discord if you need ddev help (Support - DDEV Docs)
Thank you for your help on that,
just setting the additional hostnames option won’t be enough, that just creates another domain essentially.
But after quite some research I found out, there is a file in the .ddev/apache
or .ddev/nginx_full
folder called seconddocroot.conf.example
. You can clone this and follow the instructions in the Readme inside that folder, that way, you can setup another domain with a separate docroot, pointing to the individual entrypoint for one of the sites.
It’s also important to add these new domains under additional_hostnames
or additional_fqdns
in your config.yml
, otherwise the ssl won’t work.
At least that’s how it works for me now!