Skip to content

Working with Scriv

Out of the box, Scriv is set up to deploy to fly.io via the standard SaaS Pegasus setup. If you’d like to deploy to fly, you will first need to make the following changes to your fly.toml file:

  • (Recommended) Choose a new app name that’s unique to your project.
  • In the http_service.checks.headers, change the Host variable to the domain you are deploying to.

After that, you should be able to follow the standard Pegasus deployment instructions.

If you’d rather deploy Scriv somewhere else, you can use the Dockerfile.web in the repo as a foundation for any other docker-based platform. If you want to use a Pegasus-supported platform you can also generate the necessary files by creating a new project on Pegasus and copying them into your Scriv repository, or by connecting Scriv to a Pegasus project and then changing the deployment platform in your project settings. The latter option is only recommended if you plan on making other configuration changes, since the process of connecting a project is more work than just copying the files across.

The chat widget is a component that allows you to add a chat interface to your website. You can find the source code and more information in the components/scriv-chat directory of the repository.

To publish your own version of the chat widget, you can do the following:

  1. Customize the chat widget by modifying components/scriv-chat/src/components/scriv-chat/scriv-chat.tsx.
    1. Edit the SCRIV variable to match your own site.
    2. Modify the “Powered by” section at the bottom.
  2. Replace scriv-chat with your own package name in components/scriv-chat/package.json, and modify any other relevant variables.
  3. Publish the package, by getting set up on npmjs.com and then running npm publish.

Knowledge sources are indexed by a background task that runs via Celery. If your knowledge sources aren’t indexing, the most likely cause is that celery is not running correctly.

The first thing to check is whether Celery is running. If you’re using Docker, Celery should run automatically with the correct parameters as part of the docker compose setup.

If you’re not using Docker, you will have to run it manully, and specify the additional “background” queue argument:

celery -A scriv worker -l INFO --pool=solo -Q celery,background

If Celery is running properly, you should see logs whenever you add / rebuild a knowledge source. If the knowledge sources still aren’t being added, check the logs for any errors.

You can also manually trigger a knowledge source index by running the following command:

./manage.py build_index <index_id>

The index_id argument can be found in the Django admin, or in the URL when viewing the knowledge source.