Raft Demo / Documentation

Run Raft Locally

  1. Run Raft Locally
  2. Dependencies
  3. Run containers
  4. Building CSS
  5. Load demo data
  6. Running Raft
  7. Useful References
  8. Troubleshooting
    1. Postgres in Docker

This tutorial is for running Raft on your local computer in development mode.

Dependencies

Required dependencies:

  • ruby 3.x – installing of ruby is outside the scope of this file. It is recommended that you use on of these version management tools unless deploying to production:
    • https://github.com/rbenv/rbenv
    • https://github.com/postmodern/chruby
    • https://github.com/asdf-vm/asdf
  • libpq-dev – allows postgres gem ‘pg’ to compile.

Optional dependencies:

  • mupdf – generate previews of PDF files.
  • libvips – generate previews of image files.
  • libreoffice – generate previews of office documents.
  • postgresql-client – needed to run rails dbconsole
sudo apt install libpq-dev mupdf libvips libreoffice
cd raft
bundle

Run containers

There are a bunch of helper containers that are needed by Raft. To launch them for development:

docker compose -f container/development/compose.yml up

Building CSS

To update the CSS when any source SCSS files changes:

bin/rails dartsass:watch

Load demo data

Although not required, when developing locally it can be useful to start with the data used for the demo. To load this data:

bin/rails db:seed

Running Raft

You can run rails s for most things, but if you want the onlyoffice editors to
work, you need to bind the server to all IPs:

bin/rails server -b 0.0.0.0

Useful References

Raft makes heavy use of the following frameworks and libraries:

Troubleshooting

Postgres in Docker

Test if the postgres connection is working:

bin/rails runner 'p ActiveRecord::Base.connection'

dump the schema:

docker exec CONTAINER pg_dump --schema-only --no-privileges --no-owner -U raft raft

rails dbconsole commands for postgres:

  \dt -- list tables
  \dx -- list extensions
  \du -- list roles
  \c NAME -- connect to database
  \l  -- list databases
  CREATE EXTENSION IF NOT EXISTS pg_trgm;