-
-
Notifications
You must be signed in to change notification settings - Fork 76
Setup Instructions
Notebook.ai is a complex platform that's built to be somewhat modular, allowing you to set up just the features you want to use. For these setup instructions, I'll break down the setup into two separate paths:
- Minimal setup (no third-party integrations, just Notebook.ai running locally)
- Full setup (all integrations and configuration to match https://www.notebook.ai)
-
Make sure you have Ruby installed. Make sure your Ruby version matches the version specified in
.ruby-version
.Tip: Using a Ruby version manager like RVM makes it easy to install, manage, and flip between specific Ruby versions.
-
Install the necessary native libraries for your system. These are the libraries I use on Ubuntu; you may use a different package manager or have different package names on other systems.
sudo apt-get update
sudo apt-get install imagemagick libmagickwand-dev libpq-dev libsqlite3-dev nodejs npm
- Clone the
notebook
repo and thencd
into it.
git clone git@github.com:indentlabs/notebook.git
cd notebook
- Install the required gems. This will also install Rails.
bundle install
-
By default, Notebook.ai uses SQLite for development environments and Postgresql for production environments. If you wish to use a different database for your desired environment, this is the step where you would install it. You can configure the app to use it in config/database.yml.
-
Create and prepare your database
rake db:create
rake db:migrate
rake billing_plans:initialize_defaults
rake data_migrations:create_default_billing_plans
rake db:seed
- Build and prepare Javascript assets with
yarn
. Thewebpack-dev-server
will continue to run and automatically recompile your assets as you change them.
yarn install
./bin/webpack-dev-server
Tip: If you run into any issues with yarn
, make sure you have the latest nodejs
and npm
installed. This SO answer also helps me with permission issues on an OOTB install on Ubuntu.
- You also want to make sure you're running a redis server, so Notebook.ai can queue and complete tasks in the background.
sudo apt-get install redis
- You can now run the server with the following command (in another terminal, if you leave
webpack-dev-server
running):
bundle exec rails server
All of the above, plus...
- Set the following environment variables
RAILS_ENV=production
RACK_ENV=production
RAILS_SERVE_STATIC_FILES=enabled
- Precompile your assets
bundle exec rake assets:precompile
- To enable background jobs (saving document revisions, linking content together, etc), you'll want to install and make sure you're running sidekiq. This will process all queues by default. You can also see a list of all queues in
config/sidekiq.yml
and run specific ones with the-q <queue_name>
flag.
bundle exec sidekiq -C config/sidekiq.yml
-
To enable document analysis, you'll need an IBM Watson account with billing set up. Add your IBM API key to the environment variable
WATSON_API_KEY
. Billing will scale based on the number of document words analyzed. You will also need sidekiq running for analysis jobs to process. -
To enable image uploads, you'll need an AWS account with S3 set up and configured for read/write access to a bucket. Provide your credentials via the following environment variables:
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: your-access-key-id-here
AWS_SECRET_ACCESS_KEY: your-secret-access-key-here
S3_BUCKET_NAME: your-bucket-name-here
You can specify alternative storage providers in config/storage.yml
, but they may need some extra configuration to work as expected.
-
To configure redis, set up an accessible redis instance and set the
REDIS_URL
environment variable to its connection string. -
To enable email sending (password resets, collaboration invites, etc), you'll want to set up a billable SendGrid account and provide authentication information through the following environment variables:
SENDGRID_DOMAIN: your-sendgrid-domain
SENDGRID_USERNAME: your-sendgrid-username
SENDGRID_PASSWORD: your-sendgrid-password
You'll need to specify your authorized SendGrid senders in config/initializers/devise.rb
(for password resets) and each of the mailers in app/mailers
(for functional emails).
- To enable Paypal payments, you'll want to provide your Paypal API credentials in the following environment variables:
PAYPAL_CLIENT_ID: your-paypal-client-id
PAYPAL_SECRET: your-paypal-secret-key
- To enable Stripe payments, you'll want to provide your live Stripe API credentials in the following environment variables:
STRIPE_API_KEY: your-stripe-secret-key
STRIPE_PUBLISHABLE_KEY: your-stripe-public-key
-
To enable New Relic & error reporting, provide your license key in the
NEW_RELIC_LICENSE_KEY
environment variable. You can optionally specify a log destination (such asstdout
) in the environment variableNEW_RELIC_LOG
. -
To enable database snapshots, recovery, and fallback,
-
To enable Slack integration,
-
To scale, I use the following architecture (set as ENV variables):
WEB_CONCURRENCY=2
RAILS_MAX_THREADS=16
MALLOC_ARENA_MAX=2
DB_POOL=25
RUBY_GC_HEAP_GROWTH_FACTOR=1.03