Sign inSign up

pirhoo/jquest

By pirhoo

Updated over 9 years ago

The last build of jQuest.

Image
0

1.3K

pirhoo/jquest repository overview

jQuest

Code Climate Build Status

Install in development

The following guide explain how to install jQuest for development purpose.

0. Install system dependencies

This may change according to your OS. On Ubuntu you must install those header packages to be able to compile ruby dependencies:

sudo apt-get install ruby-dev libpq-dev libsqlite3-dev

1. Setup packages

Assuming you already installed Ruby, Bundler and Bower on your computer.

make install
2. Configure environment

You must specify a few environment variables. Those variables can be set using a file config/local-env.yml (it will be loaded when the app will start).

NameDescriptionExamples
DB_ADAPTERThe database adapter to usepostgresql, sqlite3
DATABASE_URLThe database URI to usepostgres://user:password@localhost:5432/jquest, db/development.sqlite3
SLACK_API_TOKENUser API token to connect to Slack you can get from here.xoxp-XXXXXXXXXXX-XXXXXXXXXXX-XXXXXXXXXXX-XXXXXXXXXXX

For instance, to use the app with SQLite:

DB_ADAPTER: sqlite3
DATABASE_URL: db/development.sqlite
SLACK_API_TOKEN: xoxp-whatever-you-got-from-slack
3. Setup and populate database
rails db:setup

If you use PostgreSQL, an alternative way to setup the database is to get a copy from the production. This is a destructive action since it remove your local database to fill it with real-life data. Use the following command:

make pg-pull
4. Run

The app autoreloads when changing ruby files, or assets.

make run

Install inside a Docker for production

Build the container

To ease the deployment of jQuest, we provide a Dockerfile to build the app and get ready for production with a single command line:

docker build --build-arg ASSET_HOST=//assets.jquestapp.com -t jquest .

Note: Here we build the assets using the default host but it must be your own server or a CDN.

Run the instance

Use environments variables within your Docker host to configure the app. Any existing config/local-env.yml file will be ignored.

Assuming you named your container jquest as above, simply run:

docker run -p 3333:3000 -it jquest bin/web

Your app is now listening on localhost:3333

Environment variables in production

As mentioned above, jQuest can be configured with environment variables:

NameDescriptionExamples
DB_ADAPTERThe database adapter to use.postgresql, sqlite3
DATABASE_URLThe database URI to use.postgres://user:password@localhost:5432/jquest, db/development.sqlite3
SLACK_API_TOKENUser API token to connect to Slack you can get from here.xoxp-XXXXXXXXXXX-XXXXXXXXXXX-XXXXXXXXXXX-XXXXXXXXXXX
ASSET_HOSTHostname that distribute the assets.//asset.jquestapp.com
HOSTNAMEHostname of the app (needed by mailers).http://www.jquestapp.com
S3_BUCKETBucket name to upload files to.static.jquestapp.com
AWS_ACCESS_KEY_IDAWS access key id.
AWS_SECRET_ACCESS_KEYAWS secret key.
AWS_REGIONAWS region to distribute files.eu-west-1
RAILS_SERVE_STATIC_FILESShould Rails serve assets?1
RAILS_LOG_TO_STDOUTShould Rails print logs to stdout?1
MEMCACHIER_SERVERSIf present, activates cache with Memcahier. List Memcahier servers.something.ec2.memcachier.com:11211
MEMCACHIER_USERNAMEMemcachier username.
MEMCACHIER_PASSWORDMemcachier password.
NEW_RELIC_APP_NAMEIf present, activates RPM measure with New Relic.jquest
NEW_RELIC_LICENSE_KEYNew Relic Licence key.
NEW_RELIC_LOGNew Relic source.stdout
SENDGRID_USERNAMEIf present, uses SendGrid as mailer.[email protected]
SENDGRID_PASSWORDSendGrid passowrd.
WEB_CONCURRENCYNumber of concurrent process to start with Puma1

Setting up SSL on Heroku

Follow this tutorial to get SSL certificat from EFF. Enable SSL with Fatly using this tutorial.

Tag summary

Content type

Image

Digest

Size

172.6 MB

Last updated

over 9 years ago

docker pull pirhoo/jquest