nickjj / orats

Opinionated rails application templates.
MIT License
664 stars 56 forks source link

Unable to run base application #33

Closed jacknaguib closed 6 years ago

jacknaguib commented 6 years ago

Downloaded the orats/lib/orats/templates/base folder on my MacOSX Created a .env file with the following line COMPOSE_PROJECT_NAME=my_dockerized_app

Ran docker-compose up --build docker-compose ps

       Name                         Command               State             Ports          

mydockerizedapp_cable_1 puma -p 28080 cable/config.ru Up 0.0.0.0:28080->28080/tcp mydockerizedapp_postgres_1 docker-entrypoint.sh postgres Up 0.0.0.0:5432->5432/tcp
mydockerizedapp_redis_1 docker-entrypoint.sh redis ... Up 0.0.0.0:6379->6379/tcp
mydockerizedapp_sidekiq_1 sidekiq -C config/sidekiq. ... Exit 1
mydockerizedapp_website_1 /bin/sh -c puma -C config/ ... Exit 1

I cannot Reset and Migrate the database (run this in a 2nd Docker-enabled terminal) as mydockerizedapp_website_1 container has exited!

docker-compose exec website rails db:reset docker-compose exec website rails db:migrate

nickjj commented 6 years ago

If you didn't generate it with the gem, did you follow the instructions on https://github.com/nickjj/orats#do-i-need-to-install-orats-to-use-the-base-app?

Also, I would need the full stack trace to begin troubleshooting whatever prevented you from running it.

jacknaguib commented 6 years ago

No I didn't generate it with the gem. All I did was

Downloaded the orats/lib/orats/templates/base folder on my MacOSX Created a .env file with the following line COMPOSE_PROJECT_NAME=my_dockerized_app

Ran docker-compose up --build

trace.txt

nickjj commented 6 years ago

You'll need to do more than just add that one .env setting. You have none of the app's configuration defined.

Check the link I posted in the above comment and follow the bottom section of the readme exactly.

jacknaguib commented 6 years ago

Ok I followed the remaining instructions on the page to the letter. The services are all up however I get the error shown when navigating to http://localhost:3000

 Name                   Command            State            Ports          

foobar_cable_1 puma -p 28080 Up 0.0.0.0:28080->28080/tcp cable/config.ru
foobar_postgres_1 docker-entrypoint.sh Up 0.0.0.0:5432->5432/tcp
postgres
foobar_redis_1 docker-entrypoint.sh Up 0.0.0.0:6379->6379/tcp
redis ...
foobar_sidekiq_1 sidekiq -C Up
config/sidekiq. ...
foobar_website_1 /bin/sh -c puma -C Up 0.0.0.0:3000->3000/tcp
config/ ...

screen shot 2018-02-19 at 11 40 05 am

trace.txt

nickjj commented 6 years ago

That's ok.

Just update REQUEST_TIMEOUT=5 in the .env file to 30 instead of 5 and restart compose.

It's documented in the .env file at https://github.com/nickjj/orats/blob/master/lib/orats/templates/base/.env.example#L28.

Sometimes in development, volume mounts can be slow, which is why it timed out.

jacknaguib commented 6 years ago

It worked thanks for that.

Just one last question: the project folder looks all funny after running the find sed commands! Did I do something wrong?

ls Dockerfile Gemfile-e-e-e README.md-e-e bin db public Dockerfile-e Gemfile.lock README.md-e-e-e cable docker-compose.yml test Dockerfile-e-e Gemfile.lock-e Rakefile config docker-compose.yml-e tmp Dockerfile-e-e-e Gemfile.lock-e-e Rakefile-e config.ru docker-compose.yml-e-e vendor Gemfile Gemfile.lock-e-e-e Rakefile-e-e config.ru-e docker-compose.yml-e-e-e Gemfile-e README.md Rakefile-e-e-e config.ru-e-e lib Gemfile-e-e README.md-e app config.ru-e-e-e log

nickjj commented 6 years ago

It's possible that the macos version of sed works different than the standard unix / linux version of sed.

Try running brew install gnu-sed to install the gnu version of sed, and then run gsed instead of sed to get the expected behavior.

Once doing that, you may want to clone a new project because fixing those file names by hand would be really tedious.