项目作者: quantum-bits

项目描述 :
Scripture Engagement Application: Server
高级语言: JavaScript
项目地址: git://github.com/quantum-bits/galilee-server.git
创建时间: 2016-04-23T18:51:56Z
项目社区:https://github.com/quantum-bits/galilee-server

开源协议:

下载


Galilee

Scripture Engagement Application: Server

Install Node

Install the LTS version of node
(as of this writing version 6.10.3 is known to work).
If you don’t already have node installed,
we recommend nvm.

Install Galilee

Clone the source code from Github:

  1. git clone https://github.com/quantum-bits/galilee-server.git

Install the Node modules configured into package.json:

  1. npm install

Configure Galilee

Galilee supports PostgreSQL and MySQL.
Please refer to the documentation for your database and platform
for installation instructions.

Configuration data are stored in two files:
public.conf.json contains non-sensitive information
and is checked into revision control;
secret.conf.json contains sensitive information
(passwords, etc.)
and is never checked in to revision control.
It’s possible that some installations will want to move
configuration data from the public to the secret file
(e.g., hostnames).
Galilee first reads the public.conf.json file
and then the secret.conf.json file.
Overlapping content from the secret file
will overwrite content in the public file.
Either move configuration information from public.conf.json,
or simply leave it alone and override settings
you want to keep private in the secret.conf.json file.

The following snippet is an empty
copy of the secret.conf.json file
as of this writing.

The developmment, staging, and production
contain configuration information
used by the development and production
deployments of Galilee,
which has used PostgreSQL to date.
We have recently added support for
a MySQL backend.
It is configured in the mysql section.
Refer to [Configuring the Database]
for more information.

The bg section contains credentials for the
Bible Gateway API,
and the esv section for the Crossway API
for the English Standard Version.

The API uses Javascript Web Tokens for
authentication.
The jwt entry should contain the secret key
used to create tokens.

The developement team use Slack
for devops reporting. The hook-url entry
contains the Slack hook for this service.
Leaving it blank should be fine.

  1. {
  2. "development": {
  3. "db": {
  4. "connection": {
  5. "user": "",
  6. "password": ""
  7. }
  8. }
  9. },
  10. "staging": {
  11. "db": {
  12. "connection": {
  13. "user": "",
  14. "password": ""
  15. }
  16. }
  17. },
  18. "production": {
  19. "db": {
  20. "connection": {
  21. "user": "",
  22. "password": ""
  23. }
  24. }
  25. },
  26. "mysql": {
  27. "db": {
  28. "connection": {
  29. "user": "",
  30. "password": ""
  31. }
  32. }
  33. },
  34. "bg": {
  35. "username": "",
  36. "password": ""
  37. },
  38. "esv": {
  39. "access-key": ""
  40. },
  41. "jwt-key": "",
  42. "slack": {
  43. "hook-url": ""
  44. }
  45. }

Configure the Database

The developmment, staging, production,
and mysql sections of the configuration files
must be set up to refer to the appropirate DBMS.

In the appropirate sections of the public.conf.json file,
set the following field values:

  • database: database instance/schema name
  • host: host name where the database is running
  • charset: character (used by PostgreSQL)

In the appropirate sections of the secret.conf.json file,
set the following field values:

  • user: database user account name
  • password: database user password

Initialize the Schema

From the command line, run
one of the following commands.
For development:

  1. npm run knex:migrate:dev

For production:

  1. npm run knex:migrate:prod

For mysql:

  1. npm run knex:migrate:mysql

This should create all the database tables.

Load Fixture Data

From the command line, run
one of the following commands.

For development:

  1. npm run knex:seed:dev

For production:

  1. npm run knex:seed:prod

For mysql:

  1. npm run knex:seed:mysql

This should add sample data to the database.

Run the Server

From the command line, run
one of the following commands.

For development:

  1. npm run start:dev

For production:

  1. npm run start:prod

For mysql:

  1. npm run start:mysql

This should fire up the server,
which will display a list of endpoints
and begin listening for requests.