Skip to content

thelabtw/lab-assistant

 
 

Repository files navigation

Lab Assistant

Build Status

Dev setup

  1. Install vagrant

  2. Install ansible

  3. Clone the project

     git clone https://github.com/thelabtw/lab-assistant.git
    
  4. Start the vagrant vm

     vagrant up && vagrant provision
    
  5. Log onto the vm

     vagrant ssh
    
  6. Find the project files

     cd /vagrant
    
  7. Install dependencies

     npm install
    
  8. Email configuration [Optional]

     1. Run `which sendmail` in a terminal
     2. Add EMAIL_SERVER="Path to sendmail" to environment vars
     3. Turn on the toggle `email.sendEmails` in each specific environment (config/default.json, config/staging.json, config/production.json)
    
  9. Run the tests

     npm test
    
  10. Run the acceptance tests

     1. First set up a admin email and admin password:
             export ACCEPTANCE_EMAIL=some email here
             export ACCEPTANCE_PASSWORD=some password here
     2. Start the server:
             npm start
     3. Then run:
             npm run acceptanceTests
    
  11. Start the server

     npm start
    
  12. Re-bundling the UI

    The frontend code must be re-bundled whenever it changes; npm start serves the last bundled version of the UI. We have a postinstall task that bundles any time npm install is run (i.e. on deployment).

    When developing, the easiest way to keep the front-end up to date is to run the following command in a separate shell, which will watch the code and re-bundle on changes. This can be run outside of the Vagrant VM, if you have npm installed on your host machine.

     npm run bundle
    

Tests

  1. Run server side tests

     npm run serverTests
    
  2. Run client side tests

     npm run componentTests
    
  3. Run a specific server side test

     NODE_ENV=test node --harmony node_modules/jasmine/bin/jasmine.js spec/integration/membersSpec.js
    
  4. Run smoke tests against an external target

     NODE_ENV=test INSTANCE_URL=http://myinstance.mydomain.com node --harmony node_modules/jasmine/bin/jasmine.js spec/integration
    

Utility scripts

  1. Migrate the database (run automatically as part and npm start or npm test)

     ./node_modules/sequelize-cli/bin/sequelize db:migrate
    
  2. Create a new migration

     ./node_modules/sequelize-cli/bin/sequelize migration:create --config config/db.json --name <migration_name>
    
  3. Create an admin user to access the organiser views

     npm run createAdmin
    

Pull a copy of the staging db from heroku

  1. heroku pg:backups capture --app <app_name>

  2. curl -o db/dumps/latest.dump heroku pg:backups public-url

  3. (in the vm) pg_restore --verbose --clean --no-acl --no-owner -h localhost -U lab-assistant -d lab-assistant db/dumps/latest.dump

Happy hacking!

Optional setup

JShint

  1. Install plugin

WebStorm

  1. Install webstorm

  2. Open preferences -> Languages and frameworks

  3. Change javascript to ECMAScript 6

  4. Setup run configuration to node and "javascript/file" to be bin/www

  5. Optionally install vagrant plugin

About

Groups and sessions organiser

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 91.3%
  • CSS 7.7%
  • Other 1.0%