golang-migrate / migrate

Database migrations. CLI and Golang library.
Other
15.34k stars 1.4k forks source link

Getting EOF on Alpine Image #457

Open euannliu opened 4 years ago

euannliu commented 4 years ago

I'm not sure if this is a bug, probably just something on my own end. But I need some help if anyone got any ideas? Would really love to use this in my CI pipeline.

Creating a job on Gitlab with alpine:latest and used curl to pull the exec. I ran migration and ran into an EOF error for which when I run migrate on my local machine (Mac OS) it does not produce an EOF error.

curl -L https://github.com/golang-migrate/migrate/releases/download/v4.13.0/migrate.linux-amd64.tar.gz

Command: $ ./migrate.linux-amd64 -path ${PATH} -database "${DATABASE}" up Output: error: EOF

Tried with verbose for more information but nothing came up. Command: $ ./migrate.linux-amd64 -verbose -path ${PATH} -database "${DATABASE}" up Output: 2020/10/12 23:39:02 error: EOF

Anything is helpful! thank you

s-titov commented 4 years ago

I've got it in CI too.

[mysql] 2020/10/14 01:26:55 packets.go:36: unexpected EOF
[mysql] 2020/10/14 01:26:55 packets.go:36: unexpected EOF
[mysql] 2020/10/14 01:26:55 packets.go:36: unexpected EOF
error: driver: bad connection

upd. in my case it is my fail. Mysql server wasn't started before migrate tool.

emarais-godaddy commented 3 years ago

I ran into this as well where the migrator tries to run before the server has started. I added a health check to my mysql service and that forces the github action to wait until the server is up.

ex:

jobs:
  coverage:
    name: coverage report
    runs-on: ubuntu-20.04
    services:
      mysql:
        image: mysql:8.0
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
        ports:
          - 3306:3306
        env:
          MYSQL_ROOT_PASSWORD: <...>
          MYSQL_DATABASE: <...>
PoojaHoney commented 2 years ago

Hi,

I am also facing the same issue. Could you help over.

2022/04/26 12:40:55 error: EOF

Thank you.

meoyawn commented 5 months ago

yall's docker just isn't up yet. Sleep 5 seconds before attempting the migration