Giter Club home page Giter Club logo

drupal-pi's Introduction

Drupal Pi

CI

Drupal on Docker on a Raspberry Pi

Drupal 8 on a Raspberry Pi

This project is an offshoot of the Rasbperry Pi Dramble project, which helps install Drupal on a cluster ('Bramble') of Raspberry Pi computers.

This playbook/project makes setting up Drupal on a single Raspberry Pi a very easy/simple operation using Nginx and Docker Compose.

Set up the Raspberry Pi

Drupal requires as good a Raspberry Pi as you can afford. While Drupal will run okay on any Raspberry Pi, it's best to use a model 2 B or later (newer models have a snappy four-core processor and at least 1GB RAM).

Once you have your Raspberry Pi and a good microSD card (the fastest/best one you can get—see microSD Card Benchmarks!), you will need to do a few things to set up the Raspberry Pi and get it ready to run Drupal.

Set up on Raspberry Pi with Raspbian / GUI

These directions assume you're working directly on your Raspberry Pi, running Raspbian, with a keyboard and monitor attached:

  1. Download the latest 'Raspbian' image from the Raspberry Pi Downloads page†.
  2. Follow the image installation guide to transfer the image to your microSD card:
    1. Unmount the microSD card: diskutil unmountDisk /dev/disk2
    2. Write the image to the microSD card: pv yyyy-mm-dd-raspbian-stretch.img | sudo dd bs=1m of=/dev/rdisk2
  3. Once Raspbian is loaded on the card, insert the card in your Pi, and plug in your Pi to boot it up.
  4. Boot up the Raspberry Pi. Once booted, open the "Raspberry Pi Configuration" tool in Menu > Preferences.
    1. Change the pi user account password.
    2. Click OK, then reboot the Raspberry Pi.
  5. Once rebooted, connect the Pi to your local network either via WiFi or wired ethernet.
  6. Open the Terminal application (in the launcher or in Menu > Accessories > Terminal).
  7. Install Ansible: sudo apt-get update && sudo apt-get install -y python3-dev python3-pip libyaml-dev libffi-dev && sudo pip3 install ansible
  8. Test the Ansible installation: ansible --version (should output the Ansible version).

† If you plan on using your Pi as a headless Drupal server, you don't need all the extra software included with the default Raspbian image. I recommend you use the official 'Raspbian Lite' image instead; see the next section.

Set up on Raspberry Pi with Raspbian Lite / CLI

These directions assume you're working either directly on your Raspberry Pi, running Raspbian Lite, or remotely logged into the Pi via SSH:

  1. Download the latest 'Raspbian Lite' image from the Raspberry Pi Downloads page†.
  2. Follow the image installation guide to transfer the image to your microSD card:
    1. Unmount the microSD card: diskutil unmountDisk /dev/disk2
    2. Write the image to the microSD card: pv yyyy-mm-dd-raspbian-stretch-lite.img | sudo dd bs=1m of=/dev/rdisk2
    3. Ensure SSH is enabled by adding an 'ssh' file to the boot volume: touch /Volumes/boot/ssh
    4. If you need to enable WiFi headlessly, add a wpa_supplicant.conf file to the boot volume as well:
      1. Create the file: touch /Volumes/boot/wpa_supplicant.conf
      2. Add the contents:
        ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
        update_config=1
        country=US
        
        network={
            ssid="your-network-name"
            psk="your-network-password"
            key_mgmt=WPA-PSK
        }
        
  3. Once Raspbian Lite is loaded on the card, insert the card in your Pi, and plug in your Pi to boot it up.
  4. Boot up the Raspberry Pi. Once booted, log in (default username is pi and default password is raspberry), and run sudo raspi-config.
    1. Set a better password for the Pi's default user account.
    2. Scroll down to 'Finished', hit return, and reboot the Raspberry Pi.
  5. Once rebooted, connect the Pi to your local network either via WiFi or wired ethernet.
  6. Log back in (either on the Pi directly or via SSH).
  7. Install Ansible: sudo apt-get update && sudo apt-get install -y python3-dev python3-pip libyaml-dev libffi-dev git && sudo pip3 install ansible
  8. Test the Ansible installation: ansible --version (should output the Ansible version).

Install LEMP software stack and Drupal with Ansible and Docker

Installing using the Raspberry Pi

You need to download this repository to the Pi and run the included playbook to install and configure everything.

  1. Clone the drupal-pi project: git clone https://github.com/geerlingguy/drupal-pi.git && cd drupal-pi
  2. Copy example.inventory to inventory.
  3. (Optional) Create a config.yml and override any settings from default.config.yml as needed.
  4. Install required Ansible roles: ansible-galaxy install -r requirements.yml
  5. Run the Ansible playbook: ansible-playbook -c local main.yml

After a few minutes, the playbook should complete successfully, and you should have Drupal running on your Raspberry Pi, accessible via http://localhost/

