Page MenuHomePhabricator

fundraising-dev CiviCRM set up failures (with fixes and workarounds)
Closed, ResolvedPublic

Description

When trying to reinstall CiviCRM on my local fundraising-dev stack via setup.sh this week I've run into a few issues preventing the setup from completing.

I'm using the following checkouts:
fundraising-dev - https://gerrit.wikimedia.org/r/c/releng/dev-images/+/664919
dev-images: https://gerrit.wikimedia.org/r/c/wikimedia/fundraising/dev/+/673094 (images pulled from dockerhub for all except civiproxy)

As of writing this post, I've managed to fix 2/3 issues encountered and skip the third as described below but the long-term fixes will probably require other work to automate IF these issues are experienced by others when attempting to reinstall. I've combined the steps in short term fixes for issues one & two to avoid folks have to reattempt the install more than once.

Issues

  1. Setup exits prematurely due to sendmail missing (fixed below)
    Screenshot from 2021-04-08 11-27-55.png (900×1 px, 266 KB)
  2. Setup exits prematurely asking me "Who I am?" (fixed below)
    Screenshot from 2021-04-08 14-41-08.png (900×1 px, 261 KB)
  3. Setup exits prematurely failing to install dmaster civicrm instance due to missing dependencies. (skipped below)
    Screenshot from 2021-04-08 15-05-30.png (900×1 px, 263 KB)

Fixes
Short-term fixes:

  • docker-compose exec -u root civicrm bash and run
    • apt update && apt install sendmail (fixes issue one)
    • addgroup --gid=1000 docker and useradd --home-dir /docker --create-home --uid 1000 --gid 1000 docker look in .env for your specific uid/gid (fixes issue two)
  • run sudo rm -r src/civi-sites/ from fundraising-dev project root. This is needed because setup.sh can't reinstall over the existing files due to perms issues from to the failed earlier attempt.
  • skip the 'dmaster' install by commenting out lines 542-543 of setup.sh (skips issues three)
  • rerun setup.sh and make sure to not remove existing containers

Long-term fixes:

  • Add sendmail to the civicrm image dockerfile
  • Create a real local user for associated uid that docker exec uses to issue commands to the containers during build steps. We could add this during setup.sh and add a separate utility script for one-off uses in the event of containers being destroyed.
  • Figure out why the extract_url behaviour relating to the dmaster install is missing dependencies

Notes:

  • the dmaster setup isn't a requirement to work on the email preferences tasks so I've skipped that for now due to spending enough time on the other stuff but I am conscious @Eileenmcnaughton needs that so we do need to fix it!
  • I'm not sure what email drupal is trying to send during the install triggering the sendmail failure
  • The drupal install is taking way longer than usual. Normally the bottleneck for our install is when we enable the modules specifically wmf_civicrm which usually takes around 4 minutes to complete which is now taking ~7 minutes to complete. However now just installing drupal seems to be taking around 2m30s before we get to enabling the modules taking the total install/enable time to just under 10 minutes! Have we recently changed something in our buildkit recipe around this?

Event Timeline

jgleeson renamed this task from fundraising-dev CiviCRM setup failures (with fixes and workarounds) to fundraising-dev CiviCRM set up failures (with fixes and workarounds).Apr 8 2021, 2:37 PM
jgleeson updated the task description. (Show Details)
AndyRussG subscribed.

Hi! Thanks so much for writing all this up. I think these are all separate issues?

  • For sendmail, I'll add a patch set in the existing WIP dev-images change (also including the other package that @Ejegg once needed), build and upload the image to the registry, and send another patch with the updated image tag.
  • The symphony issue is not due to a problem in fundraising dev, but something that occurs intermittently with the current state of our buildkit/crm repos, as per @Eileenmcnaughton... (if I understood correctly from what was said on IRC? maybe?)
  • Regarding the user ID problem, I'd much prefer to see if it persists after fixing the other issues... is that OK? Apologies, I don't mean to rehash the topic here, and the fix you've suggested sounds super original...! So, maybe let's see if it sticks around, and dig in as needed, sound good? (Also, you should be able to reset the permissions on civi-sites with a recursive chmod, I think?)

