I have ITS tickets, for seemingly simple DNS changes, that are now more than a month old, and because of that I’ve taken steps to try and do some ISLE staging work on one of my DigitalOcean droplets, namely summitt-services-droplet-01. In order to accommodate that I’ve moved nearly all of the sites and services from that droplet to my other, summitt-dweller-DO-docker. The site migration was a smooth process except for https://Wieting.TamaToledo.com. That Drupal 8 site has been difficult to upgrade and migrate largely because it was deployed using my old Port-Ability scripts, and about a year ago I scrapped Port-Ability in favor of Docksal, but I never got around to moving that particular site to a Docksal environment. Well, now I’m finding it almost impossible to complete that migration to Docksal.

The Problem with Docksal

Docksal is a wonderful development environment, but I can’t find an effective, and easily repeatable, path from development to production when using it. Docksal provides system services including an SSH Agent, DNS, and Reverse Proxy as documented here. Docksal services are provided by a cli container/service which is also responsible for providing a robust set of fin commands. In addition to cli, a typical Docksal stack also provides containers for web and db, and those look a lot like what I like to deploy for Drupal in production. However, the cli container looks nothing like what I deploy in production, and therein lies the rub.

The Promise of Lando

Hindsight is 20/20, so this must be the year to look back and make course corrections, right? Had I not fallen so quickly for the speed and glitz of Docksal I would have given some of its alternatives, like Lando, a closer look. The immediate promise of Lando is that it builds, in development, a stack that looks much more like what I wish to deploy in production, and it does so by not integrating as tightly as Docksal does.

Migrating the Wieting Theatre Web Site to Lando

Another thing that I like about Lando is the fact that Jeff Geerling has taken it for a spin and documented some of his experience with it in his blog. So I have elected to begin my adventures in Lando with this post.

After following Jeff’s lead I discovered that it left me a little short of my goal… to spin up an existing Drupal 8 site using Lando. So, I backed off a bit and returned to studying the contents of https://github.com/lando/lando. Along the way I found a post by the folks at colorfield.

Following colorfield.be

See Drupal and Docker the easy way with Lando.

╭─mark@Marks-Mac-Mini ~/GitHub
╰─$ php -d memory_limit=-1 composer.phar create-project drupal-composer/drupal-project:8.x-dev wieting-lando --stability dev --no-interaction
  ...wait for it...
  ╭─mark@Marks-Mac-Mini ~/GitHub
  ╰─$ cd wieting-lando
  ╭─mark@Marks-Mac-Mini ~/GitHub/wieting-lando
  ╰─$ lando init
  ? From where should we get your app's codebase? current working directory
  ? What recipe do you want to use? drupal8
  ? Where is your webroot relative to the init destination? web
  ? What do you want to call this app? wieting  

NOW WE'RE COOKING WITH FIRE!!!
Your app has been initialized!

Go to the directory where your app was initialized and run `lando start` to get rolling.
Check the LOCATION printed below if you are unsure where to go.

Oh... and here are some vitals:

 NAME      wieting
 LOCATION  /Users/mark/GitHub/wieting-lando
 RECIPE    drupal8
 DOCS      https://docs.devwithlando.io/tutorials/drupal8.html

Then…

╭─mark@Marks-Mac-Mini ~/GitHub/wieting-lando
╰─$ atom .    # to add config: keys for via:nginx and database:mariadb
╭─mark@Marks-Mac-Mini ~/GitHub/wieting-lando
╰─$ lando start
Let's get this party started! Starting app..
Creating network "landoproxyhyperion5000gandalfedition_edge" with driver "bridge"
Creating landoproxyhyperion5000gandalfedition_proxy_1 ... done
Creating network "wieting_default" with the default driver
Creating wieting_database_1  ... done
Creating wieting_appserver_1 ... done
Creating wieting_appserver_nginx_1 ... done
Waiting until appserver_nginx service is ready...
Waiting until appserver service is ready...
Waiting until database service is ready...

BOOMSHAKALAKA!!!

Your app has started up correctly.
Here are some vitals:

 NAME                  wieting
 LOCATION              /Users/mark/GitHub/wieting-lando
 SERVICES              appserver_nginx, appserver, database
 APPSERVER_NGINX URLS  https://localhost:32808
                       http://localhost:32809
                       http://wieting.lndo.site
                       https://wieting.lndo.site

A visit to https://wieting.lndo.site takes me to the /core/install.php script where I set the following…

  • Language: English
  • Installation Profile: Standard
  • Database type: MariaDB
  • Database name: drupal8
  • Database username: drupal8
  • Database password: drupal8
  • Host: database

BOOMSHAKALAKA! The site info was already there. The site is up!

Composer, Drush and Drupal Console

Did some checking just to be sure these work…

╭─mark@Marks-Mac-Mini ~/GitHub/wieting-lando
╰─$ lando composer --version
Composer 1.9.3 2020-02-04 12:58:49
╭─mark@Marks-Mac-Mini ~/GitHub/wieting-lando
╰─$ lando drush status
 Drupal version   : 8.8.2
 Site URI         : http://default
 DB driver        : mysql
 DB hostname      : database
 DB port          : 3306
 DB username      : drupal8
 DB name          : drupal8
 Database         : Connected
 Drupal bootstrap : Successful
 Default theme    : bartik
 Admin theme      : seven
 PHP binary       : /usr/local/bin/php
 PHP config       :
 PHP OS           : Linux
 Drush script     : /app/vendor/drush/drush/drush
 Drush version    : 10.2.1
 Drush temp       : /tmp
 Drush configs    : /app/vendor/drush/drush/drush.yml
                    /app/drush/drush.yml
 Install profile  : standard
 Drupal root      : /app/web
 Site path        : sites/default
 Files, Public    : sites/default/files
 Files, Temp      : /tmp