To be able to access the site from other computers on your network (e.g. by accessing http://www.drupalpi.test/, add an entry to your local hosts file like [ip-of-raspberry-pi] www.drupalpi.test.

NOTE: For best security, you should create a config.yml file and at least override any password settings from the default.config.yml file (e.g. drupal_database_password).

Installing using another host with Ansible installed

You can run the Ansible playbook from another host (instead of from within the VM—this also allows you to do everything without installing pip and ansible on the Raspberry Pi itself!).

  1. Change the inventory file to use the Pi's IP address instead of 127.0.0.1.
  2. Make sure you have your SSH private key configured for the pi account on the Pi (I use ssh-copy-id to copy my ID to the Pi).
  3. Install required Ansible roles: ansible-galaxy install -r requirements.yml
  4. Run the Ansible playbook: ansible-playbook main.yml

Note: If you have a headless Raspberry Pi and would like to find it's IP address, one way of doing so is to use a tool like Fing).

Advanced Usage

Adding your own Ansible tasks

If you need to add some additional automation, there is a concept of 'hook' files which will get called at different stages of the build if they are present (in the root directory of this project):

  • hook-pre-tasks.yml: Gets called in the pre_tasks section of the playbook before any Ansible roles or tasks are applied.
  • hook-tasks.yml: Gets called at the start of the tasks section of the playbook (after roles are applied).

One use of these hooks would be to do extra steps to deploy your own container and codebase, without having to use a private registry. See an example which I use to build and deploy one of my Drupal codebases: hook-tasks.yml example for Drupal for Kubernetes.

Updating your Pi (for future versions of Drupal Pi)

If you need to update Drupal Pi, do the following:

  1. cd into the project directory: cd /path/to/drupal-pi
  2. Pull the latest changes: git pull
  3. Update all required Ansible roles (and install new ones): sudo ansible-galaxy install -r requirements.yml --force
  4. Run the Ansible playbook: ansible-playbook -i inventory -c local main.yml

Note: Remove -c local if running from another host.

Resetting the Drupal Install

There is a reset.yml playbook included that will reset the environment so you can install a fresh copy of Drupal. To run the playbook, enter the following command in the same directory as this README:

ansible-playbook -i inventory -c local reset.yml

Note: Remove -c local if running from another host.

After it finishes resetting the environment, you can run the main.yml playbook again to rebuild the Drupal site.

Enabling Proxy Caching

The Drupal Pi includes a basic proxy cache configuration which uses Nginx to reverse proxy and cache all requests which do not include a Drupal session cookie. This can increase the speed of page delivery by 60x or more, meaning your little Pi could serve up more traffic than most home Internet uplinks could handle!

To enable Nginx's proxy cache, set the following value in your config.yml and run the main playbook:

nginx_proxy_cache: true

Using Drupal Pi as a load balancer for Pi Dramble

This project can also switch from running a site locally to being used as a load balancer for the Pi Dramble Cluster. All you have to do is set nginx_use_as_lb: true in your config.yml, make sure all the Pis which are responding to requests are in the nginx_lb_backends list, and run the playbook to redeploy the Nginx configuration.

Then point the domain you would normally point at the Pi Dramble cluster (e.g. cluster.pidramble.test) at the IP of the single Drupal Pi instead!

Author

This project was started in 2015 by Jeff Geerling, author of Ansible for DevOps.

drupal-pi's People

Contributors

geerlingguy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drupal-pi's Issues

Add cron job configuration

I just realized my latest build of Drupal Pi doesn't have a built-in cron job, so I had to add one manually... this project should set up a cron job that runs every 1 hour by default.

Error running playbook

I just wanted to report that I'm getting the following error:

ERROR: become is not a legal parameter at this level in an Ansible Playbook

I get it immediatley after running the command ansible-playbook -i inventory -c local main.yml

Any suggestions?

PHP 7 packages cannot be found

Greetings!
When I tried to run

ansible-playbook -i inventory -c local main.yml

the following error has occurred:

TASK [geerlingguy.php : Ensure PHP packages are installed.] ********************
failed: [127.0.0.1] (item=[u'php7.0-common', u'php7.0-cli', u'php7.0-dev', u'php7.0-fpm', u'libpcre3-dev', u'php7.0-gd', u'php7.0-curl', u'php7.0-imap', u'php7.0-json', u'php7.0-opcache', u'php7.0-xml', u'php7.0-mbstring', u'php-sqlite3', u'php-apcu']) => {"failed": true, "item": ["php7.0-common", "php7.0-cli", "php7.0-dev", "php7.0-fpm", "libpcre3-dev", "php7.0-gd", "php7.0-curl", "php7.0-imap", "php7.0-json", "php7.0-opcache", "php7.0-xml", "php7.0-mbstring", "php-sqlite3", "php-apcu"], "msg": "No package matching 'php7.0-common' is available"}

Could you please advise?
Thanks.

'ansible_ssh_user' is undefined

When running the ansible task to add Drupal cron. Message output below...

ASK [Add Drupal cron job.] ****************************************************
fatal: [127.0.0.1]: FAILED! => {"failed": true, "msg": "'ansible_ssh_user' is undefined"}

what am i doing wrong here? I can't get this to work at all

I configured the config file as per the instructions, and upon going to var/www there is only an HTML folder and it does not actually create a folder with my preferred name for the drupal installation.

nginx is running if I attempt to access the server from another computer via editing the hosts file to point to the RPi IP Address, and localhost works on the RPi itself and displays the nginx site, but there is no drupal to be found.

Is this package incompatible with Raspberry Pi Stretch?

I get errors too at the end of the installation on "ansible-playbook -i inventory -c local main.yml" command

fatal: [127.0.0.1]: FAILED! => {
    "changed": false
}

MSG:

Failed to connect to packages.sury.org at port 443: [Errno 101] Network is unreachable

Setup corrupts ssh settings

Running the setup on remote pi with ssh is dangerous, because it can lock user out of the pi entirely, because of tampering with ssh config.

Needs a warning or better remote this unwanted behaviour.

ERROR! Unexpected Exception: No module named markupsafe

When running the command ansible --version after doing the install, I'm seeing the following output.

$ ansible --version
ERROR! Unexpected Exception: No module named markupsafe
the full traceback was:
Traceback (most recent call last):
  File "/usr/local/bin/ansible", line 81, in <module>
    from ansible.cli.adhoc import AdHocCLI as mycli
  File "/usr/local/lib/python2.7/dist-packages/ansible/cli/adhoc.py", line 28, in <module>
    from ansible.executor.task_queue_manager import TaskQueueManager
  File "/usr/local/lib/python2.7/dist-packages/ansible/executor/task_queue_manager.py", line 28, in <module>
    from ansible.executor.play_iterator import PlayIterator
  File "/usr/local/lib/python2.7/dist-packages/ansible/executor/play_iterator.py", line 29, in <module>
    from ansible.playbook.block import Block
  File "/usr/local/lib/python2.7/dist-packages/ansible/playbook/__init__.py", line 25, in <module>
    from ansible.playbook.play import Play
  File "/usr/local/lib/python2.7/dist-packages/ansible/playbook/play.py", line 27, in <module>
    from ansible.playbook.base import Base
  File "/usr/local/lib/python2.7/dist-packages/ansible/playbook/base.py", line 32, in <module>
    from jinja2.exceptions import UndefinedError
  File "/usr/local/lib/python2.7/dist-packages/jinja2/__init__.py", line 33, in <module>
    from jinja2.environment import Environment, Template
  File "/usr/local/lib/python2.7/dist-packages/jinja2/environment.py", line 13, in <module>
    from jinja2 import nodes
  File "/usr/local/lib/python2.7/dist-packages/jinja2/nodes.py", line 19, in <module>
    from jinja2.utils import Markup
  File "/usr/local/lib/python2.7/dist-packages/jinja2/utils.py", line 531, in <module>
    from markupsafe import Markup, escape, soft_unicode
ImportError: No module named markupsafe

Fix issue with drupal files dir owner and group

From Ansible 2.8 onwards:

TASK [Ensure Drupal files directory exists.] ***************************************************************************
 [WARNING]: The value 33 (type int) in a string field was converted to u'33' (type string). If this does not look like
what you expect, quote the entire value to ensure it does not change.

ok: [10.0.100.227]

Update build.pull value for 'Build Drupal for Kubernetes Docker image.'

TASK [Build Drupal for Kubernetes Docker image.] ***********************************************************************
[WARNING]: The default for build.pull is currently 'yes', but will be changed to 'no' in Ansible 2.12. Please set
build.pull explicitly to the value you need.
changed: [10.0.100.10]

No package matching php7.0-apcu

I tired to install drupal using this repository and ansible-playbook but the php install portion failed with "No package matching 'php7.0-apcu' is available".

When looking through apt-get i found a php-apc but no php7.0-apcu. I tired changing to the 'php-apc' in Debian.yml however the script seems to check for php7.0-apcu instead of php-apc. Not really sure how to fix this myself.

Thanks

Support the ODROID-C2

It looks like there are a few minor differences in a Debian Jessie light build for ODROID-C2:

  • Need to create /usr/local/bin with 0775 permissions, owned by root/staff.
  • Need to install curl (make sure it's there)
  • Need to set php_source_install_gmp_path: "/usr/include/aarch64-linux-gnu/gmp.h" (maybe move this over to the config.yml so it takes precedence?)

Automated builds failing since global drush launcher is used

The geerlingguy.drush role recently changed to use drush launcher by default, so I will need to update this build to (for now) stick with Drush 8.x, and someday later can switch to using Composer installation instead of Drush make. Getting error:

TASK [Generate Drupal site with drush makefile.] *******************************
fatal: [127.0.0.1]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'drush_path' is undefined\n\nThe error appears to have been in '/var/www/drupal/tasks/drupal.yml': line 30, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Generate Drupal site with drush makefile.\n  ^ here\n\nexception type: <class 'ansible.errors.AnsibleUndefinedVariable'>\nexception: 'drush_path' is undefined"}

Ubuntu 20.04.2 LTS error with "python-backports.ssl-match-hostname" package

Hello, I've been struggling for hours to try to overcome this error.

TASK [Ensure dependencies are installed.] **************************************
fatal: [127.0.0.1]: FAILED! => changed=false
msg: No package matching 'python-backports.ssl-match-hostname' is available

I've been trying to follow all the suggestions I found on the web but none worked.
There doesn't seem to be a "python-backports.ssl-match-hostname" ubuntu package for 20.04 LTS (I'm using an x64 version on an SSD booted RPi4) and I also tried installing the package through python2 and pip2.

pip2 --version gives the following output:
"pip 20.3.4 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)"

sudo pip2 install backports.ssl-match-hostname gives:
"Successfully installed backports.ssl-match-hostname-3.7.0.1"

So the package seems to be there but when running "ansible-playbook -c local main.yml" it still seems unavailable.

Before giving up I'm wondering if anybody faced and solved the same issue...
Thanks, any help would be greatly appreciated.
V.

Make configuration easily overridable - ala Drupal VM

Now that I'm planning on building some Drupal Pis for specific purposes, I want to make it so the base configuration can be overridden without users having to modify source-controlled files.

For now, that means making the inventory and vars files 'examples', and updating the install directions.

Issue at end of build with php.

hey jeff, thanks for putting this all together! Trying to setup a pi to test a drupal app. I get to the end and get this error.

`TASK [geerlingguy.php : Ensure PHP packages are installed.] ***********************************************
fatal: [127.0.0.1]: FAILED! => {
"cache_update_time": 1542924453,
"cache_updated": false,
"changed": false,
"rc": 100
}

STDOUT:

Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
libargon2-1 libsodium23
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
autoconf automake autotools-dev libc-client2007e libltdl7 libmcrypt4
libpcre16-3 libpcre3 libpcre3-dev libpcre32-3 libpcrecpp0v5 libssl-dev
libssl1.1 libtool libyaml-0-2 mlock php7.1-readline shtool
Suggested packages:
autoconf-archive gnu-standards autoconf-doc gettext uw-mailutils
libmcrypt-dev mcrypt libssl-doc libtool-doc gfortran | fortran95-compiler
gcj-jdk php-pear dh-php
Recommended packages:
libltdl-dev php-apcu-bc pkg-php-tools
The following NEW packages will be installed:
autoconf automake autotools-dev libc-client2007e libltdl7 libmcrypt4
libpcre16-3 libpcre3-dev libpcre32-3 libpcrecpp0v5 libssl-dev libtool
libyaml-0-2 mlock php-apcu php-yaml php7.1 php7.1-cli php7.1-common
php7.1-curl php7.1-dev php7.1-fpm php7.1-gd php7.1-imap php7.1-json
php7.1-mbstring php7.1-mcrypt php7.1-opcache php7.1-readline php7.1-sqlite3
php7.1-xml shtool
The following packages will be upgraded:
libpcre3 libssl1.1
2 upgraded, 32 newly installed, 0 to remove and 3 not upgraded.
Need to get 11.6 MB of archives.
After this operation, 33.3 MB of additional disk space will be used.
Get:1 http://mirror.umd.edu/raspbian/raspbian stretch/main armhf autoconf all 2.69-10 [338 kB]
Get:2 http://mirror.umd.edu/raspbian/raspbian stretch/main armhf autotools-dev all 20161112.1 [73.4 kB]
Get:3 http://mirror.umd.edu/raspbian/raspbian stretch/main armhf automake all 1:1.15-6 [733 kB]
Get:4 http://mirror.umd.edu/raspbian/raspbian stretch/main armhf mlock armhf 8:2007fdfsg-5 [34.4 kB]
Get:5 http://mirror.umd.edu/raspbian/raspbian stretch/main armhf libc-client2007e armhf 8:2007f
dfsg-5 [561 kB]
Get:6 http://mirror.umd.edu/raspbian/raspbian stretch/main armhf libltdl7 armhf 2.4.6-2 [386 kB]
Get:7 http://mirror.umd.edu/raspbian/raspbian stretch/main armhf libmcrypt4 armhf 2.5.8-3.3 [64.2 kB]
Get:8 http://mirror.umd.edu/raspbian/raspbian stretch/main armhf libtool all 2.4.6-2 [545 kB]
Get:9 http://mirror.umd.edu/raspbian/raspbian stretch/main armhf libyaml-0-2 armhf 0.1.7-2 [39.9 kB]
Get:10 http://mirror.umd.edu/raspbian/raspbian stretch/main armhf shtool all 2.0.8-9 [134 kB]
Get:11 https://packages.sury.org/php stretch/main armhf libpcre3 armhf 2:8.41-1+020180928072106.2+stretch1.gbp97d153 [320 kB]
Get:12 https://packages.sury.org/php stretch/main armhf libssl1.1 armhf 1.1.1-2+020181105132527.5+stretch1.gbp90eb86 [1310 kB]
Get:13 https://packages.sury.org/php stretch/main armhf libpcre16-3 armhf 2:8.41-1+020180928072106.2+stretch1.gbp97d153 [242 kB]
Get:14 https://packages.sury.org/php stretch/main armhf libpcre32-3 armhf 2:8.41-1+020180928072106.2+stretch1.gbp97d153 [234 kB]
Get:15 https://packages.sury.org/php stretch/main armhf libpcrecpp0v5 armhf 2:8.41-1+020180928072106.2+stretch1.gbp97d153 [150 kB]
Get:16 https://packages.sury.org/php stretch/main armhf libpcre3-dev armhf 2:8.41-1+020180928072106.2+stretch1.gbp97d153 [590 kB]
Get:17 https://packages.sury.org/php stretch/main armhf libssl-dev armhf 1.1.1-2+020181105132527.5+stretch1.gbp90eb86 [1600 kB]
Get:18 https://packages.sury.org/php stretch/main armhf php7.1-common armhf 7.1.24-1+020181112093455.10+stretch1.gbp09a4fd [490 kB]
Get:19 https://packages.sury.org/php stretch/main armhf php7.1-json armhf 7.1.24-1+020181112093455.10+stretch1.gbp09a4fd [15.5 kB]
Get:20 https://packages.sury.org/php stretch/main armhf php7.1-opcache armhf 7.1.24-1+020181112093455.10+stretch1.gbp09a4fd [125 kB]
Get:21 https://packages.sury.org/php stretch/main armhf php7.1-readline armhf 7.1.24-1+020181112093455.10+stretch1.gbp09a4fd [10.8 kB]
Get:22 https://packages.sury.org/php stretch/main armhf php7.1-cli armhf 7.1.24-1+020181112093455.10+stretch1.gbp09a4fd [1134 kB]
Get:23 https://packages.sury.org/php stretch/main armhf php7.1-fpm armhf 7.1.24-1+020181112093455.10+stretch1.gbp09a4fd [1139 kB]
Get:24 https://packages.sury.org/php stretch/main armhf php-apcu armhf 5.1.12+4.0.11-2+020181105174317.7+stretch1.gbp8d5801 [85.4 kB]
Get:25 https://packages.sury.org/php stretch/main armhf php-yaml armhf 2.0.2+1.3.1-3+020181003090730.2+stretch1.gbp63ff1d [31.8 kB]
Get:26 https://packages.sury.org/php stretch/main armhf php7.1 all 7.1.24-1+020181112093455.10+stretch1.gbp09a4fd [60.7 kB]
Get:27 https://packages.sury.org/php stretch/main armhf php7.1-curl armhf 7.1.24-1+020181112093455.10+stretch1.gbp09a4fd [25.2 kB]
Get:28 https://packages.sury.org/php stretch/main armhf php7.1-dev armhf 7.1.24-1+020181112093455.10+stretch1.gbp09a4fd [532 kB]
Get:29 https://packages.sury.org/php stretch/main armhf php7.1-gd armhf 7.1.24-1+020181112093455.10+stretch1.gbp09a4fd [22.3 kB]
Get:30 https://packages.sury.org/php stretch/main armhf php7.1-imap armhf 7.1.24-1+020181112093455.10+stretch1.gbp09a4fd [25.1 kB]
Get:31 https://packages.sury.org/php stretch/main armhf php7.1-mbstring armhf 7.1.24-1+020181112093455.10+stretch1.gbp09a4fd [417 kB]
Get:32 https://packages.sury.org/php stretch/main armhf php7.1-mcrypt armhf 7.1.24-1+020181112093455.10+stretch1.gbp09a4fd [12.8 kB]
Get:33 https://packages.sury.org/php stretch/main armhf php7.1-sqlite3 armhf 7.1.24-1+020181112093455.10+stretch1.gbp09a4fd [20.8 kB]
Get:34 https://packages.sury.org/php stretch/main armhf php7.1-xml armhf 7.1.24-1+020181112093455.10+stretch1.gbp09a4fd [90.0 kB]
apt-listchanges: Reading changelogs...
Preconfiguring packages ...
Fetched 11.6 MB in 20s (555 kB/s)
(Reading database ... 39294 files and directories currently installed.)
Preparing to unpack .../libpcre3_2%3a8.41-1+020180928072106.2+stretch1.gbp97d153_armhf.deb ...
Unpacking libpcre3:armhf (2:8.41-1+020180928072106.2+stretch1.gbp97d153) over (2:8.39-3) ...

STDERR:

Extracting templates from packages: 100%
E: Sub-process /usr/bin/dpkg exited unexpectedly

MSG:

'/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" install 'php7.1' 'php7.1-apcu' 'php7.1-cli' 'php7.1-common' 'php7.1-curl' 'php7.1-dev' 'php7.1-fpm' 'php7.1-gd' 'php7.1-imap' 'php7.1-json' 'php7.1-mbstring' 'php7.1-mcrypt' 'php7.1-opcache' 'php7.1-sqlite3' 'php7.1-xml' 'Extracting templates from packages: 100%no' failed:
E: Sub-process /usr/bin/dpkg exited unexpectedly

PLAY RECAP ************************************************************************************************
127.0.0.1 : ok=79 changed=1 unreachable=0 failed=1
`

geerlingguy.firewall error when running playbook

ERROR! the role 'geerlingguy.firewall' was not found in /home//drupal-pi/roles:/home/drupal-pi/roles:/home/drupal-pi
I got it immediately after running the command ansible-playbook -i inventory -c local main.yml

Made a new issue for this becouse it is a different error.

Any suggestions on how to fix?

Abstract/align recipes between drupal-vm and drupal-pi?

It would be really cool to be able to use the same drupal recipes on a drupal vm setup and a drupal pi setup. My ultimate goal would be to add other similar (but non-drupal) recipes as well to run on either platform, leveraging the same webstack.

Related, being able to run the drupalvm stack (with solr, varnish, etc) on the drupal-pi project would be really slick :)

