Skip to content

Starkast/wikimum

Repository files navigation

Wikimum

GitHub Build Status Code Climate

Next Generation Wikimum!

This application is under active development and should not be used in production yet.

Development

These instructions assume you are using OS X.

Install prerequisites

brew install postgresql
gem install overman
bundle install

Ruby gems are vendored into vendor/cache, you should always check in the gems when changing gems. The caching is set up with bundle package --all.

Database setup

Make sure PostgreSQL is running

postgres

Start the app

In production, the script bin/start is used, but we avoid using that in the Procfile because the integration tests reads that command and needs to get the PID of Puma, not the script, in order to cleanly shutdown Puma.

overman start

Go to http://wikimum.127.0.0.1.nip.io:8080 (the GitHub app for development is configured with this address).

Environment variables

# Development and production
DATABASE_URL=postgres://
GITHUB_BASIC_CLIENT_ID=
GITHUB_BASIC_SECRET_ID=
BACKUP_USER=
BACKUP_PASSWORD=
PGGSSENCMODE=disable # https://github.com/ged/ruby-pg/issues/311#issuecomment-1609970533
SESSION_SECRET= # generate with: ruby -rsecurerandom -e 'p SecureRandom.hex(32)'
# Production
SENTRY_DSN=
# Development
REDIRECT_TO_HTTPS=1 # redirect http:// to https://
# Tests
DEBUG=1 # enable debug output from tests that have it
# Set app in maintenance mode
MAINTENANCE_MODE=true

Console

overman run bundle exec racksh

Tests

bundle exec rake

Run single test with m:

bundle exec m test/integration/app_boot_test.rb:29

To migrate to the latest version, run:

bin/dev_db_bootstrap

This Rake task takes an optional argument specifying the target version. To migrate to version 42, run:

bundle exec rake db:migrate[42]

Manually:

sequel -E -m migrations -M <n> postgres://localhost/wikimum

Code Scanning

GitHub Actions scan the code using Brakeman.

If you need to ignore a weakness reported, update config/brakeman.ignore. You can get the JSON needed by running Brakeman like this:

docker run -it --rm -v $(pwd):/app -w /app ruby:$(cat .ruby-version) bash
gem install brakeman
brakeman --force --format json .

Don't forget to add a note attribute to the JSON object when ignoring.

History

This wiki software was originally developed by Johan Eckerström at IMUM HB back in 2005. When we killed the company the software was kept running at Starkast but not much work was done on it. Originally a Rails (1.x) app, it's now a Sinatra based application.

License

MIT License, see LICENSE.