Working with Scriv
Deployment
Section titled “Deployment”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
appname that’s unique to your project. - In the
http_service.checks.headers, change theHostvariable to the domain you are deploying to.
After that, you should be able to follow the standard Pegasus deployment instructions.
Deploying to a different platform
Section titled “Deploying to a different platform”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
Section titled “The Chat Widget”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.
Publishing your own Chat Widget Package
Section titled “Publishing your own Chat Widget Package”To publish your own version of the chat widget, you can do the following:
- Customize the chat widget by modifying
components/scriv-chat/src/components/scriv-chat/scriv-chat.tsx.- Edit the
SCRIVvariable to match your own site. - Modify the “Powered by” section at the bottom.
- Edit the
- Replace
scriv-chatwith your own package name incomponents/scriv-chat/package.json, and modify any other relevant variables. - Publish the package, by getting set up on npmjs.com and then running
npm publish.
Troubleshooting
Section titled “Troubleshooting”Knowledge sources not indexing
Section titled “Knowledge sources not indexing”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,backgroundIf 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.