╭─mark@Marks-Mac-Mini ~/GitHub/wieting-lando
╰─$ lando drupal about

Drupal Console (1.9.4)
======================

Copy configuration files.
  drupal init

Download, install and serve Drupal 8
  drupal quick:start

Create a new Drupal project
  drupal site:new

Install a Drupal project
  drupal site:install

Lists all available commands
  drupal list

Update project to the latest version.
   drupal self-update

╭─mark@Marks-Mac-Mini ~/GitHub/wieting-lando
╰─$

Woot!

Committing to GitHub

Since there are no secrets in this config, yet, I’m going to push it to GitHub. Specifically… SummittDweller/wieting-lando.

Restarting Local Development

I’m back at work on the campus of Grinnell College today and am looking to pick up last evening’s development here, so I need to “move” my project to a different host, namely MA8660. Let’s see if this works…

╭─markmcfate@ma8660 ~/GitHub ‹ruby-2.3.0›
╰─$ git clone https://github.com/SummittDweller/wieting-lando
Cloning into 'wieting-lando'...
remote: Enumerating objects: 30, done.
remote: Counting objects: 100% (30/30), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 30 (delta 0), reused 30 (delta 0), pack-reused 0
Unpacking objects: 100% (30/30), done.
╭─markmcfate@ma8660 ~/GitHub ‹ruby-2.3.0›
╰─$ cd wieting-lando           

Whoa! The wieting-lando directory looks a little empty, probably because I see that my .gitignore file ignored alot of stuff. 😦 No matter, let’s see if we can work some magic…

╭─markmcfate@ma8660 ~/GitHub/wieting-lando ‹ruby-2.3.0› ‹master›
╰─$ lando composer update
  ...and the magic happens...
╭─markmcfate@ma8660 ~/GitHub/wieting-lando ‹ruby-2.3.0› ‹master›
╰─$ lando start
Let's get this party started! Starting app..
  ...more magic...
Waiting until database service is ready...

BOOMSHAKALAKA!!!

Your app has started up correctly.
Here are some vitals:

 NAME                  wieting
 LOCATION              /Users/markmcfate/GitHub/wieting-lando
 SERVICES              appserver_nginx, appserver, database
 APPSERVER_NGINX URLS  https://localhost:32773
                       http://localhost:32774
                       http://wieting.lndo.site:8000
                       https://wieting.lndo.site:444

And BOOM, we are ready to install a new site again!

Switching Gears…Again

I’m turning my attention now to summitt-dweller-DO-docker and https://github.com/mogtofu33/docker-compose-drupal(https://github.com/mogtofu33/docker-compose-drupal) which I recently forked to https://github.com/SummittDweller/docker-compose-drupal.

My attempt to get my wieting-lando Drupal code up and working at DigitalOcean per the instructions in Installation and configuration working as administrator on summitt-dweller-DO-docker looks like this:

╭─administrator@summitt-dweller-DO-docker /opt
╰─$ git clone https://github.com/SummittDweller/docker-compose-drupal.git
╭─administrator@summitt-dweller-DO-docker /opt
╰─$ cd docker-compose-drupal
╭─administrator@summitt-dweller-DO-docker /opt/docker-compose-drupal ‹master›
╰─$ git checkout -b wieting
╭─administrator@summitt-dweller-DO-docker /opt/docker-compose-drupal ‹wieting›
╰─$ cp docker-compose.tpl.yml docker-compose.yml\ncp default.env .env
╭─administrator@summitt-dweller-DO-docker /opt/docker-compose-drupal ‹wieting›
╰─$ nano .env   # to make recommended edits
╭─administrator@summitt-dweller-DO-docker /opt/docker-compose-drupal ‹wieting›
╰─$ nano docker-compose.yml   # to make recommended edits
╭─administrator@summitt-dweller-DO-docker /opt/docker-compose-drupal ‹wieting›
╰─$ docker-compose config   # to check the config...good to go

Then from MA8660

╭─markmcfate@ma8660 ~/GitHub/wieting-lando ‹ruby-2.3.0› ‹master*›
╰─$ rsync -aruvi . administrator@104.248.237.235:/opt/docker-compose-drupal/drupal/. --progress

Then back on summitt-dweller-DO-docker

╭─administrator@summitt-dweller-DO-docker /opt/docker-compose-drupal ‹wieting›
╰─$ docker-compose up --build -d

But this command failed because of two issues:

  • Cannot start service portainer: driver failed programming external connectivity on endpoint wieting-portainer - Portainer is already running on this node, we don’t need it again!
  • Cannot start service nginx: driver failed programming external connectivity on endpoint wieting-nginx - Sure, port 80 is already occupied…we need some Traefik magic here!

First step… remove (comment out) the portainer service in docker-compose.yml, and bring back the dashboard service just to see how it works.

Next step… add some Traefik labels and port assignments (see summitt-dweller-DO-docker /opt/omeka-s2/docker-compose.yml for examples) to our docker-compose.yml to aleviate the nginx port conflict issues.

^^^ Do As He Says ^^^

And that’s…promising. I’ll be back. 😄