diff --git a/.dockerignore b/.dockerignore index a3327e664..181cc91e0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -11,3 +11,4 @@ Dockerfile vendor/ .gitignore .dockerignore +docker-compose.yml \ No newline at end of file diff --git a/Makefile b/Makefile index 35bb1b9bb..db974d8ec 100644 --- a/Makefile +++ b/Makefile @@ -136,8 +136,10 @@ integration.build: .PHONY:integration.run integration.run: docker-compose up -d --no-build server - docker-compose run server "./wait-for-it.sh mysql:3306 -- echo server ready" - docker-compose run server "pathwar.pw sql adduser --sql-config=$$SQL_CONFIG --email=integration@example.com --username=integration --password=integration" + docker-compose exec server ./wait-for-it.sh mysql:3306 -- echo mysql ready + docker-compose exec server ./wait-for-it.sh localhost:9111 -- echo gRPC ready + sleep 5 + docker-compose exec server pathwar.pw sql adduser --sql-config=$$SQL_CONFIG --email=integration@example.com --username=integration --password=integration docker-compose run web npm test .PHONY: lint diff --git a/docker-compose.yml b/docker-compose.yml index ca1e54467..823ef68c5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,16 +1,20 @@ -version: '3' +version: '2.3' services: server: image: pathwar/pathwar:latest build: . entrypoint: - - "/bin/bash" - - "-c" + - ./wait-for-it.sh + - mysql:3306 + - "--" environment: - - SQL_CONFIG='root:uns3cur3@tcp(mysql:3306)/pathwar?charset=utf8&parseTime=true' + - SQL_CONFIG=root:uns3cur3@tcp(mysql:3306)/pathwar?charset=utf8&parseTime=true command: - - "./wait-for-it.sh mysql:3306 -- /bin/pathwar.pw server --http-bind=0.0.0.0:8000 --grpc-bind=0.0.0.0:9111" + - /bin/pathwar.pw + - server + - --http-bind=0.0.0.0:8000 + - --grpc-bind=0.0.0.0:9111 depends_on: - mysql ports: diff --git a/sql/sql.go b/sql/sql.go index 3d84cb8a9..2759b6a32 100644 --- a/sql/sql.go +++ b/sql/sql.go @@ -20,6 +20,7 @@ func FromOpts(opts *Options) (*gorm.DB, error) { if envConfig := os.Getenv("SQL_CONFIG"); envConfig != "" { // this should be done using viper's built-in env support sqlConfig = envConfig } + zap.L().Debug("opening sql", zap.String("config", sqlConfig)) db, err := gorm.Open("mysql", sqlConfig) if err != nil { return nil, err