A Serious Bot for A Serious Business, Inc..
script/bootstrap
- Setup dependencies (see below for details)script/build
- Build everythingscript/run
- Run the .net skill runner and watch for changesscript/server
- Run the website and watch for changesscript/watch
- Run the website and the dotnet skill runner and watch for changes
Interested in using Codespaces? Check out our Codespaces docs
Also check out the development environments docs
To add a migration, run ./script/ef-migrations-add {MigrationName}
(Replacing {MigrationName}
with the descriptive name of your migration) from anywhere in the repository.
Versions are automatically generated based on a fixed Major.Minor
part, plus the commit height since the last time the version got bumped, and an optional prerelease prefix. This is done by the Nerdbank.Gitversioning package that is automatically included as part of the build process via the root Directory.Build.props file.
The fixed part and suffix are configured in version.json files, one for each area that we want to track versions separately:
src/product
: Edit the version.json file at the root of the repo. This is the version reported in our UI.src/scripting
: Edit the src/scripting/version.json file.src/functions
: Edit the src/functions/version.json file.src/libraries
: Edit the src/libraries/version.json file.
To bump the major or minor parts of a project, edit the corresponding version.json file, then commit the change. The version bump will only be seen in a build after files have been commited.
Not all edited files will trigger a version bump. The list of files that are excluded from triggering a version bump are in version.json files as well:
src/product
: src/product/version.json file.src/scripting
: src/scripting/version.json file.src/functions
: src/functions/version.json file.src/libraries
: src/libraries/version.json file.
Nerdbank.Gitversioning doesn't currently support wildcards in path filters, and path filters need to be in a version.json at the level that controls a version bump (i.e. if we want multiple projects to all be bumped together if one of them has changes, then a version.json file needs to exist in a parent folder, and all the exclusions need to be at that level as well). If you want to exclude a file or folder from triggering a version bump, add it to the corresponding version.json file. The exclusion syntax is :!path/to/exclude
.
Abbot consists of a series of Azure Functions and Web Applications. Some are hosted in other repositories.
Abbot.Web
Abbot.Functions.DotNet
READMEabbot-skills-javascript
READMEabbot-skills-python
READMEAbbot.Functions.KeepAlive
README
All of these sites are continuously deployed when commits are pushed or merged into the main
branch.
The script/bootstrap
will set up the following for you:
- Docker Desktop NOTE: Do not install this from
brew
orscoop
. - .NET 6.0.100
- Azure Functions Core Tools
- Azure CLI
- nodenv + node (16.x, whatever is set in .node-version)
- Postgres + pgadmin on Docker
- ngrok on Docker
You will also need access to our Azure Portal (log in with your @aseriousbusiness.com
Microsoft account).
Before anything else, you'll need to set up an ngrok account and redirection.
- Log in to ngrok.com with your Google
@aseriousbusiness.com
account. This should give you a Pro account. - Copy Your Authtoken to use with
script/bootstrap
.
To test billing, you'll need to set up a local listener for Stripe webhooks.
- Install the Stripe CLI -
brew install stripe/stripe-cli/stripe
- Login to Stripe -
stripe login
(use your @aseriousbusiness.com account)
And then every time you run the site locally to test billing, run:
stripe listen --forward-to https://localhost:4979/billing-webhook
This will return a Webhook secret which needs to be set in User Secrets:
script/user-secrets set Stripe:WebhookSecret whsec_{REDACTED}
Alternatively, since we use ngrok, you can go to https://dashboard.stripe.com/test/webhooks to set up a persistent webhook pointing at your ngrok URL. For example, it'll be something like:
https://abbot-{USERNAME}-dev.ngrok.io/billing-webhook
You'll need to reveal the webhook secret and run the command to set Stripe:WebhookSecret
to it in User Secrets.
Note: If you don't want to build and run everything locally, you can use Docker to host most things.
Note: You can't run skill runners in Docker in M1 Macs.
- The
script/bootstrap
script should have installed Docker for you. Install Docker Desktop from the website if you don't have it. (brew
andscoop
can't be trusted for this yet.) - After cloning the repository, run
script/bootstrap
from the root to set up prerequisites and run them in docker. - Run the skill runners in Docker if you don't need to work on them locally:
- Run
script/docker-run-dev -dotnet -l -p
for the dotnet skill runner. - Run
script/docker-run-dev -python -l -p
for the python skill runner. - Run
script/docker-run-dev -js -l -p
for the js skill runner.
- Run
- Run
script/build
to build all the projects. - Run
script/server
to run the website (it will rebuild if you change)
Once the website is up and running, if you're running any skill runners in Docker, go to https://localhost:4979/admin/runners
to configure the endpoints:
-
.NET Endpoint
- Url:
http://localhost:7071/api/SkillRunnerSecured
- Token:
skillkey
- Url:
-
Python Endpoint:
- Url:
http://localhost:7072/api/SkillRunner
- Token:
skillkey
- Url:
-
JS Endpoint:
- Url:
http://localhost:7073/api/SkillRunner
- Token:
skillkey
- Url:
After cloning the repository, run script/bootstrap
from the root to set up prerequisites.
Run script/build
to run the website and the proxy project.
Afterwards run script/watch
to run all sites for end-to-end testing
If you just need to work on the website, you can run script/server
instead.
Hangfire.io creates a Hangfire schema in the db. It seems we run into issues where there's not the correct permissions. Here's what I've run to fix it:
GRANT ALL ON SCHEMA hangfire TO abbotuser
GRANT ALL ON ALL TABLES IN SCHEMA hangfire TO abbotuser
GRANT ALL ON ALL SEQUENCES IN SCHEMA hangfire TO abbotuser
GRANT ALL ON ALL FUNCTIONS IN SCHEMA hangfire TO abbotuser
Abbot is broken into several libraries.
Abbot.Common
READMEAbbot.Scripting.Interfaces
READMEAbbot.Web.Library
Serious.Library
- A serious set of useful codeSerious.Razor
README [*Serious.Slack.Messages
Types that represent Slack messages as well as a Refit based Slack API client. This can be shared between Abbot.Functions and Abbot.Web. ]()
Find developer documentation in the docs/
folder.
We try to keep our issue tracker clean. If there's an issue we don't think we'll get to any time soon, but think is worth keeping around, we label it with the backlog
label and close it.
To map emoji names to the unicode character for the emoji, we use this huge JSON file with all the emoji mappings.
However, with the power of PowerShell, we strip it down to just what we need (thanks @dahlbyk!)
$json = Get-Content .\emoji-names.json | ConvertFrom-Json
$json | Select-Object name,unified,short_name,short_names | ConvertTo-Json -Compress | Out-File -Encoding ascii ./emoji-names.json