Compare commits

...

24 Commits

Author SHA1 Message Date
Aldo 89de042ef4
Merge 3774afee32 into 5f09c940c1 2024-01-11 19:37:28 -06:00
Michael Stenta 5f09c940c1 Use paratest to speedup tests in Github actions workflow #762 2024-01-11 13:02:52 -05:00
wotnak 8c1fd8fe11 Install pg_trgm PostgreSQL extension before starting tests to avoid race conditions when trying to automatically install it in concurrently run tests 2024-01-11 13:02:27 -05:00
wotnak 8ce641adc5 Revert "Use phpunit instead of paratest."
This reverts commit 6a9c872e9b.
2024-01-11 13:00:57 -05:00
Michael Stenta df0c25f047 Add step to configurable quick form documentation that describes setting #default_value. 2024-01-10 08:18:02 -05:00
Michael Stenta 1d6804d7b4 Remove accidentally merged placeholder text from docs/hosting/migration.md. 2024-01-10 08:17:25 -05:00
Michael Stenta f9225c05f4 farmOS 3.0.0 2024-01-05 11:45:48 -05:00
Michael Stenta 6d68c387fd Update entity_browser module to ^2.10 and remove patch merged upstream. 2024-01-05 11:40:51 -05:00
Michael Stenta 75f0a2f4b6 Update to Drupal 10.2 #765 2024-01-05 11:40:23 -05:00
Michael Stenta 3c77ef281d Update Drupal core to 10.2.1. 2024-01-05 11:40:02 -05:00
Paul Weidner ed0c286247 Remove time format from description
See https://www.drupal.org/node/3385058

Fix: Call to deprecated method formatExample() of class Drupal\Core\Datetime\Element\Datetime: in drupal:10.2.0 and is removed from drupal:11.0.0. There is no replacement.
2024-01-05 10:23:23 -05:00
Paul Weidner f3422c54e0 Update Drupal core to 10.2.0 2024-01-05 10:23:23 -05:00
Michael Stenta 5617e81a0d Issue #3410701: Deprecate d7_asset plugin 2024-01-04 16:45:35 -05:00
Michael Stenta 215b67b58a Composer documentation fixes #761 2024-01-04 06:07:57 -05:00
AlMaVizca 3774afee32
Merge development image into a single Dockerfile
Changes based on PR review
2023-12-29 23:15:10 +07:00
Michael Stenta 61845e53cb Composer create-project fails with "Could not find package farmos/project with stability stable." Fixes farmOS/composer-project#10
See https://github.com/farmOS/composer-project/issues/10
2023-12-27 12:35:00 -05:00
Michael Stenta 9f44c64e99 Fix typo in docs/hosting/composer.md. 2023-12-27 12:34:26 -05:00
AlMaVizca 53fd5ebbbb
Relocate php unit configuration 2023-12-23 14:00:19 +07:00
AlMaVizca 635adf1a04
Refactor composer dependencies to create the production image
Use docker stages to install dependencies and simplify the building script.
Prepare production image while keeping compatibility with the development image.

Fix typo

Relocate arguments to improve cache

Make single line for each env definition

Remove composer home path

Avoid installing recommended packages
2023-12-23 14:00:19 +07:00
AlMaVizca 3a25ca5d71
Avoid repeating common path
Use common path on entrypoint
2023-12-23 14:00:19 +07:00
AlMaVizca 4803e40043
Define baseimage with arguments required in multiple stages
Change versions, add common paths

Keep drupal path

Fix comment
2023-12-23 14:00:19 +07:00
wotnak a2bd7136cf Configure www service to wait for db service to be healthy instead of only started #758 2023-12-22 06:17:47 -05:00
wotnak 1773a2eae5 Add healthcheck to MariaDB container to ensure it is ready to accept external connections before reporting as ready #758 2023-12-22 06:17:37 -05:00
Paul Weidner 0e211cb33c Increase weight of Asset and Log tasks on canonical user route #757
The current weight of these menu items is 0 and makes it challenging to
place other menu tasks between Edit and Asset. I would like to add a
Notifications task item and keep it closer to the edit task.
2023-12-09 07:08:03 -08:00
18 changed files with 196 additions and 160 deletions

