Skip to content

Latest commit

 

History

History
204 lines (146 loc) · 4.96 KB

File metadata and controls

204 lines (146 loc) · 4.96 KB

Hoeringsportal local development

We use Task in this project. Run

task site-update

to update the site (previously installed by running task site-install).

For performance reasons, we start only the basic docker services by default, but you can set TASK_DOCKER_COMPOSE_PROFILES in .env.local to start more docker services based on profiles, e.g.

# .env.local

# Always start pretix and friends.
TASK_DOCKER_COMPOSE_PROFILES=pretix

You can also set 'PROFILESwhen running thecompose` task, e.g.

PROFILES=pretix task compose -- up --detach

You may have to increase the Memory Limit in Docker Desktop to be able to start pretix and it's internal services (cf. celery/celery#2966 (comment)).

Tip

Run git grep -A2 'profiles:' '*.y*ml' to get a crude list of all profiles in the project.

When running task site-update, theme assets are built and this may take quite some time. To skip building assets, you can run ASSETS_SKIP_BUILD=1 task site-update or set TASK_ASSETS_SKIP_BUILD in .env.local, e.g.

# .env.local

TASK_ASSETS_SKIP_BUILD=1

Local setup

Caution

The following should be updated and rewritten to reflect the actual development workflow.

Create the file web/sites/default/settings.local.php and add:

<?php
/**
 * @file
 * Local settings.
 */

/**
 * Add development service settings.
 */
if (file_exists(__DIR__ . '/services.local.yml')) {
  $settings['container_yamls'][] = __DIR__ . '/services.local.yml';
}

/**
 * Disable CSS and JS aggregation.
 */
$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;

/**
 * Disable caching.
 */
$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
$settings['cache']['bins']['page'] = 'cache.backend.null';

/**
 * Setup logging.
 */
$config['system.logging']['error_level'] = 'verbose';

/**
 * Set Hash salt value.
 */
$settings['hash_salt'] = 'GIVE_ME_STRING';

/**
 * Set trusted host pattern.
 */
$settings['trusted_host_patterns'] = [
  '^hoeringsportal\.local\.itkdev\.dk$',
];

/**
 * Set local db.
 */
$databases['default']['default'] = [
  'database' => getenv('DATABASE_DATABASE') ?: 'db',
  'username' => getenv('DATABASE_USERNAME') ?: 'db',
  'password' => getenv('DATABASE_PASSWORD') ?: 'db',
  'host' => getenv('DATABASE_HOST') ?: 'mariadb',
  'port' => getenv('DATABASE_PORT') ?: '',
  'driver' => getenv('DATABASE_DRIVER') ?: 'mysql',
  'prefix' => '',
];

Start docker

docker compose pull
docker compose up --detach
# Note: If you want to start pretix you have to enable the "pretix" profile (cf. https://docs.docker.com/compose/profiles/):
# docker compose --profile pretix up --detach
docker compose exec phpfpm composer install
docker compose exec phpfpm vendor/bin/drush --yes site:install --existing-config

# Build theme assets
docker compose run --rm node npm install --prefix web/themes/custom/hoeringsportal
docker compose run --rm node npm run build --prefix web/themes/custom/hoeringsportal

# Get admin sign in url
docker compose exec phpfpm vendor/bin/drush --yes --uri="http://deltag.local.itkdev.dk" user:login

Add all fixtures

task fixtures:load

Coding standards and code analysis

All code must follow the Drupal coding standards.

Coding standards

Apply and check coding standard by running

task coding-standards:check

Code analysis

task code-analysis

Markdown

Apply and check Markdown coding standards:

task coding-standards:markdown:check

About translations

See Translations for details on how we handle translations.

Do we still use/need this
(cd web && ../vendor/bin/drush locale:export da --types=customized > ../translations/custom-translations.da.po)

Open translations/custom-translations.da.po with the latest version of Poedit to clean up and then save the file.

See How to deploy drupal interface translations for further details.

Further local setup

OpenIdConnect local setup

Deskpro local setup Readme

Pretix local setup Readme

Production setup

composer install --no-dev --optimize-autoloader

Deskpro

See hoeringsportal_deskpro/README.md.

Web profiler

The WebProfiler can be installed to see useful information on what goes on behind the scenes:

task drush -- pm:install webprofiler