Change all references of 2.x to 3.x in code, docs, and workflows.
This commit is contained in:
parent
ac64b7ce27
commit
e417ee9ad6
|
@ -4,13 +4,13 @@ on:
|
||||||
- cron: '0 8 * * *' # Run at 8AM UTC.
|
- cron: '0 8 * * *' # Run at 8AM UTC.
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- '2.x'
|
- '3.x'
|
||||||
- '2.x-**'
|
- '3.x-**'
|
||||||
tags:
|
tags:
|
||||||
- '2.*'
|
- '3.*'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- '2.x'
|
- '3.x'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -22,7 +22,7 @@ jobs:
|
||||||
- name: Set default FARMOS_REPO and FARMOS_VERSION.
|
- name: Set default FARMOS_REPO and FARMOS_VERSION.
|
||||||
run: |
|
run: |
|
||||||
echo "FARMOS_REPO=${GITHUB_REPOSITORY}" >> $GITHUB_ENV
|
echo "FARMOS_REPO=${GITHUB_REPOSITORY}" >> $GITHUB_ENV
|
||||||
echo "FARMOS_VERSION=2.x" >> $GITHUB_ENV
|
echo "FARMOS_VERSION=3.x" >> $GITHUB_ENV
|
||||||
- name: Set FARMOS_VERSION for branch push event.
|
- name: Set FARMOS_VERSION for branch push event.
|
||||||
if: github.event_name == 'push' && github.ref_type == 'branch'
|
if: github.event_name == 'push' && github.ref_type == 'branch'
|
||||||
run: echo "FARMOS_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
|
run: echo "FARMOS_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
|
||||||
|
@ -34,27 +34,27 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
echo "FARMOS_VERSION=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
|
echo "FARMOS_VERSION=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
|
||||||
echo "FARMOS_REPO=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV
|
echo "FARMOS_REPO=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_ENV
|
||||||
- name: Build and save farmOS 2.x Docker image
|
- name: Build and save farmOS Docker image
|
||||||
run: |
|
run: |
|
||||||
docker build --build-arg FARMOS_REPO=https://github.com/${FARMOS_REPO} --build-arg FARMOS_VERSION=${FARMOS_VERSION} -t farmos/farmos:2.x docker
|
docker build --build-arg FARMOS_REPO=https://github.com/${FARMOS_REPO} --build-arg FARMOS_VERSION=${FARMOS_VERSION} -t farmos/farmos:3.x docker
|
||||||
docker save farmos/farmos:2.x > /tmp/farmos-2x.tar
|
docker save farmos/farmos:3.x > /tmp/farmos.tar
|
||||||
- name: Cache farmOS 2.x Docker image
|
- name: Cache farmOS Docker image
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: /tmp/farmos-2x.tar
|
path: /tmp/farmos.tar
|
||||||
key: farmos-2x-${{ github.run_id }}
|
key: farmos-${{ github.run_id }}
|
||||||
# This builds the dev Docker image using the specified FARMOS_VERSION,
|
# This builds the dev Docker image using the specified FARMOS_VERSION,
|
||||||
# but notably it does NOT override the default PROJECT_VERSION, so the
|
# but notably it does NOT override the default PROJECT_VERSION, so the
|
||||||
# farmOS Composer project 2.x branch is always used.
|
# farmOS Composer project 3.x branch is always used.
|
||||||
- name: Build and save farmOS 2.x-dev Docker image
|
- name: Build and save farmOS dev Docker image
|
||||||
run: |
|
run: |
|
||||||
docker build --build-arg FARMOS_REPO=https://github.com/${FARMOS_REPO} --build-arg FARMOS_VERSION=${FARMOS_VERSION} -t farmos/farmos:2.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 docker/dev
|
||||||
docker save farmos/farmos:2.x-dev > /tmp/farmos-2x-dev.tar
|
docker save farmos/farmos:3.x-dev > /tmp/farmos-dev.tar
|
||||||
- name: Cache farmOS 2.x-dev Docker image
|
- name: Cache farmOS dev Docker image
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: /tmp/farmos-2x-dev.tar
|
path: /tmp/farmos-dev.tar
|
||||||
key: farmos-2x-dev-${{ github.run_id }}
|
key: farmos-dev-${{ github.run_id }}
|
||||||
outputs:
|
outputs:
|
||||||
farmos_version: ${{ env.FARMOS_VERSION }}
|
farmos_version: ${{ env.FARMOS_VERSION }}
|
||||||
sniff:
|
sniff:
|
||||||
|
@ -64,21 +64,21 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the repository
|
- name: Checkout the repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Restore farmOS 2.x-dev Docker image from cache
|
- name: Restore farmOS dev Docker image from cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: /tmp/farmos-2x-dev.tar
|
path: /tmp/farmos-dev.tar
|
||||||
key: farmos-2x-dev-${{ github.run_id }}
|
key: farmos-dev-${{ github.run_id }}
|
||||||
- name: Load farmos/farmos:2.x-dev image
|
- name: Load farmos/farmos:3.x-dev image
|
||||||
run: docker load < /tmp/farmos-2x-dev.tar
|
run: docker load < /tmp/farmos-dev.tar
|
||||||
- name: Run PHP CodeSniffer
|
- name: Run PHP CodeSniffer
|
||||||
run: docker run farmos/farmos:2.x-dev phpcs /opt/drupal/web/profiles/farm
|
run: docker run farmos/farmos:3.x-dev phpcs /opt/drupal/web/profiles/farm
|
||||||
- name: Run PHPStan
|
- name: Run PHPStan
|
||||||
run: docker run farmos/farmos:2.x-dev phpstan analyze --memory-limit 1G /opt/drupal/web/profiles/farm
|
run: docker run farmos/farmos:3.x-dev phpstan analyze --memory-limit 1G /opt/drupal/web/profiles/farm
|
||||||
- name: Check PHP compatibility of contrib modules and themes (ignore warnings).
|
- name: Check PHP compatibility of contrib modules and themes (ignore warnings).
|
||||||
run: |
|
run: |
|
||||||
docker run farmos/farmos:2.x-dev phpcs --standard=PHPCompatibility --runtime-set testVersion 7.4- --warning-severity=0 /opt/drupal/web/modules
|
docker run farmos/farmos:3.x-dev phpcs --standard=PHPCompatibility --runtime-set testVersion 7.4- --warning-severity=0 /opt/drupal/web/modules
|
||||||
docker run farmos/farmos:2.x-dev phpcs --standard=PHPCompatibility --runtime-set testVersion 7.4- --warning-severity=0 /opt/drupal/web/themes
|
docker run farmos/farmos:3.x-dev phpcs --standard=PHPCompatibility --runtime-set testVersion 7.4- --warning-severity=0 /opt/drupal/web/themes
|
||||||
test:
|
test:
|
||||||
name: Run PHPUnit tests
|
name: Run PHPUnit tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -104,13 +104,13 @@ jobs:
|
||||||
run: echo "matrix.dbms=${{ matrix.dbms }}, matrix.DB_URL=${{ matrix.DB_URL }}"
|
run: echo "matrix.dbms=${{ matrix.dbms }}, matrix.DB_URL=${{ matrix.DB_URL }}"
|
||||||
- name: Checkout the repository
|
- name: Checkout the repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Restore farmOS 2.x-dev Docker image from cache
|
- name: Restore farmOS dev Docker image from cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: /tmp/farmos-2x-dev.tar
|
path: /tmp/farmos-dev.tar
|
||||||
key: farmos-2x-dev-${{ github.run_id }}
|
key: farmos-dev-${{ github.run_id }}
|
||||||
- name: Load farmos/farmos:2.x-dev image
|
- name: Load farmos/farmos:3.x-dev image
|
||||||
run: docker load < /tmp/farmos-2x-dev.tar
|
run: docker load < /tmp/farmos-dev.tar
|
||||||
# Build a new docker-compose.yml file from docker-compose.testing.common + docker-compose.testing.{dbms}.yml.
|
# Build a new docker-compose.yml file from docker-compose.testing.common + docker-compose.testing.{dbms}.yml.
|
||||||
# Copy to the current directory so that farmOS volume mounts don't change to the docker/www folder.
|
# Copy to the current directory so that farmOS volume mounts don't change to the docker/www folder.
|
||||||
- name: Create docker-compose.yml
|
- name: Create docker-compose.yml
|
||||||
|
@ -140,15 +140,15 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Set FARMOS_VERSION from previous output.
|
- name: Set FARMOS_VERSION from previous output.
|
||||||
run: echo "FARMOS_VERSION=${{ needs.build.outputs.farmos_version }}" >> $GITHUB_ENV
|
run: echo "FARMOS_VERSION=${{ needs.build.outputs.farmos_version }}" >> $GITHUB_ENV
|
||||||
- name: Restore farmOS 2.x Docker image from cache
|
- name: Restore farmOS Docker image from cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: /tmp/farmos-2x.tar
|
path: /tmp/farmos.tar
|
||||||
key: farmos-2x-${{ github.run_id }}
|
key: farmos-${{ github.run_id }}
|
||||||
- name: Load farmos/farmos:2.x image
|
- name: Load farmos/farmos:3.x image
|
||||||
run: docker load < /tmp/farmos-2x.tar
|
run: docker load < /tmp/farmos.tar
|
||||||
- name: Run farmOS Docker container
|
- name: Run farmOS Docker container
|
||||||
run: docker run --rm -v /tmp/farmOS:/opt/drupal farmos/farmos:2.x true
|
run: docker run --rm -v /tmp/farmOS:/opt/drupal farmos/farmos:3.x true
|
||||||
- name: Create artifact
|
- name: Create artifact
|
||||||
run: cd /tmp && tar -czf farmOS-${FARMOS_VERSION}.tar.gz farmOS
|
run: cd /tmp && tar -czf farmOS-${FARMOS_VERSION}.tar.gz farmOS
|
||||||
- name: Create GitHub release
|
- name: Create GitHub release
|
||||||
|
@ -161,9 +161,9 @@ jobs:
|
||||||
prerelease: false
|
prerelease: false
|
||||||
publish:
|
publish:
|
||||||
name: Publish to Docker Hub
|
name: Publish to Docker Hub
|
||||||
# We only publish to Docker Hub if this is a tag or 2.x branch push event
|
# We only publish to Docker Hub if this is a tag or 3.x branch push event
|
||||||
# to the official repository.
|
# to the official repository.
|
||||||
if: github.repository == 'farmOS/farmOS' && github.event_name == 'push' && (github.ref_type == 'tag' || (github.ref_type == 'branch' && needs.build.outputs.farmos_version == '2.x'))
|
if: github.repository == 'farmOS/farmOS' && github.event_name == 'push' && (github.ref_type == 'tag' || (github.ref_type == 'branch' && needs.build.outputs.farmos_version == '3.x'))
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- build
|
- build
|
||||||
|
@ -172,32 +172,32 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Set FARMOS_VERSION from previous output.
|
- name: Set FARMOS_VERSION from previous output.
|
||||||
run: echo "FARMOS_VERSION=${{ needs.build.outputs.farmos_version }}" >> $GITHUB_ENV
|
run: echo "FARMOS_VERSION=${{ needs.build.outputs.farmos_version }}" >> $GITHUB_ENV
|
||||||
- name: Restore farmOS 2.x Docker image from cache
|
- name: Restore farmOS Docker image from cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: /tmp/farmos-2x.tar
|
path: /tmp/farmos.tar
|
||||||
key: farmos-2x-${{ github.run_id }}
|
key: farmos-${{ github.run_id }}
|
||||||
- name: Load farmos/farmos:2.x image
|
- name: Load farmos/farmos:3.x image
|
||||||
run: docker load < /tmp/farmos-2x.tar
|
run: docker load < /tmp/farmos.tar
|
||||||
- name: Restore farmOS 2.x-dev Docker image from cache
|
- name: Restore farmOS dev Docker image from cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: /tmp/farmos-2x-dev.tar
|
path: /tmp/farmos-dev.tar
|
||||||
key: farmos-2x-dev-${{ github.run_id }}
|
key: farmos-dev-${{ github.run_id }}
|
||||||
- name: Load farmos/farmos:2.x-dev image
|
- name: Load farmos/farmos:3.x-dev image
|
||||||
run: docker load < /tmp/farmos-2x-dev.tar
|
run: docker load < /tmp/farmos-dev.tar
|
||||||
- name: Login to Docker Hub.
|
- name: Login to Docker Hub.
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
# If the 2.x branch was pushed...
|
# If the 3.x branch was pushed...
|
||||||
- name: Publish farmos/farmos:2.x image to Docker Hub.
|
- name: Publish farmos/farmos:3.x image to Docker Hub.
|
||||||
if: github.ref_type == 'branch' && env.FARMOS_VERSION == '2.x'
|
if: github.ref_type == 'branch' && env.FARMOS_VERSION == '3.x'
|
||||||
run: docker push farmos/farmos:2.x
|
run: docker push farmos/farmos:3.x
|
||||||
- name: Publish farmos/farmos:2.x-dev image to Docker Hub.
|
- name: Publish farmos/farmos:3.x-dev image to Docker Hub.
|
||||||
if: github.ref_type == 'branch' && env.FARMOS_VERSION == '2.x'
|
if: github.ref_type == 'branch' && env.FARMOS_VERSION == '3.x'
|
||||||
run: docker push farmos/farmos:2.x-dev
|
run: docker push farmos/farmos:3.x-dev
|
||||||
# If a tag was pushed, tag the Docker image and push to Docker Hub.
|
# If a tag was pushed, tag the Docker image and push to Docker Hub.
|
||||||
# If the tag is a valid semantic versioning string, also tag "latest".
|
# If the tag is a valid semantic versioning string, also tag "latest".
|
||||||
# Semver regex from https://github.com/semver/semver/issues/199#issuecomment-43640395
|
# Semver regex from https://github.com/semver/semver/issues/199#issuecomment-43640395
|
||||||
|
@ -205,10 +205,10 @@ jobs:
|
||||||
- name: Tag and publish farmos/farmos:{tag} image to Docker Hub.
|
- name: Tag and publish farmos/farmos:{tag} image to Docker Hub.
|
||||||
if: github.ref_type == 'tag'
|
if: github.ref_type == 'tag'
|
||||||
run: |
|
run: |
|
||||||
docker tag farmos/farmos:2.x farmos/farmos:${{ env.FARMOS_VERSION }}
|
docker tag farmos/farmos:3.x farmos/farmos:${{ env.FARMOS_VERSION }}
|
||||||
docker push farmos/farmos:${{ env.FARMOS_VERSION }}
|
docker push farmos/farmos:${{ env.FARMOS_VERSION }}
|
||||||
if echo ${{ env.FARMOS_VERSION }} | grep -Pq '^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$'; then
|
if echo ${{ env.FARMOS_VERSION }} | grep -Pq '^(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$'; then
|
||||||
docker tag farmos/farmos:2.x farmos/farmos:latest
|
docker tag farmos/farmos:3.x farmos/farmos:latest
|
||||||
docker push farmos/farmos:latest
|
docker push farmos/farmos:latest
|
||||||
echo "ANNOUNCE_RELEASE=1" >> $GITHUB_ENV
|
echo "ANNOUNCE_RELEASE=1" >> $GITHUB_ENV
|
||||||
else
|
else
|
||||||
|
|
|
@ -2,7 +2,7 @@ name: Trigger Netlify to build docs
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- '2.x'
|
- '3.x'
|
||||||
paths:
|
paths:
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
services:
|
services:
|
||||||
php:
|
php:
|
||||||
image: farmos/farmos:2.x-dev
|
image: farmos/farmos:3.x-dev
|
||||||
default: true
|
default: true
|
||||||
depends: mysql
|
depends: mysql
|
||||||
commands:
|
commands:
|
||||||
|
@ -32,7 +32,7 @@ services:
|
||||||
--account-pass=admin \
|
--account-pass=admin \
|
||||||
site:install farm \
|
site:install farm \
|
||||||
farm.modules="all"
|
farm.modules="all"
|
||||||
|
|
||||||
# Create test users with manager, worker and viewer roles.
|
# Create test users with manager, worker and viewer roles.
|
||||||
vendor/bin/drush user-create manager --password manager && vendor/bin/drush user-add-role farm_manager manager
|
vendor/bin/drush user-create manager --password manager && vendor/bin/drush user-add-role farm_manager manager
|
||||||
vendor/bin/drush user-create worker --password worker && vendor/bin/drush user-add-role farm_worker worker
|
vendor/bin/drush user-create worker --password worker && vendor/bin/drush user-add-role farm_worker worker
|
||||||
|
@ -53,7 +53,7 @@ services:
|
||||||
export COMPOSER_MEMORY_LIMIT=-1
|
export COMPOSER_MEMORY_LIMIT=-1
|
||||||
cd /opt/drupal
|
cd /opt/drupal
|
||||||
composer update farmos/farmos --with-all-dependencies
|
composer update farmos/farmos --with-all-dependencies
|
||||||
|
|
||||||
vendor/bin/drush --yes updb
|
vendor/bin/drush --yes updb
|
||||||
vendor/bin/drush cache:rebuild
|
vendor/bin/drush cache:rebuild
|
||||||
mysql:
|
mysql:
|
||||||
|
|
|
@ -3,9 +3,9 @@ FROM drupal:9.5
|
||||||
|
|
||||||
# Set the farmOS and composer project repository URLs and versions.
|
# Set the farmOS and composer project repository URLs and versions.
|
||||||
ARG FARMOS_REPO=https://github.com/farmOS/farmOS.git
|
ARG FARMOS_REPO=https://github.com/farmOS/farmOS.git
|
||||||
ARG FARMOS_VERSION=2.x
|
ARG FARMOS_VERSION=3.x
|
||||||
ARG PROJECT_REPO=https://github.com/farmOS/composer-project.git
|
ARG PROJECT_REPO=https://github.com/farmOS/composer-project.git
|
||||||
ARG PROJECT_VERSION=2.x
|
ARG PROJECT_VERSION=3.x
|
||||||
|
|
||||||
# Set Apache ServerName directive globally to suppress AH00558 message.
|
# Set Apache ServerName directive globally to suppress AH00558 message.
|
||||||
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
|
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
|
||||||
|
|
|
@ -26,13 +26,13 @@ export COMPOSER_HOME="$(mktemp -d)"
|
||||||
# Add the farmOS repository to composer.json.
|
# Add the farmOS repository to composer.json.
|
||||||
composer config repositories.farmos git ${FARMOS_REPO}
|
composer config repositories.farmos git ${FARMOS_REPO}
|
||||||
|
|
||||||
# Require the correct farmOS version in composer.json. Defaults to 2.x.
|
# Require the correct farmOS version in composer.json. Defaults to 3.x.
|
||||||
# If FARMOS_VERSION is not a valid semantic versioning string, we assume that
|
# If FARMOS_VERSION is not a valid semantic versioning string, we assume that
|
||||||
# it is a branch, and prepend it with "dev-".
|
# it is a branch, and prepend it with "dev-".
|
||||||
# Otherwise FARMOS_VERSION is a valid semantic versioning string. We assume
|
# Otherwise FARMOS_VERSION is a valid semantic versioning string. We assume
|
||||||
# that it is a tagged version and require that version.
|
# that it is a tagged version and require that version.
|
||||||
if [ "${FARMOS_VERSION}" = "2.x" ]; then
|
if [ "${FARMOS_VERSION}" = "3.x" ]; then
|
||||||
FARMOS_COMPOSER_VERSION="2.x-dev"
|
FARMOS_COMPOSER_VERSION="3.x-dev"
|
||||||
elif [[ ! "${FARMOS_VERSION}" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then
|
elif [[ ! "${FARMOS_VERSION}" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then
|
||||||
FARMOS_COMPOSER_VERSION="dev-${FARMOS_VERSION}"
|
FARMOS_COMPOSER_VERSION="dev-${FARMOS_VERSION}"
|
||||||
fi
|
fi
|
||||||
|
@ -60,7 +60,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set the version in farm.info.yml.
|
# Set the version in farm.info.yml.
|
||||||
sed -i "s|version: 2.x|version: ${FARMOS_VERSION}|g" /var/farmOS/web/profiles/farm/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.
|
# Remove the Composer cache directory.
|
||||||
rm -rf "$COMPOSER_HOME"
|
rm -rf "$COMPOSER_HOME"
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# Inherit from the farmOS 2.x image.
|
# Inherit from the farmOS 3.x image.
|
||||||
FROM farmos/farmos:2.x
|
FROM farmos/farmos:3.x
|
||||||
|
|
||||||
# Set the farmOS and composer project repository URLs and versions.
|
# Set the farmOS and composer project repository URLs and versions.
|
||||||
ARG FARMOS_REPO=https://github.com/farmOS/farmOS.git
|
ARG FARMOS_REPO=https://github.com/farmOS/farmOS.git
|
||||||
ARG FARMOS_VERSION=2.x
|
ARG FARMOS_VERSION=3.x
|
||||||
ARG PROJECT_REPO=https://github.com/farmOS/composer-project.git
|
ARG PROJECT_REPO=https://github.com/farmOS/composer-project.git
|
||||||
ARG PROJECT_VERSION=2.x
|
ARG PROJECT_VERSION=3.x
|
||||||
|
|
||||||
# Set OPcache's revalidation frequency to 0 seconds for development.
|
# Set OPcache's revalidation frequency to 0 seconds for development.
|
||||||
# See https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.revalidate-freq
|
# See https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.revalidate-freq
|
||||||
|
|
|
@ -14,7 +14,7 @@ services:
|
||||||
www:
|
www:
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
image: farmos/farmos:2.x-dev
|
image: farmos/farmos:3.x-dev
|
||||||
volumes:
|
volumes:
|
||||||
- './www:/opt/drupal'
|
- './www:/opt/drupal'
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -2,7 +2,7 @@ version: '3'
|
||||||
services:
|
services:
|
||||||
www:
|
www:
|
||||||
# Update this to the latest stable version before deploying.
|
# Update this to the latest stable version before deploying.
|
||||||
image: farmos/farmos:2.x.y
|
image: farmos/farmos:3.x.y
|
||||||
volumes:
|
volumes:
|
||||||
- './sites:/opt/drupal/web/sites'
|
- './sites:/opt/drupal/web/sites'
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
www:
|
www:
|
||||||
image: farmos/farmos:2.x-dev
|
image: farmos/farmos:3.x-dev
|
||||||
volumes:
|
volumes:
|
||||||
- './www:/opt/drupal'
|
- './www:/opt/drupal'
|
||||||
environment:
|
environment:
|
||||||
|
|
|
@ -45,7 +45,7 @@ authenticated user and the farmOS server:
|
||||||
"farm": {
|
"farm": {
|
||||||
"name": "Farm Name",
|
"name": "Farm Name",
|
||||||
"url": "https://farmos.site",
|
"url": "https://farmos.site",
|
||||||
"version": "2.x",
|
"version": "3.x",
|
||||||
"system_of_measurement": "metric"
|
"system_of_measurement": "metric"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,14 @@ Available arguments and their default values are described below:
|
||||||
- `FARMOS_REPO` - The farmOS Git repository URL.
|
- `FARMOS_REPO` - The farmOS Git repository URL.
|
||||||
- Default: `https://github.com/farmOS/farmOS.git`
|
- Default: `https://github.com/farmOS/farmOS.git`
|
||||||
- `FARMOS_VERSION` - The farmOS Git branch/tag/commit to check out.
|
- `FARMOS_VERSION` - The farmOS Git branch/tag/commit to check out.
|
||||||
- Default: `2.x`
|
- Default: `3.x`
|
||||||
- `PROJECT_REPO` - The farmOS Composer project Git repository URL.
|
- `PROJECT_REPO` - The farmOS Composer project Git repository URL.
|
||||||
- Default: `https://github.com/farmOS/composer-project.git`
|
- Default: `https://github.com/farmOS/composer-project.git`
|
||||||
- `PROJECT_VERSION` - The farmOS Composer project Git branch/tag/commit to
|
- `PROJECT_VERSION` - The farmOS Composer project Git branch/tag/commit to
|
||||||
check out.
|
check out.
|
||||||
- Default: `2.x`
|
- Default: `3.x`
|
||||||
|
|
||||||
The `2.x-dev` image also provides the following:
|
The `3.x-dev` image also provides the following:
|
||||||
|
|
||||||
- `WWW_DATA_ID` - The ID to use for the `www-data` user and group inside the
|
- `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
|
image. Setting this to the ID of the developer's user on the host machine
|
||||||
|
|
|
@ -6,8 +6,8 @@ documentation which is hosted at [http://farmOS.org](http://farmos.org).
|
||||||
It uses [mkdocs](http://www.mkdocs.org) to convert simple markdown files into
|
It uses [mkdocs](http://www.mkdocs.org) to convert simple markdown files into
|
||||||
static HTML files.
|
static HTML files.
|
||||||
|
|
||||||
To get started contributing to the farmOS 2.x documentation, fork
|
To get started contributing to the farmOS documentation, fork
|
||||||
[farmOS](https://github.com/farmOS/farmOS/tree/2.x) on Github. Then install mkdocs and
|
[farmOS](https://github.com/farmOS/farmOS) on Github. Then install mkdocs and
|
||||||
clone this repo:
|
clone this repo:
|
||||||
|
|
||||||
$ brew install python # For OSX users
|
$ brew install python # For OSX users
|
||||||
|
@ -15,11 +15,10 @@ clone this repo:
|
||||||
$ sudo pip install mkdocs mkdocs-material
|
$ sudo pip install mkdocs mkdocs-material
|
||||||
$ git clone https://github.com/farmOS/farmOS.git farmOS
|
$ git clone https://github.com/farmOS/farmOS.git farmOS
|
||||||
$ cd farmOS
|
$ cd farmOS
|
||||||
$ git checkout 2.x
|
|
||||||
$ git remote add sandbox git@github.com:<username>/farmOS.git
|
$ git remote add sandbox git@github.com:<username>/farmOS.git
|
||||||
$ mkdocs serve
|
$ mkdocs serve
|
||||||
|
|
||||||
Your local farmOS 2.x documentation site should now be available for browsing:
|
Your local farmOS documentation site should now be available for browsing:
|
||||||
http://127.0.0.1:8000/. When you find a typo, an error, unclear or missing
|
http://127.0.0.1:8000/. When you find a typo, an error, unclear or missing
|
||||||
explanations or instructions, hit ctrl-c, to stop the server, and start editing.
|
explanations or instructions, hit ctrl-c, to stop the server, and start editing.
|
||||||
Find the page you’d like to edit; everything is in the docs/ directory. Make
|
Find the page you’d like to edit; everything is in the docs/ directory. Make
|
||||||
|
|
|
@ -11,7 +11,7 @@ Run the following commands to create a farmOS directory and set up Docker
|
||||||
containers for farmOS and PostgreSQL:
|
containers for farmOS and PostgreSQL:
|
||||||
|
|
||||||
mkdir farmOS && cd farmOS
|
mkdir farmOS && cd farmOS
|
||||||
curl https://raw.githubusercontent.com/farmOS/farmOS/2.x/docker/docker-compose.development.yml -o docker-compose.yml
|
curl https://raw.githubusercontent.com/farmOS/farmOS/3.x/docker/docker-compose.development.yml -o docker-compose.yml
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
|
|
||||||
## 2. Install farmOS
|
## 2. Install farmOS
|
||||||
|
|
|
@ -59,5 +59,5 @@ Alternatively, the `XDEBUG_MODE` environment variable can be specified directly:
|
||||||
docker compose exec -u www-data -T --env XDEBUG_MODE=off www phpunit --verbose --debug /opt/drupal/web/profiles/farm
|
docker compose exec -u www-data -T --env XDEBUG_MODE=off www phpunit --verbose --debug /opt/drupal/web/profiles/farm
|
||||||
```
|
```
|
||||||
|
|
||||||
[run-tests.yml]: https://raw.githubusercontent.com/farmOS/farmOS/2.x/.github/workflows/run-tests.yml
|
[run-tests.yml]: https://raw.githubusercontent.com/farmOS/farmOS/3.x/.github/workflows/run-tests.yml
|
||||||
[docker-compose.development.yml]: https://raw.githubusercontent.com/farmOS/farmOS/2.x/docker/docker-compose.development.yml
|
[docker-compose.development.yml]: https://raw.githubusercontent.com/farmOS/farmOS/3.x/docker/docker-compose.development.yml
|
||||||
|
|
|
@ -18,8 +18,8 @@ otherwise it will be deleted.
|
||||||
# Backup www volume, just in case.
|
# Backup www volume, just in case.
|
||||||
sudo tar -czf www.tar.gz www
|
sudo tar -czf www.tar.gz www
|
||||||
|
|
||||||
# Pull latest 2.x-dev Docker image.
|
# Pull latest 3.x-dev Docker image.
|
||||||
docker pull farmos/farmos:2.x-dev
|
docker pull farmos/farmos:3.x-dev
|
||||||
|
|
||||||
# Move directories.
|
# Move directories.
|
||||||
mv www/web/profiles ./profiles
|
mv www/web/profiles ./profiles
|
||||||
|
@ -37,7 +37,7 @@ mv ./sites www/web/sites
|
||||||
|
|
||||||
# Update farmOS profile.
|
# Update farmOS profile.
|
||||||
cd www/web/profiles/farm
|
cd www/web/profiles/farm
|
||||||
git checkout 2.x && git pull origin 2.x
|
git checkout 3.x && git pull origin 3.x
|
||||||
|
|
||||||
# Run Drupal database updates.
|
# Run Drupal database updates.
|
||||||
docker compose exec -u www-data www drush updb
|
docker compose exec -u www-data www drush updb
|
||||||
|
|
|
@ -161,7 +161,7 @@ Both methods expect an array of field definition options. These include:
|
||||||
and will take precedence if it is set. Defaults to `1`.
|
and will take precedence if it is set. Defaults to `1`.
|
||||||
|
|
||||||
Other options are available for more advanced use-cases. Refer to the
|
Other options are available for more advanced use-cases. Refer to the
|
||||||
[FarmFieldFactory](https://github.com/farmOS/farmOS/blob/2.x/modules/core/field/src/FarmFieldFactory.php)
|
[FarmFieldFactory](https://github.com/farmOS/farmOS/blob/3.x/modules/core/field/src/FarmFieldFactory.php)
|
||||||
class to understand how they work.
|
class to understand how they work.
|
||||||
|
|
||||||
For more information and example code, see [Adding fields](/development/module/fields).
|
For more information and example code, see [Adding fields](/development/module/fields).
|
||||||
|
|
|
@ -9,7 +9,7 @@ If you are looking for information about hosting farmOS, or contributing to
|
||||||
the development, refer to the dedicated documentation on those topics:
|
the development, refer to the dedicated documentation on those topics:
|
||||||
|
|
||||||
- [Hosting farmOS](/hosting)
|
- [Hosting farmOS](/hosting)
|
||||||
- [Contributing to farmOS](https://github.com/farmOS/farmOS/blob/2.x/CONTRIBUTING.md)
|
- [Contributing to farmOS](https://github.com/farmOS/farmOS/blob/3.x/CONTRIBUTING.md)
|
||||||
|
|
||||||
## Logging in
|
## Logging in
|
||||||
|
|
||||||
|
|
|
@ -185,13 +185,13 @@ more information.
|
||||||
### Pinning versions
|
### Pinning versions
|
||||||
|
|
||||||
The `farmos/farmos` dependency in the farmOS project template `composer.json`
|
The `farmos/farmos` dependency in the farmOS project template `composer.json`
|
||||||
defaults to `^2.0`, which means "the latest stable version of the 2.x branch".
|
defaults to `^3.0`, which means "the latest stable version of the 3.x branch".
|
||||||
|
|
||||||
You may want to pin this (or other dependencies) to a specific version so that
|
You may want to pin this (or other dependencies) to a specific version so that
|
||||||
you can be very intentional with your upgrade process.
|
you can be very intentional with your upgrade process.
|
||||||
|
|
||||||
To pin the `farmos/farmos` dependency to a specific version (eg: `2.0.1`),
|
To pin the `farmos/farmos` dependency to a specific version (eg: `3.0.1`),
|
||||||
replace `^2.0` with `2.0.1` and run `composer update --no-dev`.
|
replace `^3.0` with `3.0.1` and run `composer update --no-dev`.
|
||||||
|
|
||||||
To update pinned dependencies, simply update the version in `composer.json` and
|
To update pinned dependencies, simply update the version in `composer.json` and
|
||||||
run `composer update --no-dev` again. Remember to run automated updates and
|
run `composer update --no-dev` again. Remember to run automated updates and
|
||||||
|
@ -210,8 +210,8 @@ custom Docker images with your custom codebase.
|
||||||
Example `Dockerfile`:
|
Example `Dockerfile`:
|
||||||
|
|
||||||
```Dockerfile
|
```Dockerfile
|
||||||
# Inherit from the upsteam farmOS 2.x image.
|
# Inherit from the upsteam farmOS 3.x image.
|
||||||
FROM farmos/farmos:2.x
|
FROM farmos/farmos:3.x
|
||||||
|
|
||||||
# Install `jq` to help in extracting the farmOS version below.
|
# Install `jq` to help in extracting the farmOS version below.
|
||||||
RUN apt-get update && apt-get install -y jq
|
RUN apt-get update && apt-get install -y jq
|
||||||
|
@ -230,7 +230,7 @@ RUN (cd /var/farmOS; composer install --no-dev)
|
||||||
# Set the version in farm.info.yml to match the version locked by Composer.
|
# Set the version in farm.info.yml to match the version locked by Composer.
|
||||||
# This is optional but is useful because the version will appear as the
|
# This is optional but is useful because the version will appear as the
|
||||||
# "Installation Profile" version at `/admin/reports/status` in farmOS.
|
# "Installation Profile" version at `/admin/reports/status` in farmOS.
|
||||||
RUN sed -i "s|version: 2.x|version: $(jq -r '.packages[] | select(.name == "farmos/farmos").version' /var/farmOS/composer.lock)|g" /var/farmOS/web/profiles/farm/farm.info.yml
|
RUN sed -i "s|version: 3.x|version: $(jq -r '.packages[] | select(.name == "farmos/farmos").version' /var/farmOS/composer.lock)|g" /var/farmOS/web/profiles/farm/farm.info.yml
|
||||||
|
|
||||||
# Copy the farmOS codebase into /opt/drupal.
|
# Copy the farmOS codebase into /opt/drupal.
|
||||||
RUN rm -r /opt/drupal && cp -rp /var/farmOS /opt/drupal
|
RUN rm -r /opt/drupal && cp -rp /var/farmOS /opt/drupal
|
||||||
|
|
|
@ -90,10 +90,10 @@ Official farmOS Docker images are available on Docker Hub:
|
||||||
|
|
||||||
This allows farmOS to be run in a Docker container with:
|
This allows farmOS to be run in a Docker container with:
|
||||||
|
|
||||||
docker pull farmos/farmos:2.x.y
|
docker pull farmos/farmos:3.x.y
|
||||||
docker run --rm -p 80:80 -v "${PWD}/sites:/opt/drupal/web/sites" farmos/farmos:2.x.y
|
docker run --rm -p 80:80 -v "${PWD}/sites:/opt/drupal/web/sites" farmos/farmos:3.x.y
|
||||||
|
|
||||||
Replace `2.x.y` with the desired version. Find the latest farmOS version on the
|
Replace `3.x.y` with the desired version. Find the latest farmOS version on the
|
||||||
[GitHub release page](https://github.com/farmOS/farmOS/releases). Using the
|
[GitHub release page](https://github.com/farmOS/farmOS/releases). Using the
|
||||||
`latest` Docker tag is not recommended, because updates require manual steps.
|
`latest` Docker tag is not recommended, because updates require manual steps.
|
||||||
See [Updating farmOS](/hosting/update) for more info.
|
See [Updating farmOS](/hosting/update) for more info.
|
||||||
|
|
|
@ -6,6 +6,8 @@ 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
|
migrations for each asset type, log type, etc. These migrations are defined in
|
||||||
YML configuration files included with the farmOS Migrate module.
|
YML configuration files included with the farmOS Migrate module.
|
||||||
|
|
||||||
|
... migrate to 2.x then upgrade to 3.x
|
||||||
|
|
||||||
## Important considerations
|
## Important considerations
|
||||||
|
|
||||||
* Do not migrate into a farmOS 2.x instance that already has records. This is
|
* Do not migrate into a farmOS 2.x instance that already has records. This is
|
||||||
|
|
|
@ -93,8 +93,8 @@ Basic Data Streams do not define any type-specific fields.
|
||||||
|
|
||||||
Listener (Legacy) Data Streams have an additional "public key" attribute,
|
Listener (Legacy) Data Streams have an additional "public key" attribute,
|
||||||
which is used in the Data Stream's API endpoint for posting/getting data. This
|
which is used in the Data Stream's API endpoint for posting/getting data. This
|
||||||
was used in farmOS 1.x to provide a unique ID for the sensor, separate from the
|
was used in farmOS v1 to provide a unique ID for the sensor, separate from the
|
||||||
Sensor Asset ID that housed the data. This is no longer needed in farmOS 2.x,
|
Sensor Asset ID that housed the data. This is no longer needed in farmOS v2+,
|
||||||
because each Data Stream has its own UUID, which is used in the API endpoints
|
because each Data Stream has its own UUID, which is used in the API endpoints
|
||||||
instead. The public key is retained for Legacy (Listener) Data Streams to
|
instead. The public key is retained for Legacy (Listener) Data Streams to
|
||||||
ensure that existing sensors can continue to push data without needing to be
|
ensure that existing sensors can continue to push data without needing to be
|
||||||
|
|
|
@ -7,7 +7,7 @@ core_version_requirement: ^9
|
||||||
project: farm
|
project: farm
|
||||||
|
|
||||||
# This is automatically set during release packaging.
|
# This is automatically set during release packaging.
|
||||||
version: 2.x
|
version: 3.x
|
||||||
|
|
||||||
# Declare this profile a distribution and mark it as 'exclusive' so that it is
|
# Declare this profile a distribution and mark it as 'exclusive' so that it is
|
||||||
# automatically selected during installation.
|
# automatically selected during installation.
|
||||||
|
|
Loading…
Reference in New Issue