Installing on DDEV via Composer

I’m a bit stuck with installing farmOS via Composer onto DDEV.

I’ve tried the recommended options on the documentation (Docker and Github clone, even tried manually downloading the source code), but none have worked.

I would have expected to either: composer create-project farmos/composer-project my_farm --no-install and then configure DDEV and run composer install

Or install Drupal 9 into DDEV, then make a requirement with composer require farmos/farmos but that fails, even if Drupal 9.5.8 is specified.

Neither has worked. Any suggestions, or should this be raised as an issue?


Welcome to the forum @rgcarr! :smiley:

I can’t speak to this myself because I don’t use DDEV, but I know that both @paul121 and @pcambra do, and I know it’s possible with farmOS.

If you can provide any more details on the issues you ran into with the official documentation, perhaps I can help work through that with you.

Following commands worked for me to setup clean farmOS instance using DDEV:

mkdir farmos-ddev
cd farmos-ddev
ddev config --project-type=drupal9 --docroot=web --create-docroot
ddev start
ddev composer create "farmos/project:2.x-dev"

Now to finish farmOS installation process, you can open project in the browser ddev launch or install Drush and finish installation using commands:

ddev composer req drush/drush
ddev drush si

Thanks @wotnak it was the composer create "farmos/project:^2" that sorted it

This would be really useful to add to the documentation at Getting started | farmOS as it would help those using DDEV or Lando (and probably most other local dev setups).

Is there an Github issue queue for the documentation, as it would be easy to create a PR for this?

1 Like

Website issue queue is at Issues · farmOS/ · GitHub, but this specific page is sourced from the main farmOS repo

1 Like

@rgcarr Glad you figured it out!

I think this would make a great community blog post! If you are interested in contributing a “how to” for setting up a farmOS development environment with DDEV you can create a new post in this repo and open a pull request: GitHub - farmOS/farmOS-community-blog: Community blog posts hosted on the website

I’m wary about adding DDEV/Lando specific stuff to the “official” development environment instructions, because a) I don’t want to make either a dependency for the official instructions, and b) it means the maintainers need to ensure that the extra instructions continue to work in the future. That’s the beauty of community blog posts - they can be dated and focused on a specific context/workflow - and there’s less pressure for us to maintain their accuracy. :slight_smile:


Yes! I’ve been using DDEV for well over a year and it makes me really happy. IMO it is much much easier to use for local development than our official docker workflow, especially when you are working on multiple “projects” and need separate environments for each one.

Here is my DDEV template that I copy/paste when starting new farmOS projects:

I mostly agree, but it would be nice if we could include a link in our official development docs that point to these other options so that they are more visible. In my experience I have seen a much higher success rate when pointing people to using DDEV vs our custom docker instructions :person_shrugging: A big problem that DDEV solves is the docker compatibility/performance issue across different operating systems.

Example: I work on a project with .ddev configuration commited. I shared DDEV installation instructions with 2 devs, one using Mac, one using Windows. All they needed was git clone, ddev start, copy DB dump then ddev pgsql_import and they were up and running.


Forgot to mention earlier but we also have this doc now (recently added): Building farmOS with Composer | farmOS

farmOS on ddev with postgres and php-geos can be done using folowing commands:

ddev config --project-type=drupal9 --docroot=web --create-docroot --database=postgres:15 --php-version=8.1
ddev get wotnak/ddev-php-geos
ddev start
ddev composer create farmos/project:2.x-dev
ddev drush site:install

DDEV currently supports postgresql natively, so all that have to be done is to set database type to postgres. It also allows to use ddev import-db --src=path/to/dump.sql.gz command to import database dump to postgres db.
When it comes to php-geos it must be installed in the way paul121 had done it in GitHub - paul121/farmos-ddev-template: Template for farmOS development with DDEV, but it can be simplified by creating custom ddev addon that will allow installing php-geos using single command (ddev get <addon>) without manually modifying any files.


So awesome! @wotnak has answered my next step questions I had above. Lets work on getting this into a blog post here: Add instructions for using DDEV by rgcarr · Pull Request #19 · farmOS/farmOS-community-blog · GitHub


Cross-posting this related GitHub issue that was just opened: Composer create-project fails with "Could not find package farmos/project with stability stable." · Issue #10 · farmOS/composer-project · GitHub

We should probably give some thought to adding tagged releases to the farmOS/composer-project repository, so that composer create-project farmos/project works as expected.