Are any of these thoughts feasible?

Does drupal-pi disable SSH login?

After running ansible-playbook -i inventory -c local main.ml and rebooting the Pi I am unable to SSH (even via IP) to the device.

If this is intentional, perhaps offer it as a configurable option and call it out in the install steps in README.md?

Ansible installation instructions in README require extra libffi packages

Hey,

I'm following the readme, but i am bumping on different issues:

  • Installing ansible got issues missing package.
    ** Fixed with a 'apt-get install libffi libffi-dev'.
  • when running ansible, got the message it couldn't a package named php5.
    ** changed php5 to 7.0 (note 7.0, not just 7)
  • now i have an issue when 'Drupal site with drush makefile': "Unable to clone drupal from http://git.drupal.org/project/drupal.git"
    ** didn't look into this one yet

Cheers,
tom

Add ability to enable proxy caching

Proxy caching makes Drupal fly. In my testing with the Pi Dramble, anonymous requests went from 88 req/s to over 5,000 req/s.

So make it so it's easy to turn on proxy caching on the Drupal Pi (especially so it is nice to use with the Pi Dramble cluster :).

I'm going to add a nginx_proxy_cache variable, and to enable caching, just set nginx_proxy_cache: true in your config.yml.

Upgrade to PHP 7

The time is nigh! I think I already did this on the Dramble... but should do it here—basically, see if I can just switch to the geerlingguy.php-versions role to manage the version. If not, I will have to maybe configure a repo by hand which has arm versions of php 7.0 or 7.1 (maybe even 7.2...).

