Skip to content

macOS - DevLake ERROR: >>> Mysql failed to connect #800

@e2corporation

Description

@e2corporation

Lake / Docker / Mac OS + MySQL

Users / Developers in a Mac OS Environment are unable to start Lake with docker-compose up due to a bad MySQL TCP Connection string. To resolve this issue for Mac OS and potentially other environments, please see the steps below.

SOLUTION STEPS

  • Update MySQL Docker Configuration in docker-compose.yml SET container_name
    • Define a CONTAINER NAME For the MySQL Instance eg. container_name: lakeMYSQL
  • Update Dev Lake's DB_URL Connection String to use Container Name and NOT localhost
    • DB_URL=merico:merico@tcp(lakeMYSQL:3306)/lake?charset=utf8mb4&parseTime=True

Screen Shot 2021-11-16 at 10 47 11 AM

To Reproduce

Steps to reproduce the behavior:

  1. Go to DevLake project folder (lake) running main branch
  2. Run docker-compose up to start services
  3. Notice the Go Init Model fails to connect /app/models/init.go:31
  4. DevLake Issues Panic Error and exits with Code 2

Expected behavior

DevLake should startup successfully and connect to the MySQL Service instance when running docker-compose up instead of throwing panic errors.

Screenshots

BEFORE
Screen Shot 2021-11-16 at 10 20 49 AM

AFTER PROPOSED SOLUTION
Screen Shot 2021-11-16 at 10 32 47 AM

Additional context

Please see a similar issue below on StackOverflow for addtional context with regard to Go and Docker.
https://stackoverflow.com/questions/52504318/unable-to-connect-to-mysql-server-with-go-and-docker-dial-tcp-127-0-0-13306

Metadata

Metadata

Assignees

No one assigned

    Labels

    devopsSomething about CI/CD (devops)type/feature-requestThis issue is a proposal for something new

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions