/bothub-engine

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

BLACK LIVES MATTER

BLACK LIVES MATTER

Black Lives Matter · Supporting the cause ·


Bothub

Bothub

Build Status Coverage Status Code Climate Python Version License GPL-3.0

Development

Use make commands to check_environment, install_requirements, lint, test, migrate, start, migrations and collectstatic.

Command Description
make help Show make commands help
make check_environment Check if all dependencies was installed
make install_requirements Install pip dependencies
make lint Show lint warnings and errors
make test Run unit tests and show coverage report
make migrate Update DB shema, apply migrations
make start Start development web server
make start_celery Start celery service
make migrations Create DB migrations files
make collectstatic Collects the static files into STATIC_ROOT

Fill database using fake data

Run pipenv run python ./manage.py fill_db_using_fake_data to fill database using fake data. This can help you to test Bothub Webapp.

Migrate all training for aws

Run pipenv run python ./manage.py transfer_train_aws Migrate all trainings to an aws bucket defined in project settings.

Enable all repository to train

Run pipenv run python ./manage.py enable_all_train

Start Train in all repositories

Run pipenv run python ./manage.py start_all_repository_train

Fake users infos:

nickname email password is superuser
admin admin@bothub.it admin yes
user user@bothub.it user no

Production

Docker images available in Bothub's Docker Hub repository.

Deployment

Heroku

Host your own Bothub Engine with [One-Click Deploy] (https://heroku.com/deploy).

Deploy

Environment Variables

You can set environment variables in your OS, write on .env file or pass via Docker config.

Variable Type Default Description
SECRET_KEY string None A secret key for a particular Django installation. This is used to provide cryptographic signing, and should be set to a unique, unpredictable value.
DEBUG boolean False A boolean that turns on/off debug mode.
BASE_URL string http://api.bothub.it URL Base Bothub Engine Backend.
ALLOWED_HOSTS string * A list of strings representing the host/domain names that this Django site can serve.
DEFAULT_DATABASE string sqlite:///db.sqlite3 Read dj-database-url to configure the database connection.
LANGUAGE_CODE string en-us A string representing the language code for this installation.This should be in standard language ID format.
TIME_ZONE string UTC A string representing the time zone for this installation. See the list of time zones.
STATIC_URL string /static/ URL to use when referring to static files located in STATIC_ROOT.
EMAIL_HOST string None The host to use for sending email. When setted to None or empty string, the EMAIL_BACKEND setting is setted to django.core.mail.backends.console.EmailBackend
EMAIL_PORT int 25 Port to use for the SMTP server defined in EMAIL_HOST.
DEFAULT_FROM_EMAIL string webmaster@localhost Default email address to use for various automated correspondence from the site manager(s).
SERVER_EMAIL string root@localhost The email address that error messages come from, such as those sent to ADMINS and MANAGERS.
EMAIL_HOST_USER string '' Username to use for the SMTP server defined in EMAIL_HOST.
EMAIL_HOST_PASSWORD string '' Password to use for the SMTP server defined in EMAIL_HOST.
EMAIL_USE_SSL boolean False Whether to use an implicit TLS (secure) connection when talking to the SMTP server.
EMAIL_USE_TLS boolean False Whether to use a TLS (secure) connection when talking to the SMTP server.
ADMINS string '' A list of all the people who get code error notifications. Follow the pattern: admin1@email.com|Admin 1,admin2@email.com|Admin 2
CSRF_COOKIE_DOMAIN string None The domain to be used when setting the CSRF cookie.
CSRF_COOKIE_SECURE boolean False Whether to use a secure cookie for the CSRF cookie.
BOTHUB_WEBAPP_BASE_URL string http://localhost:8080/ The bothub-webapp production application URL. Used to refer and redirect user correctly.
SUPPORTED_LANGUAGES string ```en pt```
BOTHUB_NLP_BASE_URL string http://localhost:2657/ The bothub-blp production application URL. Used to proxy requests.
CHECK_ACCESSIBLE_API_URL string http://localhost/api/repositories/ URL used by bothub.health.check.check_accessible_api to make a HTTP request. The response status code must be 200.
SEND_EMAILS boolean True Send emails flag.
BOTHUB_ENGINE_AWS_S3_BUCKET_NAME string None Specify the bucket name to send to s3
BOTHUB_ENGINE_AWS_ACCESS_KEY_ID string None Specify the access key to send to s3
BOTHUB_ENGINE_AWS_SECRET_ACCESS_KEY string None Specify the secret access key to send to s3
BOTHUB_ENGINE_AWS_REGION_NAME string None Specify the region to send to s3
BOTHUB_ENGINE_AWS_ENDPOINT_URL string None Specify the endpoint to send to s3, if sending to amazon s3, there is no need to specify a value
BOTHUB_ENGINE_AWS_SEND bool False Authorize sending to s3
BOTHUB_BOT_EMAIL string bot_repository@bothub.it Email that the system will automatically create for existing repositories that the owner deleted the account
BOTHUB_BOT_NAME string Bot Repository Name that the system will use to create the account
BOTHUB_BOT_NICKNAME string bot_repository Nickname that the system will use to create the account
BOTHUB_ENGINE_USE_SENTRY bool False Enable Support Sentry
BOTHUB_ENGINE_SENTRY string None URL Sentry
BOTHUB_NLP_RASA_VERSION string 1.4.3 Specify the version of rasa used in the nlp worker
TOKEN_SEARCH_REPOSITORIES string None Specify the token to be used in the search_repositories_examples route, if not specified, the route is available without authentication
GOOGLE_API_TRANSLATION_KEY string None Specify the Google Translation API passkey, used in machine translation
ENVIRONMENT string production Specify the environment you are going to run, it is also used for sentry

Roadmap

See the open issues for a list of proposed features (and known issues).

License

Distributed under the GPL-3.0 License. See LICENSE for more information.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request