Run Raft Locally
- Run Raft Locally
- Dependencies
- Run containers
- Building CSS
- Load demo data
- Running Raft
- Useful References
- Troubleshooting
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:
-
Ruby on Rails: https://guide.rubyonrails.org
-
Stimulus https://stimulus.hotwired.dev
-
Bootstrap Form is a form builder that uses Bootstrap. The calling options are similar but different than the vanilla form builder. https://github.com/bootstrap-ruby/bootstrap_form
-
Bootstrap 5: https://getbootstrap.com/docs/5.3
-
Bootstrap Icons: https://icons.getbootstrap.com
-
ViewComponents: https://viewcomponent.org/
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;