Update staging/production with new Trellis

I tried running this with the latest local Trellis, but I guess there’s a compatibility problem with remote setup:
ansible-playbook server.yml -e env=staging

The error has something to do with php-fpm, but I’m not sure why it insists on php7.0-fpm, when my local Trellis is fully updated and running 7.1.

“/usr/bin/python”,
“Setting up php7.0-fpm (7.0.22-0ubuntu0.16.04.1) …”,
“Job for php7.0-fpm.service failed because the control process exited with error code. See “systemctl status php7.0-fpm.service” and “journalctl -xe” for details.”,
“invoke-rc.d: initscript php7.0-fpm, action “start” failed.”,
“dpkg: error processing package php7.0-fpm (–configure):”,
" subprocess installed post-installation script returned error exit status 1",
“Errors were encountered while processing:”,
" php7.0-fpm",
“E: Sub-process /usr/bin/dpkg returned an error code (1)”

Is the production/staging server provisioning a supported use path?

I would try backing up your WordPress database and uploads and rebuilding your droplet from scratch. Try it on staging first to see if it helps your issue.

Trellis is great but new versions aren’t always great at working with servers set up with old versions.

1 Like

So for a bigger client (not much into downtime), my best bet would be to build a new droplet from scratch using its new IP and then switch the DNS record?

It’s worth a shot. Like I said, I would try it with staging to see if your problem goes away. If it does, you’ve found the answer.

If you rebuild from scratch, you can minimize downtime by

  1. creating new DO floating IP and switching DNS for domain to use the floating IP, then give it some time for DNS to propagate
  2. provision and deploy to new server, syncing DB and uploads
  3. test new server, probably using fake entry in local /etc/hosts
  4. put site on old server in maintenance mode (or something to prevent DB writes), sync DB one final time, and reassign floating IP to new droplet – downtime will be several seconds only

Normally it would help to post a little more info, e.g., which ansible task is producing the posted error, and output of the output’s suggested commands See “systemctl status php7.0-fpm.service” and “journalctl -xe” for details” (which will probably need sudo).

If you don’t want to create a new server, I think you’ll need to address the issue of provisioning a newer version of php on a server that already has an older version of php. A couple of sample threads related to that topic (but I think there are more): one and two.

4 Likes

I’m sorry for low log levels in my original post, I’ve been looking at white on black for a bit too long today.

This is what I got on staging target:

WARNING: Nothing matches the include pattern ‘/etc/php/7.0/fpm/pool.d/*.conf’ from /etc/php/7.0/fpm/php-fpm.conf at line 125.
ERROR: No pool defined. at least one pool section must be specified in config file
ERROR: failed to post process the configuration
ERROR: FPM initialization failed

This looks to me like the first run of the new ansible-playbook removed the php fpm 7.0 configuration, and now it can’t proceed with upgrading to php 7.1.

1 Like

Thanks for the extra info :+1:

Another benefit of creating a new droplet is to get an updated OS release, security upgrades, etc. (especially with mitigations for Spectre and Meltdown).

To respond to the additional output you’ve shared, however, the No pool defined reminds me of roots/trellis#682. If you try to upgrade php instead of switch to a new droplet, you might try steps such as (untested; causes downtime):

  1. ssh in to machine and sudo service php7.0-fpm stop (and maybe get aggressive and uninstall: sudo apt-get purge php.* )
  2. ansible-playbook server.yml -e env=staging --tags wordpress just for the sake of creating the wordpress pool. PHP and/or Nginx may fail to reload at the end, but that shouldn’t matter.
  3. ansible-playbook server.yml -e env=staging to run the whole playbook to get everything up-to-date.
  4. ensure services are running. ssh in to server and
    • sudo service php7.1-fpm reload (or start if it says it isn’t running)
    • sudo nginx -t to test Nginx conf, and assuming it says ok
    • sudo service nginx reload
1 Like