Skip to content

Instantly share code, notes, and snippets.

@symbioquine
Created October 15, 2021 16:21
Show Gist options
  • Save symbioquine/573d62d1e694028ca7a51756c1f870f8 to your computer and use it in GitHub Desktop.
Save symbioquine/573d62d1e694028ca7a51756c1f870f8 to your computer and use it in GitHub Desktop.
version: '3'
services:
db:
image: postgres:12
volumes:
- './db:/var/lib/postgresql/data'
ports:
- '5432:5432'
environment:
POSTGRES_USER: farm
POSTGRES_PASSWORD: farm
POSTGRES_DB: farm
www:
depends_on:
- db
image: farmos/farmos:2.x-dev
entrypoint: /bin/bash
command:
- -c
- |
set -ex
wait_db_ready() {
while { ! exec 3<>/dev/tcp/db/5432; } > /dev/null 2>&1; do sleep 0.1; done
}
link_srcs() {
rm -rf /opt/drupal/web/libraries/farmOS-map
ln -sf /opt/testing_src_tree/farmOS-map/dist /opt/drupal/web/libraries/farmOS-map
rm -rf /opt/drupal/web/profiles/farm/modules
ln -sf /opt/testing_src_tree/farmOS/modules /opt/drupal/web/profiles/farm/modules
rm -rf /opt/drupal/web/profiles/farm/config
ln -sf /opt/testing_src_tree/farmOS/config /opt/drupal/web/profiles/farm/config
rm -rf /opt/drupal/web/profiles/farm/src
ln -sf /opt/testing_src_tree/farmOS/src /opt/drupal/web/profiles/farm/src
rm -rf /opt/drupal/web/profiles/farm/{farm.info.yml,farm.install,farm.profile}
ln -sf /opt/testing_src_tree/farmOS/farm.info.yml /opt/drupal/web/profiles/farm/farm.info.yml
ln -sf /opt/testing_src_tree/farmOS/farm.install /opt/drupal/web/profiles/farm/farm.install
ln -sf /opt/testing_src_tree/farmOS/farm.profile /opt/drupal/web/profiles/farm/farm.profile
ln -sf /opt/testing_src_tree/farmOS/composer.json /opt/drupal/web/profiles/farm/composer.json
}
if [ -d /opt/drupal ] && ! [ "$$(ls -A /opt/drupal/)" ]; then
echo "farmOS codebase not detected. Copying from pre-built files in the Docker image."
cp -rp /var/farmOS/. /opt/drupal
link_srcs
wait_db_ready
su www-data -s /bin/bash -c 'drush site-install farm --locale=en --db-url=pgsql://farm:farm@db/farm --site-name=Test0 --account-name=root --account-pass=test'
mkdir -p /opt/drupal/web/sites/default/private/files
chown -R www-data:www-data /opt/drupal/web/sites/default/private/files
/bin/bash -c "printf \"\\\$$settings['file_private_path'] = '/opt/drupal/web/sites/default/private/files';\n\" >> /opt/drupal/web/sites/default/settings.php"
composer config repositories.test0 '{"type":"package","package":{"name":"lucianocosta/jquery.mtz.monthpicker","version":"master","type":"drupal-library","source":{"url":"https://github.com/lucianocosta/jquery.mtz.monthpicker.git","type":"git","reference":"master"}}}'
composer require drupal/config_devel drupal/default_content drupal/element_multiple drupal/entity_dialog_formatter drupal/field_group drupal/migrate_source_csv drupal/month_year drupal/select_or_other lucianocosta/jquery.mtz.monthpicker drupal/farm_forest
drush cr
git clone https://github.com/mstenta/farm_nfa.git /opt/drupal/web/modules/farm_nfa
rm /opt/drupal/web/modules/farm_nfa/web/modules/custom/farm_nfa/config/install/{log.type.activity.yml,log.type.harvest.yml,log.type.observation.yml}
drush en farm_nfa farm_nfa_block_compartment farm_nfa_cfr farm_nfa_plantation_forest farm_nfa_forest farm_nfa_natural_forest farm_nfa_zone farm_nfa_plantation_inventory
drush cr
fi
wait_db_ready
exec docker-entrypoint.sh apache2-foreground
volumes:
- './www:/opt/drupal'
# Patched version of farmOS
- '../farmOS-map:/opt/testing_src_tree/farmOS-map'
- './modules:/opt/testing_src_tree/farmOS/modules'
- './config:/opt/testing_src_tree/farmOS/config'
- './src:/opt/testing_src_tree/farmOS/src'
- './composer.json:/opt/testing_src_tree/farmOS/composer.json'
- './farm.info.yml:/opt/testing_src_tree/farmOS/farm.info.yml'
- './farm.install:/opt/testing_src_tree/farmOS/farm.install'
- './farm.profile:/opt/testing_src_tree/farmOS/farm.profile'
ports:
- '80:80'
environment:
SIMPLETEST_DB: 'pgsql://farm:farm@db/farm'
XDEBUG_MODE: 'off'
chrome:
image: selenium/standalone-chrome:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment