Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do I create an app with Urls like 'https://username.website.com/' instead of 'https://website.com/username/' ?

Damian Nelwep asked in Rails

Hello everyone,

I searched but didn't find anything and was hoping like I said in the title of this subject, to find a way to get the url displaying a user's profile of a client's app to be like username.website.com/ instead of the classic website.com/username .

On a first look I thought I could manage that in the routes but in the end I guessed it was more of a question about DNS managment and creating a new DNS for each user. Anyway it seems pretty tricky but not so impossible and I was just hoping to find someone naming some magical gem that could more or less easily do the trick for me.

Thank you so much in advance for your help and your precious advice and wishing a great day to you. :)

Reply

Hey Damin,

You can handle subdomains from scratch like so: https://gorails.com/episodes/subdomains-and-multi-tenancy-from-scratch?autoplay=1

An alternative is to let the Apartment gem do it for you. Covered that here, they have a subdomain option as well. https://gorails.com/episodes/multitenancy-with-apartment?autoplay=1

You'll have to set your DNS to redirect *.website.com to your server for this to work.

Reply

Thank you so much it seems to be exactly what I wanted to know... Do you suggest doing it from scratch or with Apartment gem ? By the way I have the same question about Devise and an authentification system made from scratch... Thank you again this is so kind

Reply

By the way thank you so much for your work it is incredible... Just about to subscribe to your monthly offer..! Anyways I started a project but then saw your great and smart shortcut 'jumpstart'... Unfortunatly I get an error :

23:59:33 web.1     | => Booting Puma
23:59:33 web.1     | => Rails 5.2.2 application starting in development 
23:59:33 web.1     | => Run `rails server -h` for more startup options
23:59:33 web.1     | RAILS_ENV=development environment is not defined in config/webpacker.yml, falling back to production environment
23:59:33 web.1     | Exiting
23:59:33 sidekiq.1 | RAILS_ENV=development environment is not defined in config/webpacker.yml, falling back to production environment
23:59:33 web.1     | exited with code 1
23:59:33 system    | sending SIGTERM to all processes
Traceback (most recent call last):
    14: from /home/meaw/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `<main>'
    13: from /home/meaw/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `eval'
    12: from /home/meaw/.rvm/gems/ruby-2.5.1/bin/foreman:23:in `<main>'
    11: from /home/meaw/.rvm/gems/ruby-2.5.1/bin/foreman:23:in `load'
    10: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/foreman-0.84.0/bin/foreman:7:in `<top (required)>'
     9: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
     8: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
     7: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
     6: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
     5: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/foreman-0.84.0/lib/foreman/cli.rb:42:in `start'
     4: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/foreman-0.84.0/lib/foreman/engine.rb:60:in `start'
     3: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/foreman-0.84.0/lib/foreman/engine.rb:438:in `wait_for_shutdown_or_child_termination'
     2: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/foreman-0.84.0/lib/foreman/engine.rb:472:in `terminate_gracefully'
     1: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/foreman-0.84.0/lib/foreman/engine.rb:200:in `kill_children'