Thanks again!! :) :)

Change 663294 had a related patch set uploaded (by AndyRussG; author: AndyRussG):

[releng/dev-images@master] Fundraising images: Separate Mediawiki and Civi setups

https://gerrit.wikimedia.org/r/663294

Change 677939 had a related patch set uploaded (by AndyRussG; author: AndyRussG):

[wikimedia/fundraising/dev@master] Update civicrm image tag for image with new packages

https://gerrit.wikimedia.org/r/677939

Change 677939 merged by Eileen:

[wikimedia/fundraising/dev@master] Update civicrm image tag for image with new packages

https://gerrit.wikimedia.org/r/677939

Something has changed bcase that send mail is a bit constant for me now - testing Andy's latest

The gotcha that keeps getting me is that if you blow away the containers & then say 'n' here

  • Payments: install.php, LocalSettings.php and update.php

Run install.php and set up LocalSettings.php? [yN] n

  • maintenance/update.php

Run update.php? [yN] n

it fails

Andy's image update only marginally changed the message

Installation complete. [ok]
Unable to send e-mail. Contact the site administrator if the problem persists.

  • see how the path is no longer mentioned...

I don't think the user / permissions issue is a side issue - I think it might be the root issue - still not sure why this changed / stopped working but from the logs....

2021-04-09T03:38:13+00:00 c70a75671469 rsyslogd: rsyslogd's groupid changed to 1000
2021-04-09T03:38:13+00:00 c70a75671469 rsyslogd: could not get username for userid 1000: Success [v8.1901.0]
2021-04-09T03:38:13+00:00 c70a75671469 rsyslogd: rsyslogd's userid changed to 1000
2021-04-09T03:38:13+00:00 c70a75671469 rsyslogd: [origin software="rsyslogd" swVersion="8.1901.0" x-pid="19" x-info="https://www.rsyslog.com"] start
2021-04-09T03:40:14+00:00 c70a75671469 sendmail[1312]: My unqualified host name (c70a75671469) unknown; sleeping for retry
2021-04-09T03:41:14+00:00 c70a75671469 sendmail[1312]: unable to qualify my own domain name (c70a75671469) -- using short name
2021-04-09T03:41:14+00:00 c70a75671469 sendmail[1312]: 1393fEx0001312: SYSERR(UID1000): Who are you?

The other thing I notice is a lot of, often transient, DNS issues

eg

fatal: unable to access 'https://github.com/civicrm/civivolunteer.git/': Could not resolve host: github.com

& then it works when I run it again

Just noting the last issue *seems* to go away when I switch to upstream buildkit ( which is what we are intending to switch to as ours no longer has useful differences) https://github.com/civicrm/civicrm-buildkit

Change 678432 had a related patch set uploaded (by AndyRussG; author: AndyRussG):

[wikimedia/fundraising/dev@master] Civicrm image tag for temporary sendmail=/bin/true in php.ini

https://gerrit.wikimedia.org/r/678432

I don't think the user / permissions issue is a side issue - I think it might be the root issue - still not sure why this changed / stopped working but from the logs....

2021-04-09T03:38:13+00:00 c70a75671469 rsyslogd: rsyslogd's groupid changed to 1000
2021-04-09T03:38:13+00:00 c70a75671469 rsyslogd: could not get username for userid 1000: Success [v8.1901.0]
2021-04-09T03:38:13+00:00 c70a75671469 rsyslogd: rsyslogd's userid changed to 1000
2021-04-09T03:38:13+00:00 c70a75671469 rsyslogd: [origin software="rsyslogd" swVersion="8.1901.0" x-pid="19" x-info="https://www.rsyslog.com"] start
2021-04-09T03:40:14+00:00 c70a75671469 sendmail[1312]: My unqualified host name (c70a75671469) unknown; sleeping for retry
2021-04-09T03:41:14+00:00 c70a75671469 sendmail[1312]: unable to qualify my own domain name (c70a75671469) -- using short name
2021-04-09T03:41:14+00:00 c70a75671469 sendmail[1312]: 1393fEx0001312: SYSERR(UID1000): Who are you?

