Premiere is a movie recommendation engine.
View the [project roadmap] (https://docs.google.com/document/d/1G0QEuFhXAR2H6vbSgyYonfQ1UkbpUq5ephmo5YCSVgc/edit?usp=sharing)
See CONTRIBUTING.md for contribution guidelines.
- Node 6.9.x
- Redis 3.2.x
- Postgresql 9.6.x
- etc
brew install yarn
brew install redis
brew install postgresql
Yarn is a replacement for npm. It's faster and guarantees consistency -- as you deploy your code in various environments, you won't run the risk of slight variations in what gets installed.
-- output from redis install below -- To have launchd start redis now and restart at login: brew services start redis Or, if you don't want/need a background service you can just run: redis-server /usr/local/etc/redis.conf
-- output from postgresql install below -- To have launched start postgresql now and restart at login: brew services start postgresql Or, if you don't want/need a background service you can just run: pg_ctl -D /usr/local/var/postgres start
yarn global add grunt-cli knex eslint
yarn install
Override settings config/default.json
in any environment by making a copy of config/ENV.example.json
and naming it config/ENV.json
and setting the appropriate variable.
For environments that require use of environment variables, you can supply variables as defined in config/custom-environment-variables.json
.
See https://www.npmjs.com/package/config and https://github.com/lorenwest/node-config/wiki/Environment-Variables#custom-environment-variables
If you are using Atom and don't see these new files, follow instructions here: http://blog.lukebennett.com/2015/09/21/show-hidden-files-in-atom-sidebar/
If you have any CRLF and LF errors due to a mix between Mac and Windows contributors, run git config core.autocrlf false
IMPORTANT: ensure postgres
is running before performing these steps with below command:
brew services start postgresql
See DB_DOCUMENTATION.md for more explanation of the DB setup
##Postgres
- Open the postgresql command prompt with
psql postgres
- Create a project specific user with this command:
create role raiders with login password 'theLostApp' createdb;
- This user / password is the same as found in the config/default.json file
- Confirm user was created with this command:
\du
- Exit the prompt with
\q
Other helpful postgres command lines:
\l
- list databases
\c <database>
- connect to a database
\dt
- list tables in a connected database
\d <table>
- list columns on a table
##MongoDB
- run from a command shell to start the db
mongod
- some helpful mongo command lines:
mongo
- start the command shelluse fetcher
- to switch to our project db there is only one collection - moviesdb.movies.find()
- to see the content of the movies db
Use grunt to create a new database for your development and test environments:
Development environment: grunt pgcreatedb:default
Other environments, specify like so: NODE_ENV=test grunt pgcreatedb:default
Test environment: NODE_ENV=test grunt pgcreatedb:default
Production environment: NODE_ENV=production grunt pgcreatedb:default
In terminal, from the root directory:
To migrate to the latest version, run:
knex migrate:latest --env NODE_ENV
To rollback a version, run:
knex migrate:rollback --env NODE_ENV
To create a new migration after altering schema, run:
knex migrate:make [migration name]
Use a descriptive migration name.
To populate the database with seed data, run:
knex seed:run --env NODE_ENV
Note: --env NODE_ENV
may be omitted for development. For example, knex migrate:latest
will run all migrations in the development environment, while knex migrate:latest --env test
will migrate in the test environment.
Requirements: 5 Open Tabs
To run webpack build: yarn run build
To run server: yarn run start
To run your redis server for the session store redis-server
To run the search server: yarn run startm
To start the database: mongod
yarn run test
Start by creating a new app on Heroku
Heroku Postgres - populate the schema by following instructions for Import
https://devcenter.heroku.com/articles/heroku-postgres-import-export
step 1: create dump of local db copy: PGPASSWORD='theLostApp' pg_dump -Fc --no-acl --no-owner -h localhost -U raiders thesis_devel > thesis_devel.dump
step 2: You can use DropBox to host the saved dump
latest schema load:
https://www.dropbox.com/s/4e7l2zex29ka0qs/thesis_devel.dump?dl=0
also saved in thesis_devel.dump
step 3: import to the heroku postgres db: heroku pg:backups:restore 'https://www.dropbox.com/s/4e7l2zex29ka0qs/thesis_devel.dump?dl=0' DATABASE_URL --app <app name prod/staging>
step 4: to force the required SSL connection
heroku config:set PGSSLMODE=require --app <app_name>
step 5: to connect to query from you local command prompt:
heroku pg:psql --app <app_name>
Additional Example - to update a jsonb field
update profiles set follow_movies='["59b65fed39aea70343a063df","59b663c23931a704b088b5d0", "59b6561f4843acff45ed1663"]'::jsonb where id=1;
Heroku Redis - promote the redis store to the app
heroku redis:promote <redisStoreName> -a <appName>
(redisStoreName found on Heroku add-on page, looks like below)
heroku redis:promote redis-rigid-79334 -a raidersofthelostapp-movies
Create a user/password under the Users
section of the Addon Interface
To connect to query from your local command prompt:
mongo <mongoDbURL>
(mongoDbURL found on Heroku add-on page, looks like below)
mongo ds133814.mlab.com:33814/heroku_kbc22vfb -u <username> -p <password>
exit
mongodump --db fetcher
at regular (not mongo) command prompt to create a backup of the local DB schema
Various options for restoring the db under the Tools
section of the addon, we used the first one (use the properties for your addon but looks like below):
staging:
mongorestore -h ds135624.mlab.com:35624 -d heroku_9vff0tpt -u <username> -p <password> dump/fetcher/
production:
mongorestore -h ds133814.mlab.com:33814 -d heroku_kbc22vfb -u <username> -p <password> dump/fetcher/
Update Heroku Config variables for Facebook, Google, TMDB, OMDB, and Twilio
Your master will auto deploy so if you want to deploy from your branch, follow this command:
git push heroku <nameofbranch>:master
Start by connecting to your Github account
Build the pipeline for staging and update configs to match that environment for callback urls. Need to update Facebook to have multiple developer apps for each environment. Need to add new domains to the Google developers page.