So chris im using this on my db.yml file
on your video you paste this code
url: <%= ENV["DATABASE_URL"] %>
pool: <%= ENV["DB_POOL"] || ENV['MAX_THREADS'] || 5 %>
• form my db.yml code what parts I need to change.
• on heroku Config Vars I only have the DATABASE_URL its the DB_POOL build by puma??
Heroku really only recommends the two lines for url and pool. The rest of that is all handled by Heroku. The DB_POOL may not be set, which will default it to 5 which is fine. You'll be able to easily change that as you scale up your Heroku servers.
thnx Chris for the quick response as always. works great the app performance double just by changing from unicorn to puma.
Chris, great video again. I had to go thru this 2 weeks ago and I wish I had this video back then. I've got a question which is not about this video, but about the very next step after deploying your app on heroku. So I had bought a custom domain (with google) and set up CNAME/ALIAS records with the pointDNS heroku addon. After that I realized that I need to configure my app over https if I use the custom domain instead of xyz.herokuapp.com. I read a bunch of articles, but still not sure what to choose. If it is possible I'd like to avoid the basic heroku addon solution since it costs $20/month. I've also seen the cloudfare free plan solution (https://www.cloudflare.com/..., but I'm not sure if it's good enough for production. Can you tell us/me pls, which one is the preferred solution here in general (not only from these 2 that I mentioned)?
Your cheapest option would be to use Cloudflare's flexible SSL. You wouldn't have to pay for the $20/mo for SSL hosting on Heroku that way. There are some other SSL options that Cloudflare provides but I think they cost money. https://www.cloudflare.com/...
Also most places require you to purchase an SSL certificate, but you may want to check out Let's Encrypt which let's you get a free SSL certificate. https://letsencrypt.org/
Chris, thanks for the super quick answer. Is this free solution good enough for a new production app or you would recommend the heroku addon for $20/month (or something else) to avoid problems down the road?
The free solution is alright. It provides a semi-secure connection. You're securely connected to Cloudflare, then the request gets forwarded to you, but at that point it is unencrypted. There is a possibility that someone could access the traffic coming from Cloudflare to your app that's unencrypted.
If you do need something that's fully encrypted, you'll want an SSL cert running on Heroku. That's the route I usually take because we want full encryption (and sometimes don't use Cloudflare).
Hi Chris, I'm trying to follow along with this, but I'm stuck at the point where you use mvim to make a procfile. I don't know what mvim is (and if I have it, I don't know how to use it). I don't know how to make a procfile. I found someone on SO who is stuck with the same thing. Adapting their attempt, I did this in my terminal: echo "web: bundle exec puma -C config/puma.rb" > Procfile. Is that going to work to make a procfile? Thanks Mel
Hi Chris, i tried this. My database.yml now looks like yours. Now, when I try to precompile assets i get an error in my terminal that says:
ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
My default specifies psql
Hey chris, if we have everything except the procfile...does this mean that puma is not going to start working on heroku?
My chat with actioncable + redis works 100% fine still.
Hey Chris, if I have this setup in puma.rb
threads_count = Integer(5)
do I have to set my database.yml pool to 10? (each thread gets their own db connection?)
url: <%= ENV['DATABASE_URL'] %>
Yeah, that should be correct. You'd multiple the two together to get your minimum pool size since each thread would need a database connection to operate (since they're doing the work).
Your app would look like this:
worker 1 -> thread -> thread -> thread -> thread -> thread worker 2 -> thread -> thread -> thread -> thread -> thread
Join 30,005+ developers who get early access to new screencasts, articles, guides, updates, and more.