Hi! Thanks @Eileenmcnaughton! I've gotten it working with by adding sendmail_path = /bin/true to the php settings in the image, as @Ejegg had suggested. The attached patch changes the civicrm image tag to pull the most recent image with that setting from Dockerhub.

Looking a bit further along in the same log (ahhh thanks for pointing out that we should look there) I get the following:

2021-04-08T16:09:13+00:00 79a0fae7194b sendmail[258]: 138G8DwD000258: Authentication-Warning: 79a0fae7194b: Unknown UID 1000 set sender to admin@example.com using -f
2021-04-08T16:09:13+00:00 79a0fae7194b sendmail[258]: 138G8DwD000258: from=admin@example.com, size=661, class=0, nrcpts=1, msgid=<202104081608.138G8DwD000258@79a0fae7194b>, relay=Unknown UID 1000@localhost
2021-04-08T16:09:13+00:00 79a0fae7194b sendmail[258]: 138G8DwD000258: to=admin@example.com, ctladdr=admin@example.com (1000/1000), delay=00:01:00, xdelay=00:00:00, mailer=relay, pri=30661, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

So, my guess is that the "Who are you?" and unknown UID messages are warnings, and that the actual failure is the "Connection refused" message (last line, above). This would make sense, since Docker containers don't run standard system services (unless you specifically set them up to do so). (See these posts for similar issues with sendmail on Docker.)

Anyway, we do eventually need to get mail sends from Civicrm working on Docker. I think we can fix that when we set up a mailcatcher container? When we do that, we can set php to send mail via an SMTP service provided by that container? On the assumption that that will also work, I think we can consider this sendmail_path = /bin/true to be a temporary fix.

(I'm not sure why the issue was also fixed by running as a known user, as you suggested above, @jgleeson! Maybe that somehow allowed sendmail to trigger the execution of the daemon inside the container? In any case, if it does prove to be really necessary, I do think it'd be ok to create a user in the containers with the same UID as the host user, which, as you've mentioned, is possible. :) )

So, the remaining issue here is the Symfony Filesystem component not found. All the times I ran Civi setup, I got that issue, then it disappeared when I re-ran the setup. I'm guessing it's this Drupal issue? In any case, since it seems likely it's unrelated to the Docker setup, maybe we can make a separate task--does that sound right?

Thanks so much!!

@AndyRussG the filesystem one is fixed by using upstream buildkit instead of ours I believe - but yes - separate task on that.

I dug through the code & decided the sendmail error was not actually what was causing it to die since adding debug after that seemed to be hit. I think I got it working without fixing that but with the user commands @jgleeson suggested

@AndyRussG - but if the sendmail = true fixes it for you I'm happy to merge that & we can all re-test since it at least eliminates that

but yes - separate task on that.

K: T279876

@AndyRussG - but if the sendmail = true fixes it for you I'm happy to merge that & we can all re-test since it at least eliminates that

Ah ok... thanks much... whatever works for everyone else is fine by me...! I did test it twice, both times removing the wmff source code and the persistent Docker storage. Everything worked, except for the Symfony issue.

(Not sure it's related, but when the sendmail issue, or whatever was the root cause of the problem here, was causing buildkit to error out, it was leaving my source code with odd permissions: src/civi-sites/dmaster/web/sites/default was left as unwritable. However, now that it's working, the permissions on that directory are normal again.)

Change 678432 merged by Eileen:

[wikimedia/fundraising/dev@master] Civicrm image tag for temporary sendmail=/bin/true in php.ini

https://gerrit.wikimedia.org/r/678432

Change 663294 merged by Eileen:

[releng/dev-images@master] Fundraising images: Separate Mediawiki and Civi setups

https://gerrit.wikimedia.org/r/663294