See also: #27

Change default database image from hypriot/rpi-mysql:5.5

That version of MySQL is no longer supported by Drupal 9, so it would be good to use a more modern image. I believe the mysql 8.0 official library image supports arm64 out of the box. But for armv7 like 32-bit Pi OS I'd still need something else.

TASK [Install Drupal dependencies with Composer.]

Please help. I seem to get almost to the end of the process but I keep getting this fatal error.
I have tried this with 2017-03-02-raspbian-jessie.img and with the lite version and they both give me the same result. I'am reading up on Composer but I am not familiar with it. Should there be a composer.json file in /var/www/drupal (?) The following is the error I receive.

TASK [Install Drupal dependencies with Composer.] ******************************
fatal: [127.0.0.1]: FAILED! => {"changed": true, "cmd": ["composer", "install"], "delta": "0:00:00.364124", "end": "2017-03-08 17: 37:20.531550", "failed": true, "rc": 1, "start": "2017-03-08 17:37:20.167426", "stderr": "Do not run Composer as root/super user! See https://getcomposer.org/root for details\nComposer could not find a composer.json file in /var/www/drupal\nTo initialize a project, please create a composer.json file as described in the https://getcomposer.org/ \"Getting Started\" section", "stdout": "",                                         "stdout_lines": [], "warnings": []}
RUNNING HANDLER [geerlingguy.nginx : restart nginx] ****************************
RUNNING HANDLER [geerlingguy.php : restart webserver] **************************
RUNNING HANDLER [geerlingguy.php : restart php-fpm] ****************************
RUNNING HANDLER [geerlingguy.security : restart ssh] ***************************
        to retry, use: --limit @/home/pi/drupal-pi/main.retry
