bridgetownrb / bridgetown

A next-generation progressive site generator & fullstack framework, powered by Ruby
https://www.bridgetownrb.com
MIT License
1.16k stars 112 forks source link

docs: need to explain how to configure an alternative port for Puma #625

Closed whysthatso closed 1 year ago

whysthatso commented 2 years ago

setting port ENV.fetch("BRIDGETOWN_PORT") { 4001 } in config/puma.rb results in the site being served under port 4001 but the logs showing this:

[Bridgetown]           Starting: Bridgetown v1.1.0 (codename "Belmont")
[Server] * Puma version: 5.6.4 (ruby 3.1.2-p20) ("Birdie's Version")
[Server] * PID: 16564
[Server] * Listening on http://0.0.0.0:4001
[Server] Use Ctrl-C to stop
[Frontend] yarn run esbuild-dev
[Frontend] yarn run v1.22.19
[Frontend] $ node esbuild.config.js --watch
[Frontend] esbuild: frontend bundling started...
[Bridgetown]        Environment: development
[Bridgetown]             Source: /home/andreas/resilio/projects/wellpress_site/bulma_fresh/src
[Bridgetown]        Destination: /home/andreas/resilio/projects/wellpress_site/bulma_fresh/output
[Bridgetown]     Custom Plugins: /home/andreas/resilio/projects/wellpress_site/bulma_fresh/plugins
[Bridgetown]         Generating… 
[Bridgetown]         Pagination: disabled. Enable in site config with pagination:\n enabled: true
[Bridgetown]             Done! 🎉 Completed in less than 1.04 seconds.
[Bridgetown]                     
[Bridgetown]     Now serving at: http://localhost:4000
[Bridgetown]                     http://10.20.30.117:4000
[Bridgetown]

setting port: 4001 in bridgetown.config.yml did not change the output.

this is the line responsible for setting the value, i believe:

port = config_options.bind&.split(":")&.last || ENV["BRIDGETOWN_PORT"] || 4000

is this possibly a regression due to the migration to puma?

jaredcwhite commented 2 years ago

Oops, we haven't documented the recommended way of configuring Puma options. In this case you would want to keep config/puma.rb as is (with 4000 as a default), and instead update your bridgetown.config.yml file to include this:

development:
  bind: "tcp://0.0.0.0:4001"

Let me know if that works for you.

jaredcwhite commented 2 years ago

(and placing that within development means it's a separate configuration option from the production environment, which you can also change independently if you don't want to use the BRIDGETOWN_PORT ENV variable)

whysthatso commented 2 years ago
development:
  bind: "tcp://0.0.0.0:4001"

that did it, thanks.

jaredcwhite commented 1 year ago

Added Puma docs in the latest commit.