View File

@ -48,7 +48,7 @@ jobs:
# farmOS Composer project 3.x branch is always used.
- name: Build and save farmOS dev Docker image
run: |
docker build --build-arg FARMOS_REPO=https://github.com/${FARMOS_REPO} --build-arg FARMOS_VERSION=${FARMOS_VERSION} -t farmos/farmos:3.x-dev docker/dev
docker build --build-arg FARMOS_REPO=https://github.com/${FARMOS_REPO} --build-arg FARMOS_VERSION=${FARMOS_VERSION} -t farmos/farmos:3.x-dev --target dev docker
docker save farmos/farmos:3.x-dev > /tmp/farmos-dev.tar
- name: Cache farmOS dev Docker image
uses: actions/cache@v3
@ -92,10 +92,13 @@ jobs:
include:
- dbms: pgsql
DB_URL: pgsql://farm:farm@db/farm
processes: auto
- dbms: mariadb
DB_URL: mysql://farm:farm@db/farm
processes: auto
- dbms: sqlite
DB_URL: sqlite://localhost/sites/default/files/db.sqlite
processes: 1
steps:
- name: Print test matrix variables
run: echo "matrix.dbms=${{ matrix.dbms }}, matrix.DB_URL=${{ matrix.DB_URL }}"
@ -122,8 +125,12 @@ jobs:
# The www-container-fs-ready file is only created once we expect the containers to be online
# so waiting for that lets us know it is safe to start the tests
run: until [ -f ./www/www-container-fs-ready ]; do sleep 0.1; done
- name: Install pg_trgm PostgreSQL extension
# This avoids race conditions when trying to automatically install it in concurrently run tests.
if: matrix.dbms == 'pgsql'
run: docker compose exec -T db psql -U farm -c 'CREATE EXTENSION IF NOT EXISTS pg_trgm;'
- name: Run PHPUnit tests
run: docker compose exec -u www-data -T www phpunit --verbose /opt/drupal/web/profiles/farm
run: docker compose exec -u www-data -T www paratest -vv --processes=${{ matrix.processes }} /opt/drupal/web/profiles/farm
- name: Test Drush site install with all modules
run: docker compose exec -u www-data -T www drush site-install --db-url=${{ matrix.DB_URL }} farm farm.modules='all'
release:

View File