PLAY RECAP *********************************************************************
127.0.0.1                  : ok=107  changed=27   unreachable=0    failed=1

Bring up the Docker containers fails

Follow the README instructions.

Get following error:

TASK [Bring up the Docker containers.] ***************************************************************************
fatal: [127.0.0.1]: FAILED! => changed=true
  cmd:
  - docker-compose
  - up
  - -d
  - --remove-orphans
  delta: '0:11:03.436764'
  end: '2021-10-23 12:48:46.487330'
  msg: non-zero return code
  rc: 1
  start: '2021-10-23 12:37:43.050566'
  stderr: |-
    Creating network "drupal-pi_default" with the default driver
    Pulling drupal (geerlingguy/drupal:latest-arm32v7)...
    Pulling mysql (webhippie/mariadb:latest)...
    Creating drupal ...
    Creating drupal-mysql ...
    Host is already in use by another container
    Creating drupal       ... error

    ERROR: for drupal  Cannot start service drupal: driver failed programming external connectivity on endpoint drupal (868da9fcb10739d09a616d6ee1c16ef9ca88946e0d4288fe3832122a9cef766e): Error starting userland proxy: listen tcp [::]:8080: bind: address already in use
    Host is already in use by another container
    Creating drupal-mysql ... error

    ERROR: for drupal-mysql  Cannot start service mysql: driver failed programming external connectivity on endpoint drupal-mysql (4adabaa8d78fb892886057f77340ac4dcabb86bd86d8519cb7de0df1d80697d7): Error starting userland proxy: listen tcp [::]:3306: bind: address already in use

    ERROR: for drupal  Cannot start service drupal: driver failed programming external connectivity on endpoint drupal (868da9fcb10739d09a616d6ee1c16ef9ca88946e0d4288fe3832122a9cef766e): Error starting userland proxy: listen tcp [::]:8080: bind: address already in use

    ERROR: for mysql  Cannot start service mysql: driver failed programming external connectivity on endpoint drupal-mysql (4adabaa8d78fb892886057f77340ac4dcabb86bd86d8519cb7de0df1d80697d7): Error starting userland proxy: listen tcp [::]:3306: bind: address already in use
    Encountered errors while bringing up the project.
  stderr_lines: <omitted>
  stdout: |-
    latest-arm32v7: Pulling from geerlingguy/drupal
    Digest: sha256:aa0545a97066693b640433cafdb77782483bee0896220216ecf424c998001f04
    Status: Downloaded newer image for geerlingguy/drupal:latest-arm32v7
    latest: Pulling from webhippie/mariadb
    Digest: sha256:f0c65ccdf6d9c7842f9cdcc2292991727742e066b8836b83067f07e7dde657a6
    Status: Downloaded newer image for webhippie/mariadb:latest
  stdout_lines: <omitted>

