aquariumbio / aquarium

The Aquarium Lab Operating System
http://klavinslab.org/aquaverse/
MIT License
57 stars 15 forks source link

cannot pass RAILS_ENV config setting to docker-compose #419

Open gnomicosuw opened 3 years ago

gnomicosuw commented 3 years ago

For example, I tried running rake db:migrate to run the database migrations on my dev box

REPRO $ docker-compose exec app RAILS_ENV=development rake db:migrate

RESULT ERROR: OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"RAILS_ENV=development\": executable file not found in $PATH": unknown

NOTE: docker-compose is already set up to run in my development environment, so the following worked just fine. $ docker-compose exec app rake db:migrate

bjkeller commented 3 years ago

This command uses the entrypoint.sh script with a shell command exec "$@" (different with docker-compose exec).

it seems you have to precede each environment variable with env

so command would be

docker-compose exec app env RAILS_ENV=development rake db:migrate
gnomicosuw commented 3 years ago

Great! We should probably edit the Development guide as well (http://aquariumbio.github.io/aquarium/development/)

see "Migrating the Database" section

docker-compose up -d docker-compose exec app RAILS_ENV=production rake db:migrate docker-compose down -v

bjkeller commented 3 years ago

I changed the instruction in https://github.com/aquariumbio/aquarium/commit/d01ab3b4758d201ca4be0c2125cb873b3d8e3e3d

But need to confirm that this works before closing this