Next Generation Wikimum!
This application is under active development and should not be used in production yet.
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
.
Make sure PostgreSQL is running
postgres
dotenv bin/download_database_backup
createdb prod-wikimum
psql postgres://localhost/prod-wikimum < starkast_wiki_backup_2024-06-15_215012.sql
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 -e default.env
Go to http://wikimum.127.0.0.1.nip.io:8080 (the GitHub app for development is configured with this address).
# 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
overman run bundle exec racksh
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
TODO
Fly.io app wikimum-preview
exist to test changes before production. It can be reached at https://wikimum-preview.fly.dev/
The first deploy was manual:
flyctl deploy --ha=false --build-arg "RUBY_VERSION=$(cat .ruby-version)" --app=wikimum-preview
The preview app uses a PostgreSQL database from Aiven, deployed in AWS eu-north-1.
These are the secrets configured:
fly secrets set --detach --app wikimum-preview DATABASE_URL="$(pbpaste)"
fly secrets set --detach --app wikimum-preview SESSION_SECRET="$(pbpaste)"
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.
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.
MIT License, see LICENSE.