fixes make run-docker (#471)

since the db files were being created inside of the docker container with only
permissions for the root user to rwx and docker run needs all of $PWD to be
readable in order to build a docker container on the host, `make run-docker`
was broken on any subsequent runs. If we create more permissive permissions
then we don't have that issue (group +rx)
This commit is contained in:
Reed Allman
2017-01-03 13:41:05 -06:00
committed by C Cirello
parent 3315246e94
commit dd2af59fc7
3 changed files with 5 additions and 5 deletions

View File

@@ -34,4 +34,4 @@ run-docker: build-docker
set -ex set -ex
docker run --rm --privileged -it -e LOG_LEVEL=debug -e "DB_URL=bolt:///app/data/bolt.db" -v $(DIR)/data:/app/data -p 8080:8080 iron/functions docker run --rm --privileged -it -e LOG_LEVEL=debug -e "DB_URL=bolt:///app/data/bolt.db" -v $(DIR)/data:/app/data -p 8080:8080 iron/functions
all: dep build all: dep build

View File

@@ -29,13 +29,13 @@ type BoltDatastore struct {
func New(url *url.URL) (models.Datastore, error) { func New(url *url.URL) (models.Datastore, error) {
dir := filepath.Dir(url.Path) dir := filepath.Dir(url.Path)
log := logrus.WithFields(logrus.Fields{"db": url.Scheme, "dir": dir}) log := logrus.WithFields(logrus.Fields{"db": url.Scheme, "dir": dir})
err := os.MkdirAll(dir, 0777) err := os.MkdirAll(dir, 0755)
if err != nil { if err != nil {
log.WithError(err).Errorln("Could not create data directory for db") log.WithError(err).Errorln("Could not create data directory for db")
return nil, err return nil, err
} }
log.Infoln("Creating bolt db at ", url.Path) log.Infoln("Creating bolt db at ", url.Path)
db, err := bolt.Open(url.Path, 0600, &bolt.Options{Timeout: 1 * time.Second}) db, err := bolt.Open(url.Path, 0655, &bolt.Options{Timeout: 1 * time.Second})
if err != nil { if err != nil {
log.WithError(err).Errorln("Error on bolt.Open") log.WithError(err).Errorln("Error on bolt.Open")
return nil, err return nil, err

View File

@@ -55,12 +55,12 @@ func timeoutName(i int) []byte {
func NewBoltMQ(url *url.URL) (*BoltDbMQ, error) { func NewBoltMQ(url *url.URL) (*BoltDbMQ, error) {
dir := filepath.Dir(url.Path) dir := filepath.Dir(url.Path)
log := logrus.WithFields(logrus.Fields{"mq": url.Scheme, "dir": dir}) log := logrus.WithFields(logrus.Fields{"mq": url.Scheme, "dir": dir})
err := os.MkdirAll(dir, 0777) err := os.MkdirAll(dir, 0755)
if err != nil { if err != nil {
log.WithError(err).Errorln("Could not create data directory for mq") log.WithError(err).Errorln("Could not create data directory for mq")
return nil, err return nil, err
} }
db, err := bolt.Open(url.Path, 0600, &bolt.Options{Timeout: 1 * time.Second}) db, err := bolt.Open(url.Path, 0655, &bolt.Options{Timeout: 1 * time.Second})
if err != nil { if err != nil {
log.WithError(err).Errorln("Could not open BoltDB file for MQ") log.WithError(err).Errorln("Could not open BoltDB file for MQ")
return nil, err return nil, err