Giter Club home page Giter Club logo

dockerizing-ruby's Introduction

Tomas Fernandez

Me

๐Ÿ‘‹ My name is Tomas Fernandez. I live in Argentina. Over my professional career, Iโ€™ve worn many hats: sysadmin, dba, and developer. I loved them all.

A few years ago, I needed a change and began freelancing. One thing led to another, and I found a passion for technical writing. After a few years of freelancing, I was fortunate enough to be offered a position as a full-time writer at Semaphore.

You can find my personal blog at tomfern.com and my professional writings at the Semaphore blog.

Find me also in:

-Tomas

dockerizing-ruby's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

dockerizing-ruby's Issues

Running the docker-compose for the given repo doesn't work

I have cloned this repo and trying to run the sample application as it is in docker. Upon running "docker-compose up" the container for drkiq database gets exited at start and the application is not running at expected.

Logs are given below

sudo docker logs 039dad81986b
I, [2022-03-07T18:47:58.460070 #7]  INFO -- : Refreshing Gem list
I, [2022-03-07T18:47:59.290132 #7]  INFO -- : listening on addr=0.0.0.0:8010 fd=13
E, [2022-03-07T18:47:59.363708 #7] ERROR -- : FATAL:  database "drkiq" does not exist
 (ActiveRecord::NoDatabaseError)
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:50:in `rescue in postgresql_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql_adapter.rb:33:in `postgresql_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:887:in `new_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:931:in `checkout_new_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:910:in `try_to_checkout_new_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:871:in `acquire_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:593:in `checkout'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:437:in `connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:1119:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_handling.rb:221:in `retrieve_connection'
/usr/local/bundle/gems/activerecord-6.0.3.4/lib/active_record/connection_handling.rb:189:in `connection'
config/unicorn.rb:30:in `block in reload'
/usr/local/bundle/gems/unicorn-5.5.5/lib/unicorn/http_server.rb:542:in `spawn_missing_workers'
/usr/local/bundle/gems/unicorn-5.5.5/lib/unicorn/http_server.rb:144:in `start'
/usr/local/bundle/gems/unicorn-5.5.5/bin/unicorn:128:in `<top (required)>'
/usr/local/bundle/bin/unicorn:23:in `load'
/usr/local/bundle/bin/unicorn:23:in `<top (required)>'
/usr/local/lib/ruby/2.7.0/bundler/cli/exec.rb:63:in `load'
/usr/local/lib/ruby/2.7.0/bundler/cli/exec.rb:63:in `kernel_load'
/usr/local/lib/ruby/2.7.0/bundler/cli/exec.rb:28:in `run'
/usr/local/lib/ruby/2.7.0/bundler/cli.rb:476:in `exec'
/usr/local/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
/usr/local/lib/ruby/2.7.0/bundler/cli.rb:30:in `dispatch'
/usr/local/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
/usr/local/lib/ruby/2.7.0/bundler/cli.rb:24:in `start'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/libexec/bundle:46:in `block in <top (required)>'
/usr/local/lib/ruby/2.7.0/bundler/friendly_errors.rb:123:in `with_friendly_errors'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/libexec/bundle:34:in `<top (required)>'
/usr/local/bundle/bin/bundle:23:in `load'
/usr/local/bundle/bin/bundle:23:in `<main>'

Any help would be highly appreciated.

Generating a Controller does not work

Hi, @TomFern

I followed your guide in https://semaphoreci.com/community/tutorials/dockerizing-a-ruby-on-rails-application

but the step Generating a Controller does not work as expected.

For example, generating another controller does not work:
docker-compose run --user "$(id -u):$(id -g)" drkiq rails g controller User index

command is executed successfully

โžœ  dockerizing-ruby git:(master) docker-compose run --user "$(id -u):$(id -g)" drkiq rails g controller User index 
Starting dockerizing-ruby_redis_1    ... done
Starting dockerizing-ruby_postgres_1 ... done
Creating dockerizing-ruby_drkiq_run  ... done
      create  app/controllers/user_controller.rb
       route  get 'user/index'
      invoke  erb
      create    app/views/user
      create    app/views/user/index.html.erb
      invoke  test_unit
      create    test/controllers/user_controller_test.rb
      invoke  helper
      create    app/helpers/user_helper.rb
      invoke    test_unit
      invoke  assets
      invoke    scss
      create      app/assets/stylesheets/user.scss

but the files are not created anywhere.

โžœ  dockerizing-ruby git:(master) docker-compose run --user "$(id -u):$(id -g)" drkiq ls app/controllers
Creating dockerizing-ruby_drkiq_run ... done
application_controller.rb  concerns  pages_controller.rb

and they do not appear locally too.

Also local updates are not propagated to the running container.
For example edits in drkiq/app/views/pages/home.html.erb are not visible. I had to run docker-compose up -build for these changes to appear on the web app.

What am I missing here?

Errno::EACCES: Permission denied @ rb_sysopen - /usr/local/bundle/cache/minitest-5.14.4.gem

When i try to install/update bundle after adding new gems I got error.

Retrying download gem from https://rubygems.org/ due to error (2/4): Errno::EACCES Permission denied @ rb_sysopen - /usr/local/bundle/cache/minitest-5.14.4.gem

Retrying download gem from https://rubygems.org/ due to error (3/4): Errno::EACCES Permission denied @ rb_sysopen - /usr/local/bundle/cache/minitest-5.14.4.gem

Retrying download gem from https://rubygems.org/ due to error (4/4): Errno::EACCES Permission denied @ rb_sysopen - /usr/local/bundle/cache/minitest-5.14.4.gem

Errno::EACCES: Permission denied @ rb_sysopen - /usr/local/bundle/cache/minitest-5.14.4.gem
An error occurred while installing minitest (5.14.4), and Bundler cannot continue.
Make sure that gem install minitest -v '5.14.4' --source 'https://rubygems.org/' succeeds before bundling.

In Gemfile:
rails was resolved to 6.0.3.5, which depends on
actioncable was resolved to 6.0.3.5, which depends on
actionpack was resolved to 6.0.3.5, which depends on
actionview was resolved to 6.0.3.5, which depends on
rails-dom-testing was resolved to 2.0.3, which depends on
activesupport was resolved to 6.0.3.5, which depends on

database "drkiq_development" does not exist

I clone the repo and run the command:
dsd
and i get this error:

 2023-01-24 11:56:16.076 UTC [33] FATAL:  database "drkiq_development" does not exist
dockerizing-ruby-master-drkiq-1     | E, [2023-01-24T11:56:16.076343 #7] ERROR -- : We could not find your database: drkiq_development. Which can be found in the database configuration file located at config/database.yml.
dockerizing-ruby-master-drkiq-1     | 
dockerizing-ruby-master-drkiq-1     | To resolve this issue:
dockerizing-ruby-master-drkiq-1     | 
dockerizing-ruby-master-drkiq-1     | - Did you create the database for this app, or delete it? You may need to create your database.
dockerizing-ruby-master-drkiq-1     | - Has the database name changed? Check your database.yml config has the correct database name.
dockerizing-ruby-master-drkiq-1     | 
dockerizing-ruby-master-drkiq-1     | To create your database, run:
dockerizing-ruby-master-drkiq-1     | 
dockerizing-ruby-master-drkiq-1     |         bin/rails db:create
dockerizing-ruby-master-drkiq-1     |  (ActiveRecord::NoDatabaseError)
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/activerecord-7.0.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb:81:in `rescue in new_client'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/activerecord-7.0.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb:77:in `new_client'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/activerecord-7.0.2.4/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/activerecord-7.0.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:656:in `public_send'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/activerecord-7.0.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:656:in `new_connection'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/activerecord-7.0.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:700:in `checkout_new_connection'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/activerecord-7.0.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:679:in `try_to_checkout_new_connection'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/activerecord-7.0.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:640:in `acquire_connection'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/activerecord-7.0.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:341:in `checkout'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/activerecord-7.0.2.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:181:in `connection'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/activerecord-7.0.2.4/lib/active_record/connection_adapters/abstract/connection_handler.rb:211:in `retrieve_connection'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/activerecord-7.0.2.4/lib/active_record/connection_handling.rb:313:in `retrieve_connection'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/activerecord-7.0.2.4/lib/active_record/connection_handling.rb:280:in `connection'
dockerizing-ruby-master-drkiq-1     | config/unicorn.rb:30:in `block in reload'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/unicorn-6.1.0/lib/unicorn/http_server.rb:541:in `spawn_missing_workers'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/unicorn-6.1.0/lib/unicorn/http_server.rb:143:in `start'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/unicorn-6.1.0/bin/unicorn:128:in `<top (required)>'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/bin/unicorn:25:in `load'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/bin/unicorn:25:in `<top (required)>'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:58:in `load'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:58:in `kernel_load'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/bundler-2.3.12/lib/bundler/cli/exec.rb:23:in `run'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/bundler-2.3.12/lib/bundler/cli.rb:483:in `exec'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/bundler-2.3.12/lib/bundler/cli.rb:31:in `dispatch'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/bundler-2.3.12/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/bundler-2.3.12/lib/bundler/cli.rb:25:in `start'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/bundler-2.3.12/exe/bundle:48:in `block in <top (required)>'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/bundler-2.3.12/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/gems/bundler-2.3.12/exe/bundle:36:in `<top (required)>'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/bin/bundle:25:in `load'
dockerizing-ruby-master-drkiq-1     | /usr/local/bundle/bin/bundle:25:in `<main>'
dockerizing-ruby-master-drkiq-1 exited with code 1
^CGracefully stopping... (press Ctrl+C again to force)
Aborting on container exit...

Can you please update the commands to run in README.md ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.