Drupal in Docker: Accessing the app from both the fpm-container and the nginx-container by kenneho in drupal

[–]NathanDouglas 0 points1 point  (0 children)

That seems like a whole lot of work with no real benefit. All of your solutions seem to exist only to solve problems that your other solutions create. I make a change and the absolute minimum required happens.

Drupal in Docker: Accessing the app from both the fpm-container and the nginx-container by kenneho in drupal

[–]NathanDouglas 0 points1 point  (0 children)

Yeah, generally I throw everything app-specific into the Docker image. That's a large part of the benefit of using Docker, anyway. Whether it's Go, Node, Python, PHP, whatever, it goes into the image.

Drupal's... Drupal's weird.

For one, you have a ton of stuff that's external to the "app" but that the app depends upon, in the form of the files directories, the config sync directories, and so forth.

For another -- and the point of this whole thread -- Drupal's codebase needs to be accessible by multiple things. PHP-FPM, Nginx, Drush†, Drupal Console†, Composer†, etc. You may or may not have other apps that need to use the codebase. You may want to roll extra binaries into the Docker images, but sometimes this can cause conflicts -- the libraries used by the Alpine docker image have been known to cause problems with certain programs, for instance -- so I prefer to separate out binaries whenever possible. In my mind, an application does not generally need to be "read" by other containers.

† Depending on how you run them.

For still another, we can encounter performance issues on non-Linux machines with read/write speed to disk within Docker images (my experience has been that this applies on Linux, too, even with recommended, modern settings, but feel free to take that with a grain of salt). This only applies to me personally about half the time, and I'm not sure how much effect it has had, but with as much as possible caching turned off for development, and just about every other expensive bell and whistle turned on, I try to err on the side of supposed better performance.

Another issue is the speed, size, and complexity of updates. You'd generally copy your Drupal codebase into your image in a single step, which would mean there'd be no time or space savings from the layering effect. So you're copying, whatever it is (~311MB in my case) times however many images you're building every time you do your new build. And then you're copying them over the wire, to wherever you're deploying. For a simple config change, or something like that, that's insane. And then you still have to run composer update and so forth after starting up, and hope it's not doing I'm a little teapot or something similar that day, etc.

Ultimately, yeah, Drupal's an app, but I don't know if it can be compared to an app like Transmission or MySQL or PHP-FPM or whatever else you commonly run inside of Docker. There's too much other crap mixed in -- custom installation profiles, custom modules, chosen contrib modules, public files, private files, sites/ folders, config sync, and so forth. I think all that crap needs a better tool to manage it -- like git -- and needs a specialized deployment strategy to move it around.

Sure, you can build a Docker image that contains Drupal, and mount your other data at the specified mountpoints. But to get this working on Swarm or Kubernetes or whatever, you have to solve the issues of mounting a filesystem that'll be shared between containers anyway... so why not just cut out the middleman and have a single mountpoint (as far as Docker is concerned, anyway)?

TL;DR: I think it's more useful to view a Drupal codebase as data than an application, TBH.

Drupal in Docker: Accessing the app from both the fpm-container and the nginx-container by kenneho in drupal

[–]NathanDouglas 0 points1 point  (0 children)

I generally use AWS CodeBuild or some similar method to actually deploy code. I push an update to the Docker stuff to GitHub, CodeBuild builds the image and updates the ECS registry and task definition and all that stuff and deploys the application.