RUNNING HANDLER [geerlingguy.security : restart ssh] *************************************************************

RUNNING HANDLER [geerlingguy.firewall : restart firewall] ********************************************************

RUNNING HANDLER [geerlingguy.nginx : restart nginx] **************************************************************

RUNNING HANDLER [geerlingguy.nginx : reload nginx] ***************************************************************

PLAY RECAP *******************************************************************************************************
127.0.0.1                  : ok=45   changed=23   unreachable=0    failed=1    skipped=37   rescued=0    ignored=0

multiple instances and sites folders

is it possible to run multiple instances of the drupal-pi container/stack?

I am currently using portainer.io to try and duplicate the stack that the ansible script has installed along with docker, but I can't figure out how to replicate.

further, the "/var/drupal/files" folder is for items in the docker container that would normally show up in the "files" folder on any other Drupal installation, but where does one put or have access to modules, libraries, etc. folders for the default drupal-pi installation.

how can one develop the drupal site if the only exposed folder is the "files" folder and not the "sites" folder where one adds drupal modules/etc to when creating sites or applying module patches.

Don't we need access to those folders? I'm not sure how to achieve this.

Usage with the ASUS Tinker Board

Working on a review for my website, and here are some notes about differences when working with the Tinker Board:

  • Need to install python-setuptools and libssl-dev in addition to python-dev and the other packages before using pip to install Ansible.
  • Had to manually install wheel (pip install wheel) to prevent tons of error: invalid command 'bdist_wheel' errors. (Though the errors still seemed to happen anyways :P).
  • Had to install dmidecode manually for the Ansible Playbook fact gathering to work—though technically this was an Ansible 2.5.0 bug that is already fixed but not in a stable release yet.

