Skip to content

Anna-itk/os2loop

 
 

Repository files navigation

OS2loop

Github Release PHP Version Build Status Read License Github downloads

OS2loop is a question-answering system built on Drupal 9. See os2.eu/produkt/os2loop (in Danish) for more information.

Installation

Production

Create local settings file with database connection:

cat <<'EOF' > web/sites/default/settings.local.php
<?php
$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' => '',
];
EOF
composer install --no-dev --optimize-autoloader
vendor/bin/drush --yes site:install os2loop --existing-config
vendor/bin/drush --yes locale:update

You must also build the OS2Loop theme assets; see Building assets for details.

After installing the site you should check out Configuring OS2Loop for important and useful post-install instructions.

See OS2Loop modules for a complete list of custom OS2Loop modules.

Development

See docs/development for details on development.

docker-compose up --detach
docker-compose exec phpfpm composer install
docker-compose exec phpfpm vendor/bin/drush --yes site:install os2loop --existing-config
# Get the site url
echo "http://$(docker-compose port nginx 80)"
# Get admin sign in url
docker-compose exec phpfpm vendor/bin/drush --yes --uri="http://$(docker-compose port nginx 80)" user:login

Modules

Uses a dev version of views_flag_refresh since the module is not yet available on drupal.org

Mails

Mails are caught by MailHog and can be read on the url reported by

echo "http://$(docker-compose port mailhog 8025)"

Fixtures

We have fixtures for all content types.

To load all content type fixtures, run:

# Find and enable all fixtures modules
docker-compose exec phpfpm vendor/bin/drush --yes pm:enable $(find web/profiles/custom/os2loop/modules/ -type f -name 'os2loop_*_fixtures.info.yml' -exec basename -s .info.yml {} \;)
# Disable "Entity Reference Integrity Enforce" module to be able to delete (purge) content before loading fixtures.
docker-compose exec phpfpm vendor/bin/drush --yes pm:uninstall entity_reference_integrity_enforce
# Load the fixtures
docker-compose exec phpfpm vendor/bin/drush --yes content-fixtures:load
# Uninstall all fixtures modules
docker-compose exec phpfpm vendor/bin/drush --yes pm:uninstall content_fixtures
# Enable "Entity Reference Integrity Enforce" module
docker-compose exec phpfpm vendor/bin/drush --yes pm:enable entity_reference_integrity_enforce

Updates

composer install --no-dev --optimize-autoloader
vendor/bin/drush --yes updatedb
vendor/bin/drush --yes config:import
vendor/bin/drush --yes locale:update
vendor/bin/drush --yes cache:rebuild

Translations

Import translations by running

(cd web && ../vendor/bin/drush locale:import --type=customized --override=none da profiles/custom/os2loop/translations/translations.da.po)

Export translations by running

(cd web && ../vendor/bin/drush locale:export da --types=customized > profiles/custom/os2loop/translations/translations.da.po)

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

See https://medium.com/limoengroen/how-to-deploy-drupal-interface-translations-5653294c4af6 for further details.

Coding standards

composer coding-standards-check
composer coding-standards-apply
docker run --volume ${PWD}:/app --workdir /app node:16.13.2 yarn install
docker run --volume ${PWD}:/app --workdir /app node:16.13.2 yarn coding-standards-check
docker run --volume ${PWD}:/app --workdir /app node:16.13.2 yarn coding-standards-apply

GitHub Actions

We use GitHub Actions to check coding standards whenever a pull request is made.

Before making a pull request you can run the GitHub Actions locally to check for any problems:

Install act and run

act -P ubuntu-latest=shivammathur/node:focal pull_request

(cf. https://github.com/shivammathur/setup-php#local-testing-setup).

Twigcs

To run only twigcs:

composer coding-standards-check/twigcs

But this is also a part of

composer coding-standards-check

Build assets

docker run --volume ${PWD}:/app --workdir /app node:16.13.2 yarn install
docker run --volume ${PWD}:/app --workdir /app node:16.13.2 yarn encore dev

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 47.8%
  • Twig 44.0%
  • SCSS 7.1%
  • JavaScript 0.9%
  • Shell 0.1%
  • CSS 0.1%