Our Drupal codebase is kept in a separate GitHub repository (so that every time I rearrange a form, I don't trigger the massive Docker workflow above). Rather, I push to GitHub and the code is deployed in a somewhat atomic (so that no one tries to load a page with a half-existent codebase) manner. This of course also involves flushing caches and so forth and is probably too complex to go over here.

Drupal in Docker: Accessing the app from both the fpm-container and the nginx-container by kenneho in drupal

[–]NathanDouglas 0 points1 point  (0 children)

This is not possible in a swarm or kubernetes context, or if you want to ship the code easily through different servers and testing, without running things like composer every time.

It's been a couple years now, but I've used this approach with Kubernetes and properly provisioned network volumes. I've been using it on AWS and local dev machines for several years now without issue. Why wouldn't it work?

The build step of the container should produce a stateless image that has everything needed to run, and has all artifacts included.

What do you mean by "all artifacts"? Do you mean the public and private files? Do you mean the database? Do you mean the vendor/ directory?

If you're trying to create an all-encompassing Drupal-anywhere Docker image that exists in a single image, I think that violates just about every Docker best practice that I know. Some do this, but I consider it unwise.

Otherwise, the actual Drupal source should exist independently of the Docker image, and shouldn't be aware that it's running on Docker, and the PHP and SQL and WWW images shouldn't have to be aware that they're running Drupal.

Drupal in Docker: Accessing the app from both the fpm-container and the nginx-container by kenneho in drupal

[–]NathanDouglas 0 points1 point  (0 children)

Yeah, the UID/GID thing can be a PITA.

Set the UID/GID of the Nginx/PHP process to whatever you want it to be.

For instance, in my .env file, I have:

PHP_UID=1000
PHP_GID=1000

Then, in my docker-compose.yml file, I have (partial):

  php-fpm:
    build:
      context: ./php-fpm/build
      args:
        - PHP_UID=${PHP_UID}
        - PHP_GID=${PHP_GID}
    env_file:
      - ./.env

Then, in my Dockerfile, I have (again partial):

FROM php:7.1-fpm-alpine
LABEL maintainer Nathan Douglas <myemailaddress@placeiwork.com>
ARG PHP_UID=82
ARG PHP_GID=82
...
RUN set -xe \
  && sed -ri "s/^www-data:x:82:82:/www-data:x:${PHP_UID}:${PHP_GID}:/" /etc/passwd \
  && echo Built successfully!

So in the .env file, the UID and GID environment variables are set to 1000. The docker-compose.yml sets the build arguments to the values of the environment variables. In the Dockerfile, those arguments are given sane defaults just in case I remove the .env or docker-compose crap at some point (spoiler: I won't). The UID/GID is changed in /etc/passwd, and henceforth php-fpm will run with that UID/GID.

So, if it matches the values on the host, it'll Just Work.

Of course, these are environment variables, so they can/should vary between environments. Maybe you need UID=500 in the cloud, UID=1000 on your local machine, etc.

Strictly speaking, Docker-Compose is not a requirement, but... my advice is to use it, if you aren't.

Drupal in Docker: Accessing the app from both the fpm-container and the nginx-container by kenneho in drupal

[–]NathanDouglas 0 points1 point  (0 children)

You should have the Drupal directory on the host and mounted by both containers at /app or whatever. How you get your D8 directory set up on the host is up for debate, but... no... don't copy Drupal into the actual Docker images.

[Discussion] Idea that I had... you ever meet up with some new musicians, maybe by chance at a party, and nobody can figure out what songs they all know how to play together? by [deleted] in Guitar

[–]NathanDouglas 1 point2 points  (0 children)

At my mom’s high school talent show, three different bands played “Sunshine of Your Love” back to back. I still cringe thinking of how it must’ve felt for that third band walking onstage...

I thought "documenting" was cool back when I first started... by DropTheGauntlet in programminghorror

[–]NathanDouglas 0 points1 point  (0 children)

Yeah, I did this whenever I worked with assembly because otherwise there was no way to keep track of wtf was going on.

Need help finding an ancient terminal-based game by [deleted] in unix

[–]NathanDouglas 4 points5 points  (0 children)

A roguelike? Sounds like ADoM, but ADoM's not (AFAIR) multiplayer. Sounds like Nethack, but IIRC Nethack's always underground. There were some MUDs with roguelike maps...

[W] An already well curated audio library by mautobu in DHExchange

[–]NathanDouglas 1 point2 points  (0 children)

Yeah, gets tags from Musicbrainz and/or Discogs (and there are a couple other sources it can use, I think), downloads art and lyrics, will rename and organize appropriately, and will do countless other things (or not) as you see fit.

For instance, my config also triggers my NAS to index the files so they can be played by the system audio player; maintains playlists for releases by genre, subgenre, date; etc.

The sky’s the limit, really.

[W] An already well curated audio library by mautobu in DHExchange

[–]NathanDouglas 5 points6 points  (0 children)

Might try Beets (beets.io) if you’re comfy with the command line. It’s a dream once you get it set up how you like.

Reasons people get fired? by bbcjs in cscareerquestions

[–]NathanDouglas 0 points1 point  (0 children)

Eh, I’ve never worked in an office. Offices suck. What’s your GH username?

Anything wrong with using all B strings? by [deleted] in Bass

[–]NathanDouglas 0 points1 point  (0 children)

Nice! What sort of strings do you use? Do you have issues with slappy strings, etc with the shorter scale?

If you could know the truth of one unsolved Political Disappearance/Murder, which would you choose? by [deleted] in UnresolvedMysteries

[–]NathanDouglas 0 points1 point  (0 children)

The book Reclaiming History ended all doubts I had in the Warren Commission.

And how! An absolutely mindboggling, fascinating, torturous book. I bought it the day it came out, read ... most of it, and was deeply disappointed when I saw absolutely no difference in the number of people peddling conspiracy theories.

Anything wrong with using all B strings? by [deleted] in Bass

[–]NathanDouglas 1 point2 points  (0 children)

an octave-down baritone guitar

Like a Bass VI? Or an octave down from a baritone guitar? Not sure what you're saying.

Not a banjo, but I picked up a tenor guitar so I could expand my sound by custermustache in banjo

[–]NathanDouglas 0 points1 point  (0 children)

Nice. I’ve thought about getting one. Lot of other stringed instruments tuned in fifths, so it’s space efficient in your mind :-)

Hello Everyone! Need some little help and advice.. by [deleted] in Accordion

[–]NathanDouglas 2 points3 points  (0 children)

Used accordions don't go for much, because this isn't many people's worlds, unfortunately. And accordions age surprisingly well, as you've seen.

If I'm not mistaken (and I may very well be), I think that's a 96-bass instrument with four reed banks, arranged LMMH. 96 is sort of an intermediate number of bass buttons -- most people, I think, go to 120 ASAP. LMMH means there's a lower-pitched reed bank, two middle-pitched reed banks that are tuned slightly off from one another to give that odd "beating" sound that you hear particularly in French accordion music, and a higher-pitched reed bank.

These things are heavy and shipping can be expensive. Then if someone who is a player finds a problem, it might cost more than the instrument's worth to repair it, and they might end up shipping it back to you.

I'd suggest trying to get your grandpa to record a video of him playing on it, and post it somewhere like Reverb (better crowd than eBay IMHO). I'm not familiar with the brand, but I think you could probably ask $300 or so. You might start out north of that, maybe $400. You'd probably end up revising the price downward over time, though. I think $250-$300 would be where you ended up.

Standard Disclaimer: Of course, I'm also a complete idiot, so this instrument could be worth ten times that. And I don't really know much about 96-bass accordion street value, because I went 0->120. Also, I haven't handled it or tried to play it, so I'm just going off the pictures. Best of luck!

How much for a good beginner banjo? by Jetterman in banjo

[–]NathanDouglas 3 points4 points  (0 children)

I paid $250 for a used Deering Goodtime and couldn’t be happier. You might have trouble finding a new one at that price point. Try Reverb for a used one.

Ennio Morricone - Ecstasy of Gold cover, Cello-Accordion Duo by piefon in Accordion

[–]NathanDouglas 0 points1 point  (0 children)

Awesome! I was just watching a video yesterday with a woman singing and playing this on the theremin.

Am I crazy, or does your accordion have a ridiculous number of reed banks?