foodsoft on docker using the official image

Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

foodsoft on docker using the official image

Sven
Oh boy, this is a hard setup. Sorry.

I am following https://github.com/foodcoops/foodsoft/blob/master/doc/SETUP_PRODUCTION.md
using the official production docker image. I have mysql DB running and redis on localhost

According to that, I need to prepare an app_config.yml, and place it in `pwd`/config/app_config.yml. Check.
I need to set the env vars:
DATABASE_URL=mysql2://foodsoft:xxxxx@192.168.178.52:3306/foodsoftdb?encoding=utf8
REDIS_URL=redis://192.168.178.52:6379
SECRET_KEY_BASE=ZpIw6tz6AT8rVuTQxM1sIfh2vLoTx9
Check.

Then this fails:
$ docker run --name foodsoft_web --rm -e SECRET_KEY_BASE -e DATABASE_URL -e REDI
S_URL -e RAILS_FORCE_SSL=false   -v `pwd`/config/app_config.yml:/usr/src/app/con
fig/app_config.yml:ro foodcoops/foodsoft bundle exec rake db:setup              

Here is the trace:
`/nonexistent` is not a directory.                                              
Bundler will use `/tmp/bundler/home/unknown' as your home directory temporarily.
foodsoftdb already exists                                                      
Loading app configuration from config/app_config.yml                            
rake aborted!                                                                  
Errno::EISDIR: Is a directory @ io_fread - /usr/src/app/config/app_config.yml  
/usr/src/app/lib/foodsoft_config.rb:63:in `read'                                
/usr/src/app/lib/foodsoft_config.rb:63:in `init'                                
/usr/src/app/config/initializers/01_load_app_config.rb:5:in `<top (required)>'  
[...]

I am supposed to create a directory /nonexistent?
The DB already exists, correct. I created it manually.
/usr/src/app/config/app_config.yml is NOT a dir, I run with bash as entrypoint and verifiied:
docker run -it --entrypoint /bin/bash foodcoops/foodsoft
nobody@830959cd5b59:/usr/src/app$ ls -l config
total 68
-rwxr-xr-x 1 root root 5831 Jan  7 16:54 app_config.yml
[...]

I also tried with a Windows path, and with the complete config directory bound from host
$ docker run --name foodsoft_web --net=host --rm -e SECRET_KEY_BASE -e DATABASE_URL -e REDIS_URL -e RAILS_FORCE_SSL=false   -v d:\sprev\Source\Repos\foodsoft\config:/usr/src/app/config:ro foodcoops/foodsoft bundle exec rake db:setup
`/nonexistent` is not a directory.
Bundler will use `/tmp/bundler/home/unknown' as your home directory temporarily.rake aborted!
LoadError: cannot load such file -- /usr/src/app/config/application
/usr/src/app/Rakefile:4:in `require'
[...]
Reply | Threaded
Open this post in threaded view
|

Re: foodsoft on docker using the official image

wvengen
Administrator

Hi,

Thanks for sharing your experience. Sorry it's been a hard ride until now! Let's see.

The issue you're having here is that the app configuration cannot be found. Weirdly enough, the config file is mounted as a directory (instead of a file). In my local test with this, that didn't happen. Could it be related to a different Docker version and/or platform (Windows)? In any case, you could also build a derived Docker image with the configuration inside, like this example, run docker build and start the resulting image.

If you mount the complete directory, you need all the files in there (and not just app_config.yml). The error you're seeing when supplying a directory, is caused by these missing files.

Hope this helps a little. Please let us know how it goes.

Best,
- Willem

p.s. Be careful sharing SECRET_KEY_BASE, of course.


On 07-01-18 20:16, Sven [via foodsoft] wrote:
Oh boy, this is a hard setup. Sorry.

I am following https://github.com/foodcoops/foodsoft/blob/master/doc/SETUP_PRODUCTION.md
using the official production docker image. I have mysql DB running and redis on localhost

According to that, I need to prepare an app_config.yml, and place it in `pwd`/config/app_config.yml. Check.
I need to set the env vars:
[hidden email]
REDIS_URL=redis://192.168.178.52:6379
SECRET_KEY_BASE=ZpIw6tz6AT8rVuTQxM1sIfh2vLoTx9
Check.

Then this fails:
$ docker run --name foodsoft_web --rm -e SECRET_KEY_BASE -e DATABASE_URL -e REDI
S_URL -e RAILS_FORCE_SSL=false   -v `pwd`/config/app_config.yml:/usr/src/app/con
fig/app_config.yml:ro foodcoops/foodsoft bundle exec rake db:setup              

Here is the trace:
`/nonexistent` is not a directory.                                              
Bundler will use `/tmp/bundler/home/unknown' as your home directory temporarily.
foodsoftdb already exists                                                      
Loading app configuration from config/app_config.yml                            
rake aborted!                                                                  
Errno::EISDIR: Is a directory @ io_fread - /usr/src/app/config/app_config.yml  
/usr/src/app/lib/foodsoft_config.rb:63:in `read'                                
/usr/src/app/lib/foodsoft_config.rb:63:in `init'                                
/usr/src/app/config/initializers/01_load_app_config.rb:5:in `<top (required)>'  
[...]

I am supposed to create a directory /nonexistent?
The DB already exists, correct. I created it manually.
/usr/src/app/config/app_config.yml is NOT a dir, I run with bash as entrypoint and verifiied:
docker run -it --entrypoint /bin/bash foodcoops/foodsoft
nobody@830959cd5b59:/usr/src/app$ ls -l config
total 68
-rwxr-xr-x 1 root root 5831 Jan  7 16:54 app_config.yml
[...]

I also tried with a Windows path, and with the complete config directory bound from host
$ docker run --name foodsoft_web --net=host --rm -e SECRET_KEY_BASE -e DATABASE_URL -e REDIS_URL -e RAILS_FORCE_SSL=false   -v d:\sprev\Source\Repos\foodsoft\config:/usr/src/app/config:ro foodcoops/foodsoft bundle exec rake db:setup
`/nonexistent` is not a directory.
Bundler will use `/tmp/bundler/home/unknown' as your home directory temporarily.rake aborted!
LoadError: cannot load such file -- /usr/src/app/config/application
/usr/src/app/Rakefile:4:in `require'
[...]


If you reply to this email, your message will be added to the discussion below:
http://foodsoft.51229.x6.nabble.com/foodsoft-on-docker-using-the-official-image-tp1617.html
To start a new topic under foodsoft-dev, email [hidden email]
To unsubscribe from foodsoft-dev, click here.
NAML