Drupal L10n Server - Development Setup
Get the code
git clone --branch '3273538-create-a-new' https://git.drupalcode.org/issue/localizedrupalorg-3273538.git
cd localizedrupalorg-3273538
Prerequisites
You need to have DDEV installed to follow the instructions. https://ddev.com/get-started/
or a different working LAMP/LEMP-stack for Drupal.
Run the server
ddev start
Or just use your own development environment and strip the ddev prefixes from the following commands.
Install the setup
ddev composer install
echo '$settings["config_sync_directory"] = "../config/sync";' >> web/sites/default/settings.php
ddev drush si --existing-config
Scan Drupal project and releases
Optional: You might want to reduce the project and release count for development purposes
ddev drush cset l10n_server.settings connectors.drupal_rest:restapi.source.restapi.refresh_url https://git.drupalcode.org/project/l10n_server/-/raw/3.0.x/assets/releases.tsv
then scan for project and releases
ddev drush l10n_server:scan
Restore live drupal.org project list with around 26000 and 140000 release
ddev drush cset l10n_server.settings connectors.drupal_rest:restapi.source.restapi.refresh_url https://drupal.org/files/releases.tsv
You may now launch the project in your Browser
ddev drush launch
or
ddev drush uli
Parse Drupal releases
ddev drush l10n_server:parse 'Drupal core' --release='9.4.1'
or all releases
ddev drush l10n_server:parse 'Drupal core'
Import content entities
ddev drush en default_content l10n_server_default_content
ddev drush pmu default_content l10n_server_default_content
Update the setup
git pull
ddev composer update
ddev drush deploy
ddev drush en l10n_server l10n_drupal_rest l10n_pconfig potx queue_ui devel webprofiler
Development settings
Enable local settings and development services
cp web/sites/example.settings.local.php web/sites/default/settings.local.php
cp web/sites/default/default.services.yml web/sites/default/services.yml
echo "if (file_exists(\$app_root . '/' . \$site_path . '/settings.local.php')) {\n include \$app_root . '/' . \$site_path . '/settings.local.php';\n}" >> web/sites/default/settings.php
ddev drush cr
Enable Twig debugging
sed -i 's/debug: false/debug: true/' web/sites/default/services.yml
Theme development
Bluecheese is based on ruby / compass / susy ... It needs to be compiled, before it can be used.
To install system dependencies see http://compass-style.org/install/ You might also need to install bundler see https://bundler.io/
On Ubuntu for example install ruby and bundler, gems are included:
sudo apt update && sudo apt install ruby ruby-dev bundler
cd web/themes/contrib/bluecheese
bundle install
if you are using ruby >= 3.0.0 you need to add the sorted_set gem
cd web/themes/contrib/bluecheese
bundle add sorted_set
bundle install
Compile the CSS, once
bundle exec compass compile
Compile continuously when change has happened
bundle exec compass watch .
Tests
The l10n_community module contains a set of tests already ported from D7. To run the tests:
ddev ssh
export SIMPLETEST_BASE_URL=http://localhost/
cd web/core
../../vendor/bin/phpunit --filter L10nServerTest
Performance
Change transaction isolation
$databases['default']['default']['init_commands'] = ['isolation' => "SET SESSION tx_isolation='READ-COMMITTED'"];
Migration
Add new database to ddev:
ddev mysql -uroot -proot
CREATE DATABASE migrate;
GRANT ALL ON migrate.* to 'db'@'%' IDENTIFIED BY 'db';
` exit;
Import database to migrate from:
ddev import-db --target-db=migrate --src=l.d.o-sanitized.sql
Add database to settings:
$databases['migrate']['default'] = array(
'database' => "migrate",
'username' => "db",
'password' => "db",
'host' => $host,
'driver' => $driver,
'port' => $port,
'prefix' => "",
);
$databases['migrate']['default']['init_commands'] = ['isolation' => "SET SESSION tx_isolation='READ-COMMITTED'"];
Run the migration
ddev composer run-script --timeout=0 migrate