/home/meaw/.rvm/gems/ruby-2.5.1/gems/foreman-0.84.0/lib/foreman/engine.rb:200:in `kill': no implicit conversion from nil to integer (TypeError)

Do you think you could help me..? I wonder if the problem comes from postgresql conflict... thank you in advance and again bless you for your amazing work!

Reply

Sounds like something is killing the web process. What happens if you just run rails s instead of foreman?

Reply

I get the following :

=> Booting Puma
=> Rails 5.2.2 application starting in development 
=> Run `rails server -h` for more startup options
RAILS_ENV=development environment is not defined in config/webpacker.yml, falling back to production environment
Exiting
Traceback (most recent call last):
    72: from bin/rails:3:in `<main>'
    71: from bin/rails:3:in `load'
    70: from /home/meaw/work/weepx/two/weepx/bin/spring:15:in `<top (required)>'
    69: from /home/meaw/work/weepx/two/weepx/bin/spring:15:in `require'
    68: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
    67: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
    66: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
    65: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
    64: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
    63: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
    62: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
    61: from /home/meaw/work/weepx/two/weepx/bin/rails:9:in `<top (required)>'
    60: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
    59: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
    58: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
    57: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
    56: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
    55: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
    54: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
    53: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
    52: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/commands.rb:18:in `<main>'
    51: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/command.rb:46:in `invoke'
    50: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/command/base.rb:65:in `perform'
    49: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
    48: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
    47: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
    46: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/commands/server/server_command.rb:142:in `perform'
    45: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/commands/server/server_command.rb:142:in `tap'
    44: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/commands/server/server_command.rb:147:in `block in perform'
    43: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/commands/server/server_command.rb:51:in `start'
    42: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/commands/server/server_command.rb:89:in `log_to_stdout'
    41: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/rack-2.0.6/lib/rack/server.rb:354:in `wrapped_app'
    40: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/commands/server/server_command.rb:27:in `app'
    39: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/rack-2.0.6/lib/rack/server.rb:219:in `app'
    38: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/rack-2.0.6/lib/rack/server.rb:319:in `build_app_and_options_from_config'
    37: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/rack-2.0.6/lib/rack/builder.rb:40:in `parse_file'
    36: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/rack-2.0.6/lib/rack/builder.rb:49:in `new_from_string'
    35: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/rack-2.0.6/lib/rack/builder.rb:49:in `eval'
    34: from config.ru:in `<main>'
    33: from config.ru:in `new'
    32: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/rack-2.0.6/lib/rack/builder.rb:55:in `initialize'
    31: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/rack-2.0.6/lib/rack/builder.rb:55:in `instance_eval'
    30: from config.ru:3:in `block in <main>'
    29: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:44:in `require_relative'
    28: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `require'
    27: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:257:in `load_dependency'
    26: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/activesupport-5.2.2/lib/active_support/dependencies.rb:291:in `block in require'
    25: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
    24: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
    23: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
    22: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
    21: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
    20: from /home/meaw/work/weepx/two/weepx/config/environment.rb:5:in `<main>'
    19: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/application.rb:361:in `initialize!'
    18: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/initializable.rb:60:in `run_initializers'
    17: from /home/meaw/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
    16: from /home/meaw/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
    15: from /home/meaw/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
    14: from /home/meaw/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `call'
    13: from /home/meaw/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:347:in `each'
    12: from /home/meaw/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
    11: from /home/meaw/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
    10: from /home/meaw/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
     9: from /home/meaw/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
     8: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/initializable.rb:61:in `block in run_initializers'
     7: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/initializable.rb:32:in `run'
     6: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/railties-5.2.2/lib/rails/initializable.rb:32:in `instance_exec'
     5: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/webpacker-3.5.5/lib/webpacker/railtie.rb:79:in `block in <class:Engine>'
     4: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/webpacker-3.5.5/lib/webpacker.rb:26:in `bootstrap'
     3: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/webpacker-3.5.5/lib/webpacker/commands.rb:14:in `bootstrap'
     2: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/webpacker-3.5.5/lib/webpacker/configuration.rb:15:in `refresh'
     1: from /home/meaw/.rvm/gems/ruby-2.5.1/gems/webpacker-3.5.5/lib/webpacker/configuration.rb:75:in `load'
/home/meaw/.rvm/gems/ruby-2.5.1/gems/webpacker-3.5.5/lib/webpacker/configuration.rb:79:in `rescue in load': Webpacker configuration file not found /home/meaw/work/weepx/two/weepx/config/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - /home/meaw/work/weepx/two/weepx/config/webpacker.yml (RuntimeError)

thank you so much for your help I'll subscribe tomorrow

Reply

Can you help me since I finally subscribed ..? :)

Reply

Hey Damian,

Like the error says, looks like you'll need to run "rails webpacker:install"

