Docker 2.7.2 update - SQL errors on startup

Hi Hillel,
I’ve just updated a container to version 2.7.2 via the following commands:

docker-compose stop
docker-compose pull
docker-compose rm
docker-compose up -d

I had this container working successfully just prior with 2.7.1 having upgraded from an older version.

Now on starting, the APP container reports the following SQL errors in the logs:

Running DatabaseSeeder
                                                                                                                                                                                                               
  [Illuminate\Database\QueryException]                                                                                                                                                                         
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0-1' for key 'payment_terms_account_id_public_id_unique' (SQL: insert into <code>payment_terms</code> (<code>num_days</code>, <code>name</code>, <code>public_id</code>, <code>updated_at</code>, <code>created_at</code>) values (7, Net 7, 1, 2016-10-03 06:40:39, 2016-10-03 06:40:39))

  [PDOException]
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0-1' for key 'payment_terms_account_id_public_id_unique'

And so the APP container will not start now…

Any clues please on how to fix this?

It looks like the app is running the ConstantsSeeder which should only be run when the app is first installed.

Maybe this post will help?

https://www.invoiceninja.com/forums/topic/2-7-1-update-for-docker-broken/#post-4284

Hi Hillel,

That doesn’t help me… I wrote that post. I had upgraded from a much older version using the technique above but with 2.7.1 to 2.7.2 it’s giving me that SQL error…

Full log entry here - it happens on trying to restart too:

MySQL ready
Generating optimized class loader
Compiling common classes
Nothing to migrate.
Running DatabaseSeeder

[Illuminate\Database\QueryException]
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘0-1’ for key ‘payment_terms_account_id_public_id_unique’ (SQL: insert into payment_terms (num_days, name, public_id, updated_at, created_at) values (7, Net 7, 1, 2016-10-05 07:52:29, 2016-10-05 07:52:29))

[PDOException]
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘0-1’ for key ‘payment_terms_account_id_public_id_unique’

It looks like you’re running the DatabaseSeeder, that should only be run when first installing the app. After an upgrade you need to run UpdateSeeder.

Hello,

I added some databaseseed into the entrypoint of the docker image last week to fix some issue while seeding the database via web request.

That create a regression for upgrade, I comment this new feature temporarily in the docker image and I will try to find a better solution.

Hillel a push a first pr on invoiceninja let me know if this is going on a good way.
https://github.com/invoiceninja/invoiceninja/pull/1094

Hi all,

I just did a fresh docker pull since I see it has been updated. It hasn’t resolved the problem. Is there a way to pull the 2.7.1 version? The only Docker tags available since 2.5.1.2 is ‘latest’…

e.g. here - https://hub.docker.com/r/invoiceninja/invoiceninja/tags/

thanks,
Harry

I stoped to tag the image since I started to use automated build.
The only way to have the 2.7.1 is to download this https://github.com/invoiceninja/dockerfiles/archive/f53573d200ce9ab6fe9dadf279e19277eef59f99.zip and build your own image with docker

OK. is a fix coming for the problem instead?

Yes the last image should work for you

thanks very much. That has fixed it. There’s a new issue with the CRON failing now but I’ll create a new thread.

PLease report it on github https://github.com/invoiceninja/dockerfiles/issues