Fix issue with upgrading to postgres 12 docker image #36
This commit is contained in:
parent
be5d4e976a
commit
7acf28bb3c
4
Makefile
4
Makefile
|
@ -35,7 +35,7 @@ $(GORICE):
|
|||
|
||||
$(WEB_BUILD_DIR):
|
||||
@echo "First install Yarn and create a build of the web UI found under ./web"
|
||||
@echo "Command: cd web && yarn build"
|
||||
@echo "Command: cd web && yarn && yarn build"
|
||||
@exit 1
|
||||
|
||||
$(GITCHGLOG):
|
||||
|
@ -77,7 +77,7 @@ clean:
|
|||
run: clean
|
||||
@go run $(BUILD_FLAGS) main.go $(ARGS)
|
||||
|
||||
install:
|
||||
install: gen
|
||||
@echo $(GOPATH)
|
||||
@echo "Commit Hash: `git rev-parse HEAD`"
|
||||
@echo "Old Hash: `shasum $(GOPATH)/bin/$(BINARY) 2>/dev/null | cut -c -32`"
|
||||
|
|
|
@ -2,11 +2,11 @@ version: '3.4'
|
|||
services:
|
||||
db:
|
||||
image: postgres:12
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
ports:
|
||||
- "5432:5432"
|
||||
|
||||
# redis:
|
||||
# image: redis:alpine
|
||||
|
|
13
serv/init.go
13
serv/init.go
|
@ -5,6 +5,7 @@ import (
|
|||
"crypto/sha256"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/dosco/super-graph/allow"
|
||||
"github.com/dosco/super-graph/crypto"
|
||||
|
@ -135,7 +136,17 @@ func initDBPool(c *config) (*pgxpool.Pool, error) {
|
|||
config.MaxConns = conf.DB.PoolSize
|
||||
}
|
||||
|
||||
db, err := pgxpool.ConnectConfig(context.Background(), config)
|
||||
var db *pgxpool.Pool
|
||||
var err error
|
||||
|
||||
for i := 1; i < 10; i++ {
|
||||
db, err = pgxpool.ConnectConfig(context.Background(), config)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
time.Sleep(time.Duration(i*100) * time.Millisecond)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
500
serv/rice-box.go
500
serv/rice-box.go
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,10 @@ version: '3.4'
|
|||
services:
|
||||
# Postgres DB
|
||||
db:
|
||||
image: postgres:11.5
|
||||
image: postgres:12
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
ports:
|
||||
- "5432:5432"
|
||||
|
||||
|
|
Loading…
Reference in New Issue