Skip to content

Commit

Permalink
chore: create an integration user before calling the integration script
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed May 23, 2019
1 parent a6fc902 commit 0f91469
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Expand Up @@ -11,3 +11,4 @@ Dockerfile
vendor/
.gitignore
.dockerignore
docker-compose.yml
6 changes: 4 additions & 2 deletions Makefile
Expand Up @@ -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
Expand Down
14 changes: 9 additions & 5 deletions 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:
Expand Down
1 change: 1 addition & 0 deletions sql/sql.go
Expand Up @@ -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
Expand Down

0 comments on commit 0f91469

Please sign in to comment.