diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e53708f..5aabf63 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -82,5 +82,5 @@ jobs: cd /home/***/hexabot git checkout release git pull origin release - make stop NLU=1 - make start NLU=1 + npx hexabot stop --enable=nlu + npx hexabot start --enable=nlu diff --git a/Makefile b/Makefile deleted file mode 100644 index 08753f3..0000000 --- a/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -# Makefile -FOLDER := ./docker - -# The services that can be toggled -SERVICES := nginx nlu smtp4dev - -# Function to dynamically add Docker Compose files based on enabled services -define compose_files - $(foreach service,$(SERVICES),$(if $($(shell echo $(service) | tr a-z A-Z)), -f $(FOLDER)/docker-compose.$(service).yml)) -endef - -# Function to dynamically add Docker Compose dev files based on enabled services and file existence -define compose_dev_files - $(foreach service,$(SERVICES), \ - $(if $($(shell echo $(service) | tr a-z A-Z)), \ - $(if $(shell [ -f $(FOLDER)/docker-compose.$(service).dev.yml ] && echo yes), -f $(FOLDER)/docker-compose.$(service).dev.yml))) -endef - -# Function to dynamically add Docker Compose dev files based on enabled services and file existence -define compose_prod_files - $(foreach service,$(SERVICES), \ - $(if $($(shell echo $(service) | tr a-z A-Z)), \ - $(if $(shell [ -f $(FOLDER)/docker-compose.$(service).prod.yml ] && echo yes), -f $(FOLDER)/docker-compose.$(service).dev.yml))) -endef - -# Ensure .env file exists and matches .env.example -check-env: - @if [ ! -f "$(FOLDER)/.env" ]; then \ - echo "Error: .env file does not exist. Creating one now from .env.example ..."; \ - cp $(FOLDER)/.env.example $(FOLDER)/.env; \ - fi - @echo "Checking .env file for missing variables..." - @awk -F '=' 'NR==FNR {a[$$1]; next} !($$1 in a) {print "Missing env var: " $$1}' $(FOLDER)/.env $(FOLDER)/.env.example - -init: - cp $(FOLDER)/.env.example $(FOLDER)/.env - -# Start command: runs docker-compose with the main file and any additional service files -start: check-env - @docker compose -f $(FOLDER)/docker-compose.yml $(call compose_files) up -d - -# Dev command: runs docker-compose with the main file, dev file, and any additional service dev files (if they exist) -dev: check-env - @docker compose -f $(FOLDER)/docker-compose.yml -f $(FOLDER)/docker-compose.dev.yml $(call compose_files) $(call compose_dev_files) up --build -d - -# Start command: runs docker-compose with the main file and any additional service files -start-prod: check-env - @docker compose -f $(FOLDER)/docker-compose.yml -f $(FOLDER)/docker-compose.prod.yml $(call compose_files) $(call compose_prod_files) up -d - -# Stop command: stops the running containers -stop: - @docker compose -f $(FOLDER)/docker-compose.yml -f $(FOLDER)/docker-compose.dev.yml $(call compose_files) $(call compose_dev_files) $(call compose_prod_files) down - -# Destroy command: stops the running containers and removes the volumes -destroy: - @docker compose -f $(FOLDER)/docker-compose.yml -f $(FOLDER)/docker-compose.dev.yml $(call compose_files) $(call compose_dev_files) $(call compose_prod_files) down -v - -# Migrate command: -migrate-up: - @docker compose -f $(FOLDER)/docker-compose.yml -f $(FOLDER)/docker-compose.dev.yml $(call compose_files) $(call compose_dev_files) up --no-deps -d database-init diff --git a/README.md b/README.md index b3be0b0..f1227e4 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,10 @@ ## Description -[Hexabot](https://hexabot.ai/) Community Edition is an open-source chatbot solution that allows users to create and manage AI-powered, multi-channel, and multilingual chatbots with ease. Hexabot is designed for flexibility and customization, offering powerful text-to-action capabilities. Originally a closed-source project (version 1), we've now open-sourced version 2 to contribute to the community and enable developers to customize and extend the platform with extensions. +[Hexabot](https://hexabot.ai/) is an open-source chatbot solution that allows users to create and manage AI-powered, multi-channel, and multilingual chatbots with ease. Hexabot is designed for flexibility and customization, offering powerful text-to-action capabilities. Originally a closed-source project (version 1), we've now open-sourced version 2 to contribute to the community and enable developers to customize and extend the platform with extensions. + +Hexabot - Create exceptional chatbot experiences. 100% Open Source. | Product Hunt ## Features - **Analytics Dashboard:** Monitor chatbot interactions and performance with insightful metrics and visualizations. @@ -43,24 +45,36 @@ To ensure Hexabot runs smoothly, you'll need the following: $ git clone https://github.com/hexastack/hexabot.git ``` -2. **Environment Setup:** To configure the environment variables, use the Makefile at the root folder for initialization: +2. **Install:** ```bash -$ make init +$ npm install +``` + +3. **Environment Setup:** To configure the environment variables, use the following command at the root folder for initialization: + +```bash +$ npx hexabot init ``` This will copy the `.env.example` file to `.env` in the `./docker` directory if the file does not already exist. -3. **Running the Application:** Once your environment is set up, you can start the app. Use either of the following commands: +4. **Running the Application:** Once your environment is set up, you can start the app. Use either of the following commands: ```bash -$ make start +$ npx hexabot start ``` or for development mode: ```bash -$ make dev +$ npx hexabot dev +``` + +You can also enable services such as the NLU engine or Nginx : + +```bash +$ npx hexabot --enable=nlu ``` **Note:** The first time you run the app, Docker will take some time to download all the required images. @@ -76,17 +90,16 @@ Live Chat Widget is accessible via http://localhost:5173 ## Commands -- `make init` : Copies the .env.example file to .env in the ./docker directory if .env does not exist. This is usually used for initial setup. -- `make dev` : Starts all configured Docker services in development mode. It first checks the .env file for completeness against .env.example and builds the docker images locally. -- `make start` : Starts all configured Docker services by loading all images from Docker Hub. This target also checks the .env file for required variables. -- `make stop` : Stops all running Docker services defined in the compose files. -- `make destroy` : Stops all services and removes all volumes associated with the Docker compose setup, ensuring a clean state. -- `make check-env` : Checks if the ./docker/.env file exists and contains all the necessary environment variables as defined in ./docker/.env.example. If the file does not exist, it is created from the example. It also lists missing variables if any. +- `npx hexabot init` : Copies the .env.example file to .env in the ./docker directory if .env does not exist. This is usually used for initial setup. +- `npx hexabot dev` : Starts all configured Docker services in development mode. It first checks the .env file for completeness against .env.example and builds the docker images locally. +- `npx hexabot start` : Starts all configured Docker services by loading all images from Docker Hub. This target also checks the .env file for required variables. +- `npx hexabot stop` : Stops all running Docker services defined in the compose files. +- `npx hexabot destroy` : Stops all services and removes all volumes associated with the Docker compose setup, ensuring a clean state. Example on how to start the stack by adding the Nginx service : ```sh -make start NGINX=1 +npx hexabot start --enable=nginx ``` ## Documentation @@ -105,6 +118,8 @@ You can also find specific documentation for different components of the project We welcome contributions from the community! Whether you want to report a bug, suggest new features, or submit a pull request, your input is valuable to us. Please refer to our contribution policy first : [How to contribute to Hexabot](./CONTRIBUTING.md) + + [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](./CODE_OF_CONDUCT.md) Feel free to join us on [Discord](https://discord.gg/rNb9t2MFkG) diff --git a/api/.dockerignore b/api/.dockerignore index f09ad01..6b61b97 100644 --- a/api/.dockerignore +++ b/api/.dockerignore @@ -8,6 +8,5 @@ node_modules .husky .prettierrc coverage* -Makefile README.md test diff --git a/api/package.json b/api/package.json index be94c93..9d4aafd 100644 --- a/api/package.json +++ b/api/package.json @@ -25,8 +25,6 @@ "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "jest --config ./test/jest-e2e.json", "typecheck": "tsc --noEmit", - "containers:restart": "cd .. && make init && make stop && make start", - "containers:rebuild": "cd .. && make init && make destroy && make start", "reset": "npm install && npm run containers:restart", "reset:hard": "npm clean-install && npm run containers:rebuild", "migrate": "./node_modules/ts-migrate-mongoose/dist/cjs/bin.js --config-path ./migrations/config/migrate.ts", diff --git a/docker/.env.example b/docker/.env.example index a78c294..2a967b3 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -30,7 +30,7 @@ MONGO_PASSWORD=dev_only MONGO_URI=mongodb://${MONGO_USER}:${MONGO_PASSWORD}@mongo:27017/ MONGO_DB=hexabot -# SMTP Config (for local dev env, use smtp4dev by doing `make start SMTP4DEV=1`) +# SMTP Config (for local dev env, use smtp4dev by doing `npx hexabot start --enable=smtp4dev`) APP_SMTP_4_DEV_PORT=9002 EMAIL_SMTP_ENABLED=false EMAIL_SMTP_HOST=smtp4dev