/home/meaw/.rvm/gems/ruby-2.5.1/gems/webpacker-3.5.5/lib/webpacker/configuration.rb:79:in `rescue in load': Webpacker configuration file not found /home/meaw/work/weepx/two/weepx/config/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - /home/meaw/work/weepx/two/weepx/config/webpacker.yml (RuntimeError)

Jumpstart does that for you automatically, so you shouldn't have to, but maybe something failed when you created it originally.

Reply

Yes that's what I thought ! In the end the problem is that Yarn wasn't installed !! Thank you so much.

And what about the subdomain ? Don't you think that it is better to create it from scratch ? I guess it is better not to make a new table in the database each time a user is created, anyways it seems like Apartement gem makes it possible to do both.

You can tell me what you think is the best solution knowing that in a nutshell, the project consists in a platform where people can create a book, like a little portfolio/website with photos and a little newsfeed.

Reply

Sorry but I have another issue, now concerning Redis as what I understood... if you have a minute thank you for taking the time to help me...

$ foreman start
18:13:38 web.1     | started with pid 15604
18:13:38 sidekiq.1 | started with pid 15605
18:13:38 webpack.1 | started with pid 15606
18:13:40 web.1     | => Booting Puma
18:13:40 web.1     | => Rails 5.2.2 application starting in development 
18:13:40 web.1     | => Run `rails server -h` for more startup options
18:13:41 webpack.1 | Project is running at http://localhost:3035/
18:13:41 webpack.1 | webpack output is served from /packs/
18:13:41 webpack.1 | Content not from webpack is served from /home/meaw/work/weepx/two/weepx/public/packs
18:13:41 webpack.1 | 404s will fallback to /index.html
18:13:41 sidekiq.1 | 2018-12-30T17:13:41.606Z 15605 TID-gsaftu79d INFO: Running in ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
18:13:41 sidekiq.1 | 2018-12-30T17:13:41.607Z 15605 TID-gsaftu79d INFO: See LICENSE and the LGPL-3.0 for licensing details.
18:13:41 sidekiq.1 | 2018-12-30T17:13:41.607Z 15605 TID-gsaftu79d INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org
18:13:41 sidekiq.1 | 2018-12-30T17:13:41.607Z 15605 TID-gsaftu79d INFO: Booting Sidekiq 5.2.3 with redis options {:id=>"Sidekiq-server-PID-15605", :url=>nil}
18:13:41 sidekiq.1 | Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:353:in `rescue in establish_connection'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:336:in `establish_connection'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:104:in `block in connect'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:299:in `with_reconnect'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:103:in `connect'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:372:in `ensure_connected'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:224:in `block in process'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:312:in `logging'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:223:in `process'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:123:in `call'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis.rb:279:in `block in info'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis.rb:50:in `block in synchronize'
18:13:41 sidekiq.1 | /home/meaw/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis.rb:50:in `synchronize'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis.rb:278:in `info'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.3/lib/sidekiq.rb:113:in `block in redis_info'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.3/lib/sidekiq.rb:95:in `block in redis'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:65:in `block (2 levels) in with'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:64:in `handle_interrupt'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:64:in `block in with'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:61:in `handle_interrupt'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:61:in `with'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.3/lib/sidekiq.rb:92:in `redis'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.3/lib/sidekiq.rb:106:in `redis_info'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.3/lib/sidekiq/cli.rb:80:in `run'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.3/bin/sidekiq:12:in `<top (required)>'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/bin/sidekiq:23:in `load'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/bin/sidekiq:23:in `<main>'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `eval'
18:13:41 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `<main>'
18:13:41 web.1     | Puma starting in single mode...
18:13:41 web.1     | * Version 3.12.0 (ruby 2.5.1-p57), codename: Llamas in Pajamas
18:13:41 web.1     | * Min threads: 5, max threads: 5
18:13:41 web.1     | * Environment: development
18:13:41 web.1     | * Listening on tcp://localhost:5000
18:13:41 web.1     | Use Ctrl-C to stop
18:13:41 sidekiq.1 | exited with code 1
18:13:41 system    | sending SIGTERM to all processes
18:13:41 web.1     | - Gracefully stopping, waiting for requests to finish
18:13:41 web.1     | === puma shutdown: 2018-12-30 18:13:41 +0100 ===
18:13:41 web.1     | - Goodbye!
18:13:41 web.1     | Exiting
18:13:41 web.1     | terminated by SIGTERM
18:13:42 webpack.1 | exited with code 0

If this is too tricky I'll may restart from scratch since it could be the easiest way to escape the issue

Reply

Sorry to bother you but I tried to reinitiate the great Jumpstart default install you create but still get an error...

$ foreman start
22:15:15 web.1     | started with pid 23338
22:15:15 sidekiq.1 | started with pid 23339
22:15:15 webpack.1 | started with pid 23340
22:15:18 web.1     | => Booting Puma
22:15:18 web.1     | => Rails 5.2.2 application starting in development 
22:15:18 web.1     | => Run `rails server -h` for more startup options
22:15:18 webpack.1 | Project is running at http://localhost:3035/
22:15:18 webpack.1 | webpack output is served from /packs/
22:15:18 webpack.1 | Content not from webpack is served from /home/meaw/work/weepx/two/weepx/public/packs
22:15:18 webpack.1 | 404s will fallback to /index.html
22:15:19 web.1     | Puma starting in single mode...
22:15:19 web.1     | * Version 3.12.0 (ruby 2.5.1-p57), codename: Llamas in Pajamas
22:15:19 web.1     | * Min threads: 5, max threads: 5
22:15:19 web.1     | * Environment: development
22:15:19 web.1     | * Listening on tcp://localhost:5000
22:15:19 web.1     | Use Ctrl-C to stop
22:15:19 sidekiq.1 | 2018-12-30T21:15:19.407Z 23339 TID-gr77g8fxb INFO: Running in ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
22:15:19 sidekiq.1 | 2018-12-30T21:15:19.407Z 23339 TID-gr77g8fxb INFO: See LICENSE and the LGPL-3.0 for licensing details.
22:15:19 sidekiq.1 | 2018-12-30T21:15:19.407Z 23339 TID-gr77g8fxb INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org
22:15:19 sidekiq.1 | 2018-12-30T21:15:19.407Z 23339 TID-gr77g8fxb INFO: Booting Sidekiq 5.2.3 with redis options {:id=>"Sidekiq-server-PID-23339", :url=>nil}
22:15:19 sidekiq.1 | Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:353:in `rescue in establish_connection'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:336:in `establish_connection'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:104:in `block in connect'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:299:in `with_reconnect'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:103:in `connect'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:372:in `ensure_connected'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:224:in `block in process'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:312:in `logging'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:223:in `process'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis/client.rb:123:in `call'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis.rb:279:in `block in info'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis.rb:50:in `block in synchronize'
22:15:19 sidekiq.1 | /home/meaw/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis.rb:50:in `synchronize'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/redis-4.1.0/lib/redis.rb:278:in `info'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.3/lib/sidekiq.rb:113:in `block in redis_info'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.3/lib/sidekiq.rb:95:in `block in redis'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:65:in `block (2 levels) in with'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:64:in `handle_interrupt'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:64:in `block in with'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:61:in `handle_interrupt'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/connection_pool-2.2.2/lib/connection_pool.rb:61:in `with'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.3/lib/sidekiq.rb:92:in `redis'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.3/lib/sidekiq.rb:106:in `redis_info'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.3/lib/sidekiq/cli.rb:80:in `run'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/gems/sidekiq-5.2.3/bin/sidekiq:12:in `<top (required)>'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/bin/sidekiq:23:in `load'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/bin/sidekiq:23:in `<main>'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `eval'
22:15:19 sidekiq.1 | /home/meaw/.rvm/gems/ruby-2.5.1/bin/ruby_executable_hooks:24:in `<main>'
22:15:20 sidekiq.1 | exited with code 1
22:15:20 system    | sending SIGTERM to all processes
22:15:20 web.1     | - Gracefully stopping, waiting for requests to finish
22:15:20 web.1     | === puma shutdown: 2018-12-30 22:15:20 +0100 ===
22:15:20 web.1     | - Goodbye!
22:15:20 web.1     | Exiting
22:15:20 webpack.1 | Hash: 6fc51c254881fbcdd744
22:15:20 webpack.1 | Version: webpack 3.12.0
22:15:20 webpack.1 | Time: 1299ms
22:15:20 webpack.1 |                                   Asset       Size  Chunks                    Chunk Names
22:15:20 webpack.1 |     application-8d71e5035f8940a9e3d3.js     331 kB       0  [emitted]  [big]  application
22:15:20 webpack.1 | application-8d71e5035f8940a9e3d3.js.map     383 kB       0  [emitted]         application
22:15:20 webpack.1 |                           manifest.json  142 bytes          [emitted]         
22:15:20 webpack.1 |    [2] multi (webpack)-dev-server/client?http://localhost:3035 ./app/javascript/packs/application.js 40 bytes {0} [built]
22:15:20 webpack.1 |    [3] (webpack)-dev-server/client?http://localhost:3035 7.93 kB {0} [built]
22:15:20 webpack.1 |    [4] ./node_modules/url/url.js 23.3 kB {0} [built]
22:15:20 webpack.1 |    [7] ./node_modules/url/util.js 314 bytes {0} [built]
22:15:20 webpack.1 |    [8] ./node_modules/querystring-es3/index.js 127 bytes {0} [built]
22:15:20 webpack.1 |   [11] ./node_modules/strip-ansi/index.js 161 bytes {0} [built]
22:15:20 webpack.1 |   [12] ./node_modules/ansi-regex/index.js 135 bytes {0} [built]
22:15:20 webpack.1 |   [13] ./node_modules/loglevel/lib/loglevel.js 7.86 kB {0} [built]
22:15:20 webpack.1 |   [14] (webpack)-dev-server/client/socket.js 1.08 kB {0} [built]
22:15:20 webpack.1 |   [15] ./node_modules/sockjs-client/dist/sockjs.js 181 kB {0} [built]
22:15:20 webpack.1 |   [16] (webpack)-dev-server/client/overlay.js 3.67 kB {0} [built]
22:15:20 webpack.1 |   [18] ./node_modules/html-entities/index.js 231 bytes {0} [built]
22:15:20 webpack.1 |   [21] (webpack)/hot nonrecursive ^\.\/log$ 170 bytes {0} [built]
22:15:20 webpack.1 |   [23] (webpack)/hot/emitter.js 77 bytes {0} [built]
22:15:20 webpack.1 |   [25] ./app/javascript/packs/application.js 515 bytes {0} [built]
22:15:20 webpack.1 |     + 11 hidden modules
22:15:20 webpack.1 | webpack: Compiled successfully.
22:15:20 web.1     | terminated by SIGTERM
22:15:20 webpack.1 | exited with code 0
Reply

Sorry I thougt I had it on my computer but redis-server was simply not installed..! So now everything is just perfect and ready to work as expected :) in the end I'm pretty sure I'll do the subdomain conception from scratch thanks to the video you made about it. Again thank you for your time and your amazing work. Wishing you a great day/night

Reply

Great! Let us know how it goes. I'm online a bit more during the week (and after the holidays) so sorry for the late replies.

My personal advice is generally to build it from scratch so you can understand how it works in-depth. And if you realize it'll be too much work, then using the apartment gem can help save you some time.

Reply

Thank you I think you're right and that's what I'm about to do..! I was thinking the same about User Authentication System since Devise seems pretty hard to configure but thanks to your great work with the Jumpstart template, you allowed me to save a precious time! :)

Anyway don't worry about taking some time to reply! This is indeed so kind of you to help some newbies like me already and you must have other things to care about! In the end, I'm so happy to have found your website with all of those great and powerfull resources you give away this is really neat and I think I will get better and faster working solutions thanks to you so bless you! ;)

Reply

I was setting up the subdomain mecanic from scratch and it was going pretty well but got some error about devise_parameter_sanatizer with for :


NoMethodError in Devise::RegistrationsController#create
undefined method `for' for #<Devise::ParameterSanitizer:0x00007fa99b371cb0>
Extracted source (around line #17):

15
16
17
18
19
20




      devise_parameter_sanitizer.permit(:sign_up, keys: [:name])
      devise_parameter_sanitizer.permit(:account_update, keys: [:name])
        devise_parameter_sanitizer.for(:sign_up) { |u|
            u.permit(:email, :password, :password_confirmation, account_attributes: [:subdomain])
        }
    end


by the way here is my application_controller.rb file :

class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception

  before_action :configure_permitted_parameters, if: :devise_controller?
  before_action :set_account
  before_action :masquerade_user!

  def set_account
    @account = Account.find_by(subdomain: request.subdomain)
  end

  protected

    def configure_permitted_parameters
      devise_parameter_sanitizer.permit(:sign_up, keys: [:name])
      devise_parameter_sanitizer.permit(:account_update, keys: [:name])
        devise_parameter_sanitizer.for(:sign_up) { |u|
            u.permit(:email, :password, :password_confirmation, account_attributes: [:subdomain])
        }
    end
end

Reply
Reply

I got another issue in the sense that when I click on the app's logo, I get to the posts#index page and not the home page... Besides, when I click on it, the subdomain's name stays present and I don't really see where I can take care of this :s

Reply

All the navigation is in app/views/shared/navbar.html.erb 👍

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.