QPixel <img src=“https://circleci.com/gh/ArtOfCode-/qpixel.svg?style=svg” alt=“CircleCI” /> <img src=“https://codeclimate.com/github/ArtOfCode-/qpixel/badges/gpa.svg” /> <img src=“https://coveralls.io/repos/github/ArtOfCode-/qpixel/badge.svg?branch=master” alt=“Coverage Status” />¶ ↑
Rails Q&A software… because I can. This is based on Stack Exchange, though is deliberately a little differently designed and written. (duh, theirs is in C# ASP.NET MVC…)
Dependencies & Database¶ ↑
To get started, you will need:
-
A Linux server (or Windows, though if you can make Rails run smoothly on Windows you’re doing better than me)
-
Ruby
2.2.1p85
-
Rails 4.2.6
Run bundle install
to install the required gems.
Run the following commands, in sequence, to set up the database.
rake db:create rake db:schema:load rake db:migrate rake db:seed
To set up scheduled tasks, run this command to populate your crontab file:
whenever --update-crontab
SSL via Let’s Encrypt¶ ↑
If you want to set up the Let’s Encrypt plugin, you need a few more commands. Make the required directories:
mkdir key challenge certificates
Generate an RSA private key (no larger than 4096 bytes):
openssl genrsa 4096 > key/keyfile.pem
Copy the example config to a real config file:
cp config/letsencrypt_plugin.example.yml config/letsencrypt_plugin.yml
You will then need to edit the config file (config/letsencrypt_plugin.yml
) and insert your administration email address and your domain where they’re marked.
At this point you’ll need to have a server running for the Let’s Encrypt plugin to send and receive data from, so start a normal HTTP server using ‘rails s -p 80` (see Start the Server, below, for more info on that command).
Run the Rake task to get SSL certificates:
rake letsencrypt_plugin
You can now kill the HTTP server if you wish to.
Start the Server¶ ↑
To start the server, use
rails s -p 80
If you’re on a machine that has multiple public-facing IPs, you’ll need to specify which one to bind to using the -b
switch: on Amazon EC2, I need to use rails s -p 80 -b 172.31.33.173
to get it to run successfully.
Troubleshooting¶ ↑
-
If any of the above commands don’t work, try using them under
sudo
(or, if your Ruby installation uses RVM, you can tryrvmsudo
). Beware of doing this with the Let’s Encrypt plugin commands - if you do this, you will also need to run the application server undersudo
orrvmsudo
. -
Beware of firewalls: if your server has a firewall that defaults to ‘everything closed’ mode, you will need to open some ports in it to be able to run across the public Internet. On Amazon EC2 this is the case - the security group governs the incoming and outgoing connections rules. You’ll need to open whichever port you’re running on - if that’s normal HTTP, you want 80; if it’s HTTPS you need 443.
-
Most site settings are configurable through the admin interface or through privilege thresholds.