@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [3.0.0] 2024-01-05
This is the first "stable" release of farmOS v3. See the release notes for
[3.0.0-beta1] below for more information about major changes in the 3.x branch,
including breaking changes to be aware of.
### Changed
- [Increase weight of Asset and Log tasks on canonical user route #757](https://github.com/farmOS/farmOS/pull/757)
- [Update Drupal core to 10.2](https://github.com/farmOS/farmOS/pull/765)
### Deprecated
- [Issue #3410701: Deprecate d7_asset plugin](https://www.drupal.org/project/farm/issues/3410701)
### Fixed
- [Correct alter hook to add password grant to static scopes #755](https://github.com/farmOS/farmOS/pull/755)
@ -647,7 +662,8 @@ moving forward.
Drupal 7, which required a complete refactor of the codebase. By comparison,
updating from Drupal 9 to 10 will simply involve updating deprecated code.
[Unreleased]: https://github.com/farmOS/farmOS/compare/3.0.0-beta3...HEAD
[Unreleased]: https://github.com/farmOS/farmOS/compare/3.0.0...HEAD
[3.0.0]: https://github.com/farmOS/farmOS/releases/tag/3.0.0
[3.0.0-beta3]: https://github.com/farmOS/farmOS/releases/tag/3.0.0-beta3
[3.0.0-beta2]: https://github.com/farmOS/farmOS/releases/tag/3.0.0-beta2
[3.0.0-beta1]: https://github.com/farmOS/farmOS/releases/tag/3.0.0-beta1

View File

@ -18,13 +18,13 @@
"require": {
"cweagans/composer-patches": "^1.6",
"drupal/admin_toolbar": "^3.3",
"drupal/core": "10.1.6",
"drupal/core": "10.2.1",
"drupal/config_update": "^2.0@alpha",
"drupal/consumers": "^1.15",
"drupal/csv_serialization": "^4.0",
"drupal/date_popup": "^1.3",
"drupal/entity": "1.4",
"drupal/entity_browser": "2.9",
"drupal/entity_browser": "^2.10",
"drupal/entity_reference_integrity": "^1.1",
"drupal/entity_reference_revisions": "1.10",
"drupal/entity_reference_validators": "^1.0@beta",
@ -48,7 +48,7 @@
"drupal/subrequests": "^3.0.6",
"drupal/token": "^1.11",
"drupal/views_geojson": "^1.2",
"drush/drush": "^11.3",
"drush/drush": "^12.4.3",
"ext-simplexml": "*",
"itamair/geophp": "1.3"
},
@ -59,17 +59,13 @@
"patches": {
"drupal/core": {
"Issue #2429699: Add Views EntityReference filter to be available for all entity reference fields.": "https://www.drupal.org/files/issues/2021-12-02/2429699-453-9.3.x.patch",
"Issue #2339235: Remove taxonomy hard dependency on node module": "https://www.drupal.org/files/issues/2023-10-05/2339235-10.1.x-80.patch",
"Issue #2339235: Remove taxonomy hard dependency on node module": "https://www.drupal.org/files/issues/2024-01-03/2339235-10.2.x-82.patch",
"Issue #1874838: Allow exposed blocks to use 'Link display' settings": "https://www.drupal.org/files/issues/2021-11-11/1874838-26.patch",
"Issue #2909128: Autocomplete not working on Chrome Android": "https://www.drupal.org/files/issues/2023-07-11/2909128-92.patch",
"Issue #3349973: Automatically install pg_trgm extension on PostgreSQL 13+": "https://www.drupal.org/files/issues/2023-05-08/3349973-26.patch"
"Issue #2909128: Autocomplete not working on Chrome Android": "https://www.drupal.org/files/issues/2023-07-11/2909128-92.patch"
},
"drupal/entity": {
"Issue #3206703: Provide reverse relationships for bundle plugin entity_reference fields.": "https://www.drupal.org/files/issues/2022-05-11/3206703-10.patch"
},
"drupal/entity_browser": {
"Issue #3350169: Fix PHP 8.2 deprecation issue with WidgetSelectorBase-class": "https://www.drupal.org/files/issues/2023-06-15/3350169-8_0.patch"
},
"drupal/entity_reference_revisions": {
"Issue #3267304: Infer target_revision_id to be Latest Revision when Only a target_id is Provided": "https://www.drupal.org/files/issues/2022-05-13/3267304-9.patch"
},

View File

@ -1,12 +1,13 @@
{
"require": {
"cweagans/composer-patches": "^1.7",
"drupal/core-composer-scaffold": "10.1.6"
"drupal/core-composer-scaffold": "10.2.1"
},
"require-dev": {
"behat/mink": "^1.10",
"behat/mink-browserkit-driver": "^2.1",
"behat/mink-selenium2-driver": "^1.6",
"brianium/paratest": "^6",
"drupal/coder": "^8.3",
"mglaman/phpstan-drupal": "^1.1",
"mikey179/vfsstream": "^1.6",

View File

@ -1,7 +1,14 @@
# Use the official Drupal 10 image to build GEOS PHP extension.
FROM drupal:10.1 as php-dependencies
# Use the official Drupal 10 as base image.
FROM drupal:10.1 as baseimage
# Define common paths.
ENV FARMOS_PATH=/var/farmOS
ENV DRUPAL_PATH=/opt/drupal
##
# Build PHP extensions, GEOS and bcmath.
FROM baseimage as php-dependencies
# Build and install the GEOS PHP extension.
# See https://git.osgeo.org/gitea/geos/php-geos
ARG PHP_GEOS_VERSION=e77d5a16abbf89a59d947d1fe49381a944762c9d
ADD https://github.com/libgeos/php-geos/archive/${PHP_GEOS_VERSION}.tar.gz /opt/php-geos.tar.gz
@ -17,51 +24,119 @@ RUN apt-get update && apt-get install -y libgeos-dev \
# Install the BCMath PHP extension.
RUN docker-php-ext-install bcmath
# Inherit from the official Drupal 10 image.
FROM drupal:10.1
# Setup dependencies and sources for composer installations.
FROM baseimage as composer-file
# Set the farmOS and composer project repository URLs and versions.
ARG FARMOS_REPO=https://github.com/farmOS/farmOS.git
ARG FARMOS_VERSION=3.x
ARG PROJECT_REPO=https://github.com/farmOS/composer-project.git
ARG PROJECT_VERSION=3.x
ARG PROJECT_REPO=https://github.com/farmOS/composer-project/raw/${PROJECT_VERSION}/composer.json
# Set the COMPOSER_MEMORY_LIMIT environment variable to unlimited.
ENV COMPOSER_MEMORY_LIMIT=-1
# Allow root to install plugins.
ENV COMPOSER_ALLOW_SUPERUSER=1
ENV COMPOSER_NO_INTERACTION=1
# Install apt dependencies.
RUN apt-get update && apt-get install -y --no-install-recommends\
# Install git and unzip (needed by Composer).
git unzip
# Add the build-farmOS.sh script.
COPY build-farmOS.sh /usr/local/bin/
# Setup composer file for non interactive installation.
WORKDIR ${FARMOS_PATH}
RUN build-farmOS.sh
##
# Create layer with farmOS sources.
FROM composer-file as farmos-sources
# Install sources.
RUN composer install --no-dev
# Set the version in farm.info.yml.
RUN sed -i "s|version: 3.x|version: ${FARMOS_VERSION}|g" ${FARMOS_PATH}/web/profiles/farm/farm.info.yml
##
# Create layer with farmOS dev sources.
FROM farmos-sources as farmos-dev-sources
# Install sources.
RUN composer update
##
# Dependencies layer.
FROM baseimage as farmos-baseimage
# Set Apache ServerName directive globally to suppress AH00558 message.
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
# Install and enable geos.
# Enable PHP dependencies.
COPY --from=php-dependencies /usr/local/lib/php/extensions/ /usr/local/lib/php/extensions/
RUN docker-php-ext-enable geos bcmath
# Add custom PHP configurations.
COPY conf.d/ /usr/local/etc/php/conf.d
# Install apt dependencies.
RUN apt-get update && apt-get install -y \
# Install git and unzip (needed by Composer).
git unzip \
# Install apt dependencies and clean up.
RUN apt-get update && apt-get install -y --no-install-recommends\
# Install postgresql-client so Drush can connect to the database.
postgresql-client \
# Install libgeos-c1v5 so geos php extension can use libgeos_c.so.1.
libgeos-c1v5 \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Set the COMPOSER_MEMORY_LIMIT environment variable to unlimited.
ENV COMPOSER_MEMORY_LIMIT=-1
# Add the build-farmOS.sh script.
COPY build-farmOS.sh /usr/local/bin/
RUN chmod a+x /usr/local/bin/build-farmOS.sh
# Build the farmOS codebase in /var/farmoS with the --no-dev flag.
# Change the ownership of the sites directory and copy the farmOS codebase into /opt/drupal.
RUN mkdir /var/farmOS \
&& /usr/local/bin/build-farmOS.sh --no-dev \
&& chown -R www-data:www-data /var/farmOS/web/sites \
&& rm -r /opt/drupal && cp -rp /var/farmOS /opt/drupal
# Install git and unzip (needed by Composer).
git unzip \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean \
# Clean up ${DRUPAL_PATH}.
&& rm -r ${DRUPAL_PATH} \
&& mkdir ${DRUPAL_PATH}
# Set the entrypoint.
COPY docker-entrypoint.sh /usr/local/bin/
COPY --chown=www-data docker-entrypoint.sh /usr/local/bin/
# Set the working directory, entrypoint and command.
WORKDIR ${DRUPAL_PATH}
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["apache2-foreground"]
##
# Development image.
FROM farmos-baseimage as dev
# Change the user/group IDs of www-data inside the image to match the ID of the
# developer's user on the host machine. This allows Composer to create files
# owned by www-data inside the container, while keeping those files editable by
# the developer outside of the container.
# This defaults to 1000, based on the assumption that the developer is running
# as UID 1000 on the host machine. It can be overridden at image build time with:
# --build-arg WWW_DATA_ID=$(id -u)
ARG WWW_DATA_ID=1000
RUN usermod -u ${WWW_DATA_ID} www-data && groupmod -g ${WWW_DATA_ID} www-data
# Install and configure XDebug.
RUN yes | pecl install xdebug \
&& docker-php-ext-enable xdebug
# Add opcache revalidation frequency configuration.
COPY dev/conf.d/ /usr/local/etc/php/conf.d
# Add Configurations for PHP CodeSniffer, PHPStan
COPY --chown=www-data:www-data ./dev/files/ ${FARMOS_PATH}
# Add farmOS dev sources.
COPY --from=farmos-dev-sources --chown=www-data:www-data ${FARMOS_PATH} ${FARMOS_PATH}
# Configure PHPUnit.
RUN ${FARMOS_PATH}/phpunit.sh
##
# Final image.
FROM farmos-baseimage
# Add farmOS sources.
COPY --from=farmos-sources --chown=www-data:www-data ${FARMOS_PATH} ${DRUPAL_PATH}

35
docker/build-farmOS.sh Normal file → Executable file
View File

@ -2,26 +2,18 @@
set -e
###
# This script will build the farmOS codebase in /var/farmOS.
# This script will build the farmOS codebase in ${FARMOS_PATH},
# by default it is /var/farmOS.
###
# If /var/farmOS is not empty, bail.
if [ "$(ls -A /var/farmOS/)" ]; then
# If ${FARMOS_PATH} is not empty, bail.
if [ "$(ls -A ${FARMOS_PATH})" ]; then
echo "The ${FARMOS_PATH} is not empty, terminate."
exit 1
fi
# Make /var/farmOS the working directory.
cd /var/farmOS
# Generate an empty Composer project project and checkout a specific version.
git clone ${PROJECT_REPO} project
mv project/.git ./.git
rm -rf project
git checkout ${PROJECT_VERSION}
git reset --hard
# Create a temporary Composer cache directory.
export COMPOSER_HOME="$(mktemp -d)"
# Fetch composer template
curl -L ${PROJECT_REPO} -o composer.json
# If FARMOS_VERSION is a valid semantic versioning string, we assume that it is
# a tagged version.
@ -61,16 +53,3 @@ allowedPlugins=(
for plugin in ${allowedPlugins[@]}; do
composer config --no-plugins allow-plugins.$plugin true
done
# Run composer install with optional arguments passed into this script.
if [ $# -eq 0 ]; then
composer install
else
composer install "$*"
fi
# Set the version in farm.info.yml.
sed -i "s|version: 3.x|version: ${FARMOS_VERSION}|g" /var/farmOS/web/profiles/farm/farm.info.yml
# Remove the Composer cache directory.
rm -rf "$COMPOSER_HOME"

View File

@ -1,63 +0,0 @@
# Inherit from the farmOS 3.x image.
FROM farmos/farmos:3.x
# Set the farmOS and composer project repository URLs and versions.
ARG FARMOS_REPO=https://github.com/farmOS/farmOS.git
ARG FARMOS_VERSION=3.x
ARG PROJECT_REPO=https://github.com/farmOS/composer-project.git
ARG PROJECT_VERSION=3.x
# Install and enable XDebug extension.
RUN yes | pecl install xdebug \
&& docker-php-ext-enable xdebug
# Add opcache revalidation frequency configuration.
COPY conf.d/ /usr/local/etc/php/conf.d
# Change the user/group IDs of www-data inside the image to match the ID of the
# developer's user on the host machine. This allows Composer to create files
# owned by www-data inside the container, while keeping those files editable by
# the developer outside of the container.
# This defaults to 1000, based on the assumption that the developer is running
# as UID 1000 on the host machine. It can be overridden at image build time with:
# --build-arg WWW_DATA_ID=$(id -u)
ARG WWW_DATA_ID=1000
RUN usermod -u ${WWW_DATA_ID} www-data && groupmod -g ${WWW_DATA_ID} www-data
# Create a fresh /var/farmOS directory owned by www-data.
# We do this in two steps because of a known issue with Moby.
# @see https://github.com/farmOS/farmOS/pull/440
RUN rm -r /var/farmOS
RUN mkdir /var/farmOS && chown www-data:www-data /var/farmOS
# Change to the www-data user.
USER www-data
# Build the farmOS codebase in /var/farmOS.
RUN /usr/local/bin/build-farmOS.sh
# Add Configurartions for PHP CodeSniffer, PHPStan.
COPY --chown=www-data ./files/ /var/farmOS/
# Configure PHPUnit.
RUN cp -p /var/farmOS/web/core/phpunit.xml.dist /var/farmOS/phpunit.xml \
&& sed -i 's|bootstrap="tests/bootstrap.php"|bootstrap="web/core/tests/bootstrap.php"|g' /var/farmOS/phpunit.xml \
&& sed -i '/failOnWarning="true"/a \ failOnIncomplete="true"' /var/farmOS/phpunit.xml \
&& sed -i '/failOnWarning="true"/a \ failOnSkipped="true"' /var/farmOS/phpunit.xml \
&& sed -i 's|name="SIMPLETEST_BASE_URL" value=""|name="SIMPLETEST_BASE_URL" value="http://www"|g' /var/farmOS/phpunit.xml \
&& sed -i 's|name="SIMPLETEST_DB" value=""|name="SIMPLETEST_DB" value="pgsql://farm:farm@db/farm"|g' /var/farmOS/phpunit.xml \
&& sed -i 's|name="BROWSERTEST_OUTPUT_DIRECTORY" value=""|name="BROWSERTEST_OUTPUT_DIRECTORY" value="/var/www/html/sites/simpletest/browser_output"|g' /var/farmOS/phpunit.xml \
&& sed -i 's|name="MINK_DRIVER_ARGS_WEBDRIVER" value='\'''\''|name="MINK_DRIVER_ARGS_WEBDRIVER" value='\''["chrome", { "chromeOptions": { "w3c": false, "args": ["--disable-gpu","--headless", "--no-sandbox"] } }, "http://chrome:4444/wd/hub"]'\''|g' /var/farmOS/phpunit.xml \
&& sed -i 's|\./|\./web/core/|g' /var/farmOS/phpunit.xml \
&& sed -i 's|\.\./web/core/|\./web/|g' /var/farmOS/phpunit.xml \
&& sed -i 's| </php>| <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>'"\n"' </php>|g' /var/farmOS/phpunit.xml \
&& mkdir -p /var/farmOS/web/sites/simpletest/browser_output
# Change back to the root user.
USER root
# Copy the farmOS codebase into /opt/drupal.
RUN rm -r /opt/drupal && cp -rp /var/farmOS /opt/drupal
# Create a Composer config directory for the www-data user.
RUN mkdir /var/www/.composer && chown www-data:www-data /var/www/.composer

19
docker/dev/files/phpunit.sh Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env sh
cp -p ${FARMOS_PATH}/web/core/phpunit.xml.dist ${FARMOS_PATH}/phpunit.xml
sed -i 's|bootstrap="tests/bootstrap.php"|bootstrap="web/core/tests/bootstrap.php"|g' ${FARMOS_PATH}/phpunit.xml
sed -i '/failOnWarning="true"/a \ failOnIncomplete="true"' ${FARMOS_PATH}/phpunit.xml
sed -i '/failOnWarning="true"/a \ failOnSkipped="true"' ${FARMOS_PATH}/phpunit.xml
sed -i 's|name="SIMPLETEST_BASE_URL" value=""|name="SIMPLETEST_BASE_URL" value="http://www"|g' ${FARMOS_PATH}/phpunit.xml
sed -i 's|name="SIMPLETEST_DB" value=""|name="SIMPLETEST_DB" value="pgsql://farm:farm@db/farm"|g' ${FARMOS_PATH}/phpunit.xml
sed -i 's|name="BROWSERTEST_OUTPUT_DIRECTORY" value=""|name="BROWSERTEST_OUTPUT_DIRECTORY" value="/var/www/html/sites/simpletest/browser_output"|g' ${FARMOS_PATH}/phpunit.xml
sed -i 's|name="MINK_DRIVER_ARGS_WEBDRIVER" value='\'''\''|name="MINK_DRIVER_ARGS_WEBDRIVER" value='\''["chrome", { "chromeOptions": { "w3c": false, "args": ["--disable-gpu","--headless", "--no-sandbox"] } }, "http://chrome:4444/wd/hub"]'\''|g' ${FARMOS_PATH}/phpunit.xml
sed -i 's|\./|\./web/core/|g' ${FARMOS_PATH}/phpunit.xml
sed -i 's|\.\./web/core/|\./web/|g' ${FARMOS_PATH}/phpunit.xml
sed -i 's| </php>| <env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>'"\n"' </php>|g' ${FARMOS_PATH}/phpunit.xml
# Create output directory for phpunit tests and permissions for testing user.
mkdir -p ${FARMOS_PATH}/web/sites/simpletest/browser_output
chown -R www-data:www-data ${FARMOS_PATH}/web/sites/simpletest
rm ${FARMOS_PATH}/phpunit.sh

View File

@ -12,7 +12,15 @@ services:
MYSQL_DATABASE: farm
MYSQL_USER: farm
MYSQL_PASSWORD: farm
healthcheck:
test: [ "CMD", "healthcheck.sh", "--connect", "--innodb_initialized" ]
start_period: 1m
start_interval: 10s
interval: 1m
timeout: 5s
retries: 3
www:
depends_on:
- db
db:
condition: service_healthy

View File

@ -8,15 +8,15 @@ set -e
###
# If the Drupal directory is empty, populate it from pre-built files.
if [ -d /opt/drupal ] && ! [ "$(ls -A /opt/drupal/)" ]; then
if [ -d ${DRUPAL_PATH} ] && ! [ "$(ls -A ${DRUPAL_PATH}/)" ]; then
echo "farmOS codebase not detected. Copying from pre-built files in the Docker image."
cp -rp /var/farmOS/. /opt/drupal
cp -rp ${FARMOS_PATH}/. ${DRUPAL_PATH}
fi
# If the sites directory is empty, populate it from pre-built files.
if [ -d /opt/drupal/web/sites ] && ! [ "$(ls -A /opt/drupal/web/sites/)" ]; then
if [ -d ${DRUPAL_PATH}/web/sites ] && ! [ "$(ls -A ${DRUPAL_PATH}/web/sites/)" ]; then
echo "farmOS sites directory not detected. Copying from pre-built files in the Docker image."
cp -rp /var/farmOS/web/sites/. /opt/drupal/web/sites
cp -rp ${FARMOS_PATH}/web/sites/. ${DRUPAL_PATH}/web/sites
fi
if [ -n "$FARMOS_FS_READY_SENTINEL_FILENAME" ]; then

View File

@ -17,7 +17,9 @@ Available arguments and their default values are described below:
check out.
- Default: `3.x`
The `3.x-dev` image also provides the following:
## Development image
The `3.x-dev` image also provides the following build arguments:
- `WWW_DATA_ID` - The ID to use for the `www-data` user and group inside the
image. Setting this to the ID of the developer's user on the host machine
@ -26,3 +28,8 @@ The `3.x-dev` image also provides the following:
container. If your user ID is not `1000`, build the image with:
`--build-arg WWW_DATA_ID=$(id -u)`
- Default: `1000`
To build the development image, you will have to define the target dev,
for example:
`docker build --build-arg WWW_DATA_ID=$(id -u) -t farmos/farmos:3.x-dev --target dev docker`

View File

@ -244,9 +244,11 @@ To make an existing quick form configurable:
assigns configuration to `$this->configuration`.
6. Add a `config/schema/[mymodule].schema.yml` file that describes the
[configuration schema/metatdata](https://www.drupal.org/docs/drupal-apis/configuration-api/configuration-schemametadata).
7. Add `'#default_value' => $this->configuration['...']` lines to the form
elements that are configurable in the `buildForm()` method.
The following is the same "Harvest" example as above, with the new interface
and methods, followed by the schema file that describes the settings.
The following is the same "Harvest" example as above, with the changes described
above, followed by the schema file that describes the settings.
```php
<?php

View File

@ -70,7 +70,7 @@ next section.
To start your own project based on the farmOS project template, open a new
directory and run the following command:
composer create-project farmos/project
composer create-project farmos/project:3.x-dev
This will create a `composer.json` file in your directory, copied directly from
the [farmOS project template](https://packagist.org/packages/farmos/project).
@ -81,7 +81,7 @@ code repository with [Git](https://git-scm.com/):
```shell
git init
git add composer.json
git commit -m 'Intitial commit of my farmOS project.'
git commit -m 'Initial commit of my farmOS project.'
```
It is helpful to understand that your project is *not* farmOS, but rather

View File

@ -10,8 +10,6 @@ farmOS 2.x includes a **farmOS Migrate** module that leverage's Drupal core's
migrations for each asset type, log type, etc. These migrations are defined in
YML configuration files included with the farmOS Migrate module.
... migrate to 2.x then upgrade to 3.x
## Important considerations
* Do not migrate into a farmOS 2.x instance that already has records. This is

View File

@ -12,6 +12,11 @@ use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
* id = "d7_asset",
* source_module = "farm_asset"
* )
*
* @deprecated in farm:3.0.0 and is removed from farm:4.0.0. Support for farmOS
* v1 migrations was dropped in farmOS 3.x.
* @see https://www.drupal.org/project/farm/issues/3410701
* @see https://www.drupal.org/project/farm/issues/3382616
*/
class Asset extends FieldableEntity {

View File

@ -3,10 +3,7 @@
namespace Drupal\farm_field\Plugin\Field\FieldWidget;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Datetime\Element\Datetime;
use Drupal\Core\Datetime\Entity\DateFormat;
use Drupal\Core\Datetime\Plugin\Field\FieldWidget\TimestampDatetimeWidget;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Form\FormStateInterface;
/**
@ -26,17 +23,6 @@ use Drupal\Core\Form\FormStateInterface;
*/
class TimestampDatetimeOptionalWidget extends TimestampDatetimeWidget {
/**
* {@inheritdoc}
*/
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element = parent::formElement($items, $delta, $element, $form, $form_state);
$date_format = DateFormat::load('html_date')->getPattern();
$time_format = DateFormat::load('html_time')->getPattern();
$element['value']['#description'] = $this->t('Format: %format.', ['%format' => Datetime::formatExample($date_format . ' ' . $time_format)]);
return $element;
}
/**
* {@inheritdoc}
*/

View File

@ -1786,7 +1786,7 @@ display:
type: tab
title: Assets
description: ''
weight: 0
weight: 40
expanded: false
menu_name: account
parent: ''

View File

@ -2790,7 +2790,7 @@ display:
type: tab
title: Logs
description: ''
weight: 0
weight: 50
expanded: false
menu_name: main
parent: ''