Create a branch for Docker-based Drupal Pi

As the title says... Basically I've converted the Raspberry Pi Dramble (http://www.pidramble.com) over to Kubernetes, and now I'd like to do the same for this project, but since it's a single Pi and doesn't have many resources, just use Docker + Docker Compose.

It would simplify the project a bit, and show how to do a single-node Docker-based production-ready Drupal setup.

I would still have Nginx sitting in front, and I would even set it up so I can have my own single-Drupal-Pi route as a proxy to the cluster if needed (so it would basically be a proxy/load balancer/cache in front of the Pi Dramble cluster when it's running as a Kubernetes cluster!).

So some tasks (running list, will be updated as I go):

  • Remove all the web-host-specific bits that will be run as Docker containers
  • Make sure Docker is installed (maybe share the Dramble's docker-arm role?)
  • Build a default example.docker-compose.yml file to be used with the geerlingguy/drupal and mysql:5.7 images.
  • Add a local Vagrant testing environment.
  • Add 'hooks' which allow task files to be included if they exist.
  • Build a hook that will allow me to install Drupal for Kubernetes on the cluster instead of the default image, by building tasks to clone the project, build the Docker image, and use it instead of geerlingguy/drupal:latest.
  • Mount a drupal-files directory from the host into the Drupal container at a configurable path. And make sure to wipe it in the reset.yml playbook.
  • Update the reset.yml playbook so it destroys the Docker Compose configs and gets Drupal reinstalled from scratch.
  • Add some configuration which can set the Pi to either route traffic from Nginx to the local Docker containers, or to a set of backends in the Pi Dramble cluster for a given URL.

I may or may not make this new branch the default / master, depending on how it performs on a single Pi, and whether it makes the entire user experience better or worse.

docker-compose commands failing with "No module named shutil_get_terminal_size"

It seems like docker-compose is breaking on the default Python (2.7.x) under Raspbian Stretch...

TASK [Bring up the Docker containers.] *********************************************************************************
fatal: [10.0.100.10]: FAILED! => changed=true 
  cmd:
  - docker-compose
  - up
  - -d
  - --remove-orphans
  delta: '0:00:00.823091'
  end: '2019-11-27 17:51:51.533133'
  msg: non-zero return code
  rc: 1
  start: '2019-11-27 17:51:50.710042'
  stderr: |-
    Traceback (most recent call last):
      File "/usr/local/bin/docker-compose", line 6, in <module>
        from compose.cli.main import main
      File "/usr/local/lib/python2.7/dist-packages/compose/cli/main.py", line 52, in <module>
        from .formatter import ConsoleWarningFormatter
      File "/usr/local/lib/python2.7/dist-packages/compose/cli/formatter.py", line 15, in <module>
        from backports.shutil_get_terminal_size import get_terminal_size
    ImportError: No module named shutil_get_terminal_size
  stderr_lines: <omitted>
  stdout: ''
  stdout_lines: <omitted>

I checked with pip list installed and backports.shutil_get_terminal_size is definitely installed (version 1.0.0).

Figure out why drush site-install is failing

On my Pi 2 I get the following using the latest code in 2.4.0:

...
TASK [Generate Drupal site with drush makefile.] ***********************************************************************
changed: [127.0.0.1]

TASK [Check if site is already installed.] *****************************************************************************
ok: [127.0.0.1]

TASK [Install Drupal dependencies with Composer.] **********************************************************************
changed: [127.0.0.1]

TASK [Install Drupal with drush.] **************************************************************************************
fatal: [127.0.0.1]: FAILED! => {"changed": true, "cmd": ["/usr/local/bin/drush", "site-install", "standard", "-y", "--site-name=Drupal Pi", "--account-name=admin", "--account-pass=admin", "--db-url=mysql://drupal:supersecure@localhost/drupal"], "delta": "0:00:02.186718", "end": "2017-04-21 20:02:51.742718", "failed": true, "rc": 1, "start": "2017-04-21 20:02:49.556000", "stderr": "Command site-install needs a higher bootstrap level to run - you will\u001b[31;40m\u001b[1m[error]\u001b[0m\nneed to invoke drush from a more functional Drupal environment to run\nthis command.\nThe drush command 'site-install standard' could not be executed.     \u001b[31;40m\u001b[1m[error]\u001b[0m", "stderr_lines": ["Command site-install needs a higher bootstrap level to run - you will\u001b[31;40m\u001b[1m[error]\u001b[0m", "need to invoke drush from a more functional Drupal environment to run", "this command.", "The drush command 'site-install standard' could not be executed.     \u001b[31;40m\u001b[1m[error]\u001b[0m"], "stdout": "", "stdout_lines": []}

RUNNING HANDLER [geerlingguy.firewall : restart firewall] **************************************************************

RUNNING HANDLER [geerlingguy.nginx : restart nginx] ********************************************************************
...

This often means drush can't connect to the database. I'll have to do some digging some other time.

Test and build against Raspbian 10 Buster / Pi 4

Raspbian 10 Buster is here after the release of the Raspberry Pi 4 model B. So it's as good a time as any to get this project up to speed. Already did the same for the Pi Dramble, and all the upstream roles (notably docker_arm) are ready as well. Plus I now have a spare Pi 4 model B 1 GB I want to drop in as my full-time www.pidramble.com server for when the Dramble is stashed away.

Add playbook to remove / reset drupal

Since I'd like to use this playbook to test Drupal on the same Pi over time (without having to wipe everything and start with a fresh Raspbian install each time), I'd like a playbook that does the following:

  • Deletes the /var/www/drupal folder
  • Drops the drupal database
  • Restarts nginx
  • Restarts php-fpm

Update versions in requirements.yml

Currently, the Ansible script is failing on the step to "Ensure PHP packages are installed" with the error message No package matching 'php7.0-common' is available.
This is happening because currently there are some big changes being made to use PHP's build from source option and PHP7 is being set by default.

To solve this, the requirements.yml needs to be updated to include the latest versions as follows:


---
- src: geerlingguy.composer
  version: 1.4.0
- src: geerlingguy.drush
  version: 1.1.2
- src: geerlingguy.firewall
  version: 1.0.9
- src: geerlingguy.git
  version: 1.1.1
- src: geerlingguy.mysql
  version: 2.2.1
- src: geerlingguy.nginx
  version: 1.9.2
- src: geerlingguy.php
  version: 2.0.3
- src: geerlingguy.php-mysql
  version: 1.2.0
- src: geerlingguy.security
  version: 1.2.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.