2020-04-26 16:54:05 +02:00
|
|
|
# Getting started
|
|
|
|
|
|
|
|
Follow these instructions to set up a local farmOS development environment.
|
|
|
|
|
|
|
|
The only requirements are [Docker](https://www.docker.com) and
|
|
|
|
[Docker Compose](https://docs.docker.com/compose).
|
|
|
|
|
|
|
|
## 1. Set up Docker containers
|
|
|
|
|
|
|
|
Run the following commands to create a farmOS directory and set up Docker
|
|
|
|
containers for farmOS and PostgreSQL:
|
|
|
|
|
|
|
|
mkdir farmOS && cd farmOS
|
2020-06-05 15:41:28 +02:00
|
|
|
curl https://raw.githubusercontent.com/farmOS/farmOS/2.x/docker/docker-compose.development.yml -o docker-compose.yml
|
2023-01-17 20:09:41 +01:00
|
|
|
docker compose up -d
|
2020-04-26 16:54:05 +02:00
|
|
|
|
|
|
|
## 2. Install farmOS
|
|
|
|
|
|
|
|
Open `http://localhost` in a browser and install farmOS with the following
|
|
|
|
database credentials:
|
|
|
|
|
|
|
|
- Database type: **PostgreSQL**
|
|
|
|
- Database name: `farm`
|
|
|
|
- Database user: `farm`
|
|
|
|
- Database password: `farm`
|
|
|
|
- Advanced options > Host: `db`
|
|
|
|
|
2020-06-03 15:09:37 +02:00
|
|
|
## 3. Develop
|
2020-04-26 16:54:05 +02:00
|
|
|
|
2023-10-06 17:39:06 +02:00
|
|
|
After starting the Docker containers, the root `farmOS` directory will contain
|
|
|
|
two new subdirectories: `www` and `db`.
|
|
|
|
|
|
|
|
The `www` directory contains the fully built farmOS codebase, which is
|
|
|
|
bind-mounted into the `www` container's `/opt/drupal` directory. The `www/web`
|
|
|
|
directory is used as the Apache webroot. Loading the `www` directory in your
|
|
|
|
favorite PHP IDE will provide easy code access to the full Symfony + Drupal +
|
|
|
|
farmOS stack.
|
|
|
|
|
|
|
|
The `db` directory contains the PostgreSQL database files, which is
|
|
|
|
bind-mounted into the `db` container's `/var/lib/postgresql/data` directory.
|
|
|
|
With the containers stopped, this directory can be backed up (eg: via tarball)
|
|
|
|
to create snapshots for easy rollback during development.
|
2020-06-06 13:35:10 +02:00
|
|
|
|
|
|
|
## Optional
|
|
|
|
|
|
|
|
### Configure private filesystem
|
|
|
|
|
2020-10-14 19:55:13 +02:00
|
|
|
In order to upload files, a private file path must be configured. The following
|
|
|
|
line must be added to `www/web/sites/default/settings.php`:
|
2020-06-06 13:35:10 +02:00
|
|
|
|
2020-10-14 19:55:13 +02:00
|
|
|
$settings['file_private_path'] = '/opt/drupal/web/sites/default/private/files';
|
2020-09-25 03:32:40 +02:00
|
|
|
|
2023-01-19 08:47:30 +01:00
|
|
|
Additionally, create the folder `/opt/drupal/web/sites/default/private/`.
|
|
|
|
|
|
|
|
Set the correct user and permissions:
|
|
|
|
|
|
|
|
Folder ownership and group should match the web server user. If you are using
|
|
|
|
the farmOS Docker image (running Apache), this will be `www-data`.
|
|
|
|
|
|
|
|
Folder permissions should be set to `770` or `drwxrwx---`.
|
|
|
|
|
|
|
|
Finally, make sure to clear the caches by visiting Administration >
|
|
|
|
Configuration > Development > Performance and clicking the `Clear all caches`
|
|
|
|
button, or use Drush via the command line: `drush cr`.
|
|
|
|
|
2020-09-25 03:32:40 +02:00
|
|
|
### Configure debugger
|
|
|
|
|
2020-10-12 02:19:28 +02:00
|
|
|
See [Debugging](/development/environment/debug).
|
2021-02-26 02:26:48 +01:00
|
|
|
|
|
|
|
### Enable HTTPS
|
|
|
|
|
|
|
|
See [HTTPS](/development/environment/https).
|