Skip to main content

Toolbar items

Back to site
Manage

Administration menu

Anonymous

User account actions

  • Log in
  • Create new account
  • Reset your password

User account menu

  • Log in
Home
Hadronrider
How to set up a bare metal home server, run CI/CD using Gitlab, Jenkins and pipelines, make e-toys, automate your home and much more

Main navigation

  • Home
    • HadronRider WWW App
    • Webmail
    • Gitlab
    • Jenkins
    • Mercurial
    • Redmine
    • YouTube channel

Drupal

Breadcrumb

  • Home

Table of Contents

  1. Setup
    1. Reverse proxy
  2. "Drupal composer" repository/available modules
    1. Sending emails
    2. Themes: Solo
    3. Syntax highlighting
    4. Table of contents
By valerio | 9:00 PM BST, Sat September 28, 2024
Back to top

Setup

You can pick your drupal version from https://hub.docker.com/_/drupal/tags ; you'll get security update reminders so you might want to get the newest you can.

First you have to "seed" the "sites" directory:

docker run --rm drupal:<VERSION> tar -cC /var/www/html/sites . | tar -xC <LOCAL DRUPAL PATH>/sites

Then run the Drupal image in a container named "drupal":

docker run --detach \
   --hostname hadronrider.chickenkiller.com \
   --publish <INTERNAL HTTP PORT>:80 \
   --name drupal \
   --restart always \
   --volume <LOCAL DRUPAL PATH>/modules:/var/www/html/modules \
   --volume <LOCAL DRUPAL PATH>/profiles:/var/www/html/profiles \
   --volume <LOCAL DRUPAL PATH>/sites:/var/www/html/sites \
   --volume <LOCAL DRUPAL PATH>/themes:/var/www/html/themes \
   drupal:<VERSION>

 

Reverse proxy

If you're a fan of this site you should have set NGINX up as a reverse proxy and might want to insert the following in the main "server" block (the one listening on port 443) in /etc/nginx/sites-available/default:

location /
{
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";

    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Accept-Encoding "";
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-NginX-Proxy true;

    proxy_http_version 1.1;
    add_header   Front-End-Https   on;

    proxy_connect_timeout     600;
    proxy_send_timeout        600;
    proxy_read_timeout        600;

    location / {
        rewrite    /(.*) /$1 break;
        proxy_pass http://127.0.0.1:<INTERNAL PORT>/;
    }
}
Back to top

"Drupal composer" repository/available modules

You can install components like Highlight JS or TOCFilter (described below) by just running "docker exec drupal drupal composer require '<package>'"

You can browse available modules here:

https://www.drupal.org/project/project_module

 

Sending emails

Emails are needed to automate account management and get problem reports and notifications if you're the admin.

You can use a mail sending service like Mailgun or set up your own mailserver.

Once you have it:

  • install the SMTP extension: docker exec drupal composer require 'drupal/smtp'
  • go to Manage -> Extend -> find and tick "SMTP Authentication Support" then click Save
  • go to Manage -> Configuration -> SMTP Authentication Support and enter all your SMTP server details

You should get a green confirmation popup when the page reloads:

 

Themes: Solo

The best Drupal theme according to many (including me) is Solo. You can install it by running:

docker exec drupal composer require 'drupal/solo'

Then go to your drupal website (as an admin), Manage -> Appearance -> under "Uninstalled themes", find Solo and click "Install and set as default".

After the procedure is complete and the theme appears under "Installed themes", click Settings to start model the theme to suit your needs.

You can find everything Solo on the website https://www.drupal.org/node/3405889 and the YouTube playlist https://www.youtube.com/playlist?list=PLZVSLeSmRrd1nqYAFOyalLvy5YP0dSJjJ 

Syntax highlighting

To enable code blocks highlighting, install "highlight_js":

docker exec drupal composer require 'drupal/highlight_js'

go to Manage -> Extend -> find and tick "Highlight Js syntax highlighter" then click Save

go to Manage -> Configuration -> Highlight JS Configuration, enable all the languages you want and then click Save Configuration

go to Manage -> Configuration -> Text formats and editors, click Full HTML and tick Highlight JS to enable syntax highlighting for "full HTML" displays

go to Manage -> People -> Permissions, find Highlight Js syntax highlighter and enable it for content editors

Table of contents

Install by:

docker exec drupal composer require 'drupal/toc_filter'

Go to Manage -> Extend -> find and tick "TOC Filter" then click Save

Go to Manage -> Configuration -> Text formats and editors, click Full HTML and tick "Display a table of contents", then scroll to the bottom and adjust the settings in the "Display a table of contents" configuration section to your liking.

Go to Manage -> Structure, scroll to the section you want to place the TOC in, click Place block, "Table of contents", configure and Save block (you can then simply drag it to a different block if you need), then Save Blocks.

Back to top
  • Log in or register to post comments

Comments

Powered by Drupal

Copyright © 2024 Company Name - All rights reserved

Developed & Designed by Valerio Canova