Skip to content

A learning management system (LMS) that lets you run an asynchronous online school, where learning is achieved through focused tasks, directed feedback, an iterative workflow, and community interaction.

License

Notifications You must be signed in to change notification settings

mmg-3/pupilfirst

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SV.CO

TeamCity Status for SVdotCO/sv.co codecov

Setup for development

Install Dependencies

OSX

  • Ruby - Use rbenv to install version specified in .ruby-version.
  • imagemagick - brew install imagemagick
  • postgresql - Install Postgres.app and follow instructions.
  • puma-dev - brew install puma/puma/puma-dev
  • redis - brew install redis

Ubuntu

  • Install Ruby with rbenv, as above.
  • Install dependencies:
sudo apt-get install imagemagick redis-server postgresql postgresql-contrib autoconf libtool

Fetch Gems

You need to install bundler before you install the required gems.

 $ gem install bundler

Install all Gems using bundler

$ bundle install

If installation of of pg gem crashes, asking for libpq-fe.h, install the gem with:

On OSX:

find /Applications -name pg_config
gem install pg -- --with-pg-config=/path/to/pg_config

On Ubuntu:

sudo apt-get install libpq-dev

Set a password for the default 'postgres' user

# Run psql command as postgres user.
sudo -u postgres psql postgres

# Set the password for this user.
\password postgres

# Quit.
\q

Configure

Copy example.env to .env.

$ cp example.env .env

Now, edit .env and set values for Database username and password that you used in the previous step.

Overcommit

$ overcommit --install
$ overcommit --sign

Setup Javascript Environment

  1. intsall NVM following instructions on the offical repository.
  2. Install Yarn following offical instructions.
  3. Intsall all node modules with yarn command.

Database setup

$ rails db:setup

This will also seed data useful for development. To view the admin interface, (once you've started the server), visit the sign in page, and use the development option to sign in as [email protected].

Use puma-dev to run the application.

When installing puma-dev, make sure that you set it up to listen on the .localhost domain, and not the default .dev domain.

After installing puma-dev using its instructions:

cd ~/.puma-dev
ln -s ~/path/to/sv_repository sv

It's useful to have puma-dev's log file in easy reach:

OSX Specific: ln -s ~/Library/Logs/puma-dev.log log/

To restart the server:

touch tmp/restart.txt

If it crashes, gets stuck, etc., kill the master process.

ps -ef | grep puma
kill -9 [PUMA_PROCESS_ID]

puma-dev on Ubuntu

Running puma-dev on Ubuntu will require that you download the puma-dev binary, and run it manually. There are other setup requirements detailed in the official docs (linked above.)

Use the following command to run puma-dev with correct configuration for dev environment.

puma-dev -d localhost -http-port 80 -https-port 443

You'll probably want to convert this to an alias to make starting the server simple.

Troubleshooting puma-dev

If puma-dev crashes when starting the application with bundle: not found in the logs, create a .powenv file in the root of the repository and add commands to load the rbenv environment.

Optional extra

Install Heroku CLI

Follow official instructions install the CLI.

Login with your 'Heroku' credentials and follow the instrutions recived on the onbarding Email.

Load environment key for Rollbar from Heroku with:

heroku config -s --app sv-co | grep ROLLBAR_ACCESS_TOKEN >> .env

Testing

You might need to create the test database that you've configured with environment variables.

To execute all tests manually, run:

$ rspec

Generating coverage report

To generate spec coverage report, run:

COVERAGE=true rspec

This will generate a simplecov HTML coverage report within /coverage

Note: Code coverage is automatically generated by the CI server, and monitored using Codecov.

Services

Background jobs are written as Rails ActiveJob-s, and deferred using Delayed::Job in the production environment.

By default, the development and test environment run jobs in-line. If you've manually configured the application to defer them instead, you can execute the jobs with:

$ rake jobs:workoff

Deployment

TeamCity runs specs once commit are pushed to Github. When push is to the master branch, and if specs pass, TeamCity marks the commit as successful on Github. This prompts Heroku to pick up the commit and deploy a new instance - so the entire process is automated.

We use two buildpacks at Heroku:

  1. Heroku's default ruby buildpack: https://github.com/heroku/heroku-buildpack-ruby
  2. Custom rake tasks (to run DB migrations): https://github.com/gunpowderlabs/buildpack-ruby-rake-deploy-tasks

Manual deployment

Set up Heroku to have access to sv-co app.

Add heroku remote:

$ git remote add heroku [email protected]:sv-co.git

Then, to deploy:

  • From master branch, git push heroku will push local master to production (sv.co)

To safely deploy:

$ rspec && git push heroku && heroku run rake db:migrate --app sv-co && heroku restart --app sv-co

Coding style conventions

Basic coding conventions are defined in the .editorconfig file. Download plugin for your editor of choice. http://editorconfig.org/

General

  • One blank line between discrete blocks of code.
  • No more than one blank line between blocks / segments of code.

Ruby

  • Naming: Underscored variables and methods. CamelCase class names - some_variable, some_method, SomeClass

Javascript

  • Use Coffeescript wherever possible.
  • Naming: CamelCase variables and function - someVariable, someFunction

CSS

  • Use SCSS everywhere.
  • Use BEM for naming classes - block__element, or block__element--modifier

About

A learning management system (LMS) that lets you run an asynchronous online school, where learning is achieved through focused tasks, directed feedback, an iterative workflow, and community interaction.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 48.4%
  • ReScript 40.2%
  • HTML 6.1%
  • CSS 2.9%
  • JavaScript 1.1%
  • SCSS 0.9%
  • Other 0.4%