Skip to content

Setup Instructions

Andrew Brown edited this page Sep 4, 2021 · 14 revisions

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)

Minimal setup

  1. 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.

  2. 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 install imagemagick libmagickwand-dev libpq-dev
  1. Clone the notebook repo and then cd into it.
git clone [email protected]:indentlabs/notebook.git
cd notebook
  1. Install the gems. This will also install Rails.
bundle install
  1. [Placeholder for manually installing/configuring Postgres once we've switched from SQLite in dev environments]

  2. 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
  1. You can now run the server with the following command:
bundle exec rails server

Full setup (work-in-progress)

All of the above, plus...

  1. 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
  1. 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.

  2. 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.

  1. To enable (redis), set up an accessible redis instance and set the REDIS_URL environment variable to its connection string.

  2. 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).

  1. 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
  1. 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
  1. 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 as stdout) in the environment variable NEW_RELIC_LOG.

  2. To enable database snapshots, recovery, and fallback,

  3. To enable Slack integration,

  4. 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
Clone this wiki locally