This is the back end repo for pyzlnar.com
The backend is running on a Rails app (API mode) with PSQL.
Nothing too fancy to be honest, and maybe even a bit lackluster considering I’m supposed to be a backend guy, but tool for the job, so I guess this does for my small API for now. :)
You will need the following installed to be able to run the back end:
-
git
Should go without saying. Get yourself git installed. -
PostgreSQL 9.6.1
Always a nightmare to setup, but it’s amazing to use. General instructions can be found here. -
Memcached (Optional)
Used for simple caching, but won’t have that much of an effect if you don’t install it other than slower responses. Install instructions can be found here.
Clone the repo into your machine, and then change to the directory before you run anything else.
# Create a root directory first if you haven't already.
# The directory structure is not needed, but I like working this way.
$ mkdir pyzlnar
# Clone the repo into front
$ git clone https://github.com/pyzlnar/pyzlnar-back.git pyzlnar/back
# Change to back directory
$ cd pyzlnar/back
With the front repo, directories will look like this.
$ tree pyzlnar/ -L 1
pyzlnar/
├── back
└── front
Now to install all the dependencies. First you need to install bundler(v1.14.3+)
$ gem install bundler
After that, you simply need to install with bundler!
$ bundle install
# Or simply
$ bundle
You might find yourself that the pg
gem is being uncooperative. If that’s the
case follow the output instructions or google around on how to correctly setup
the gem and retry until you’ve succesfuly installed all the gems.
The project uses rails 5.1.4
as of right now in case you’re wondering.
Copy the secrets example into the actual secrets files. Edit the new file
secrets.yml
with your own secrets if needed to.
$ cp config/secrets.example.yml config/secrets.yml
Copy the database example into the actual database files. Edit the new file
database.yml
with your own database configuration.
$ cp config/database.example.yml config/database.yml
Create, migrate and seed the database.
$ rake db:setup
If you find yourself with problems creating the database (lol postgres), the
most common errors are not having the correct username/password in the database
config file (config/database.yml
), not setting the postgres role correctly,
and not setting up the correct database template.
After all that one time setup, running is actually fairly easy!
# This will run the server in localhost:3000
$ rails s
Note
|
If you didn’t install memcached, consider commenting out the cache_store
setting in config/environments/development.rb before running the server.
|
Pyzlnar back is released under the MIT License.