Activity
Yep. You can set it up to do a git push like Heroku does, but I've never set a server up that way before so you'll probably need to do some digging to figure out how to do it. Check out this: https://www.digitalocean.co...
I'd recommend reading through this for a bunch of SSL related information and an example config: https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
I just purchased my SSL cert from the same place I registered the domain which you can usually do. You'll need to just upload that to the server and configure it to load the cert and key from that process. Usually they give you some instructions on how to do that as well.
Here's one where he buys the cert from Namecheap and configures it: https://aralbalkan.com/scribbles/setting-up-ssl-with-nginx-using-a-namecheap-essentialssl-wildcard-certificate-on-digitalocean/
Posted in Liking Posts Discussion
Not really. The only thing that will change is querying for the nested object and adding likes to it.
Your controller would do something like:
@course = Course.find(params[:course_id])
@lesson = @course.lessons.find(params[:id])
And then as long as you have your likes association on the Lesson model, you should be good to go.
If you're shooting for a complex setup, Rubber is probably good. This is just a simple Rails App and MySQL or Postgres instance on the same server.
Yep, pretty much the same thing aside from they connect you differently with .pem keys instead of a password to login initially. May also have to open up the ports to the outside world so you can server HTTP requests.
Posted in Liking Posts Discussion
If it's in reference to your Post database model (That's my guess) then you want to reference singular "Post" and not plural "Posts" in your controller. Pluralization can get you easily with Rails. :)
Posted in Wrong Ruby version with Postgres user
So the two files database.yml
and secrets.yml
work similarly. Both files are used to store private information (passwords, API keys, etc). You normally don't want these in your git repo. You can keep examples in the repo so that people can quickly set it up on a new machine, but that's about it.
When you don't have the files in your git repo, that means everyone who clones the repo to their development machine has to create the database.yml
and secrets.yml
and configure it to point to their database.
Production works the same way. You've got a different database and different passwords / API keys that you need to use there so you create those files manually on the server just like you did on your local machine in development.
If you run your own server and deploy with capistrano, you put these files in a shared
directory. The deploy script symlinks this file into the Rails app so that every deploy gets pointed to the correct database and secrets files. No need for environment variables here.
Heroku makes this a bit different than if you do Digital Ocean, AWS, etc. There is no shared
directory so you actually set environment variables with heroku config
. They overwrite your database.yml
and you don't get the same benefits of using secrets.yml
since they are already in ENV.
ENV is sometimes tricky to set up when deploying your own app. Apache, Nginx, and all the other web servers configure environment variables differently. That's why they introduced secrets.yml
so you don't have to mess with configuring all these different services and your application can simply handle it.
Does that clear things up?
Posted in Setup MacOS 10.10 Yosemite Discussion
Your best bet is to probably try following these steps. Homebrew should take care of getting everything installed properly for you.
Interesting. I can't think of much except for maybe having a typo somewhere.
Since they are reads, I think that so long as your database server can handle it, it doesn't matter how many connections read from the same table. Reads don't lock the table/row like writes do since a read cannot cause data loss. You shouldn't experience any loss of speed if many things are reading the same table.
Posted in Subdomains
Hey Jon,
Not yet! I've been busy with the holidays but I plan on starting to cover this in the next week.
I'd suggest doing the symlink and using those. Environment variables are harder to configure and secrets.yml
was designed specifically to help solve that problem.
Great idea. I don't have a copy yet but I'll do that next episode. It basically is rails new app, install devise, bootstrap-sass and create an application layout that uses bootstrap. Pretty quick / basic and it lets me focus on the topic instead in the videos.
Posted in Wrong Ruby version with Postgres user
So the postgres user I'm talking about is just the database user, not an Ubuntu user named postgres. There is a Ubuntu user with the name of postgres that gets added when you install the database and thats how it restricts permissions to edit the db.
Do you have the error handy for your postgres connection?
Posted in Nginx.conf failed
Thanks for the heads up! I guess they updated their tutorial and I didn't notice.
Awesome, glad you got it figured out!
I believe that can happen with the callback url on Twitter. You might try http://127.0.0.1:3000/ instead of localhost.
When Capistrano deploys your app, it saves a copy of each deploy into releases
. When the deploy succeeds, it makes current
a link to the latest release so that you can manage and rollback your deploys easily. Your nginx config needs to point to the current/public directory instead because of this so it can find the most recent Rails deploy. Update your nginx conf to this and try restarting nginx.
root /home/jk/eyideaIS/current/public;
Posted in Implementing Markdown Support in Forums
Great post. Redcarpet is great and I like that you've got notes for all the different options.
Also check out this episode: https://gorails.com/episodes/markdown-emoji-with-html-pipeline-gem
I really like Redcarpet, but html-pipeline lets you add in your own filters so you can add things like Emoji and build your own for custom things (like maybe you want to detect Youtube URLs and embed them).
Posted in Nginx.conf failed
Interesting. What if you comment out the passenger_root
line? Does sudo nginx -t
then give you an error on passenger_ruby
?
Also, maybe check dpkg to see if the two packages are installed. This is what I get from running dpkg -l nginx
and dpkg -l passenger
:
$ dpkg -l nginx-full
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=============================-===================-===================-================================================================
ii nginx-full 1:1.6.2-2.4.0.56~tr i386 nginx web/proxy server (standard version)
$ dpkg -l passenger
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=============================-===================-===================-================================================================
ii passenger 1:4.0.56-1~trusty1 i386 Rails and Rack support for Apache2 and Nginx
If so, I'm guessing that maybe the passenger Ubuntu package didn't get installed and maybe only nginx-full.