### Docker Core Installation and Network Setup Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/README.md Commands to set up the necessary Docker network and launch core services for the application. This includes creating a network named 'proxy-net' and starting the server components using a specific Docker Compose file. ```shell # 1. Install Docker and Docker Compose # 2. Create network docker network create proxy-net # 3. Launch core services docker compose -f docker-compose.server.yml -p server__global up -d ``` -------------------------------- ### Production Docker Setup and Management Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/README.md Instructions for deploying and managing the application in a production environment using Docker. This includes building the production image, starting/stopping services, handling database migrations, and monitoring container logs. ```shell # Configure environment variables: cp .env.prod.example .env.prod # Build and start production environment: docker compose -f docker-compose.prod.yml --env-file .env.prod -p prod__app-template-automation-rules build docker compose -f docker-compose.prod.yml --env-file .env.prod -p prod__app-template-automation-rules up -d # DB migration: docker compose -f docker-compose.prod.yml --env-file .env.prod -p prod__app-template-automation-rules --profile migrate up migrator # Stop production environment: docker compose -f docker-compose.prod.yml --env-file .env.prod -p prod__app-template-automation-rules down # Container logs: docker logs -f prod-frontend docker logs -f prod__app-template-automation-rules-consumer-nodejs-pdf-from-html-1 docker logs -f prod__app-template-automation-rules-consumer-php-crm-entity-task-calc-1 docker logs -f prod-db # Rebuild migration: docker compose -f docker-compose.prod.yml --env-file .env.prod -p prod__app-template-automation-rules --profile migrate down migrator && \ docker compose -f docker-compose.prod.yml --env-file .env.prod -p prod__app-template-automation-rules --profile migrate up --build migrator ``` -------------------------------- ### Database Query Example Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/README.md An example SQL query to retrieve specific data from the 'B24App' table within the 'dbapp' database, likely used for debugging or data inspection. ```sql dbapp# select "memberId", "userId", "domain" from "B24App"; ``` -------------------------------- ### Bitrix24 Business Process Action Consumer Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/README.md Describes the setup for a custom activity consumer, including its location, the queue it listens to, and its integration with Docker Compose. ```apidoc Create consumer in `consumers/activities/new-demo-activity` handling queue `activity.NewDemoActivity.v1` Configure in `docker-compose.*.yml` files ``` -------------------------------- ### Bitrix24 Event Handlers Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/README.md Lists API event handlers for application lifecycle events like installation and uninstallation, responsible for managing tokens and application state in the database. ```apidoc Event handlers: - `api/event/onAppInstall.post.ts` - app installation (stores tokens in DB) - `api/event/onAppUninstall.post.ts` - app removal (deletes tokens) ``` -------------------------------- ### Development Docker Setup and Management Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/README.md Instructions for setting up and managing the application in a development environment using Docker. This covers copying environment files, starting/stopping the development stack, performing database migrations, and accessing container logs or debugging shells. ```shell # Configure environment variables: cp .env.dev.example .env.dev # Start development environment: docker compose -f docker-compose.dev.yml --env-file .env.dev -p dev__app-template-automation-rules up -d --build # DB migration: docker exec -it dev-frontend sh -c "pnpm run prisma:migrate-deploy" # Stop development environment: docker compose -f docker-compose.dev.yml --env-file .env.dev -p dev__app-template-automation-rules down # Container logs: docker logs -f dev-frontend docker logs -f dev__app-template-automation-rules-consumer-nodejs-pdf-from-html-1 docker logs -f dev__app-template-automation-rules-consumer-php-crm-entity-task-calc-1 docker logs -f dev-db # Consumer scaling example (php-crm-entity-task-calc): docker compose -f docker-compose.dev.yml --env-file .env.dev -p dev__app-template-automation-rules down consumer-php-crm-entity-task-calc && \ docker compose -f docker-compose.dev.yml --env-file .env.dev -p dev__app-template-automation-rules up -d --build --scale consumer-php-crm-entity-task-calc=2 # Restart all services: docker compose -f docker-compose.dev.yml --env-file .env.dev -p dev__app-template-automation-rules down && \ docker compose -f docker-compose.dev.yml --env-file .env.dev -p dev__app-template-automation-rules up -d --build # Container debugging: docker exec -it dev-frontend sh docker exec -it dev-frontend sh -c "ls .la" docker exec -it dev__app-template-automation-rules-consumer-nodejs-pdf-from-html-1 sh docker exec -it dev__app-template-automation-rules-consumer-php-crm-entity-task-calc-1 sh # Database access: docker exec -it dev-db psql -U dbuser -d dbapp # Example query: dbapp# select "memberId", "userId", "domain" from "B24App"; ``` -------------------------------- ### Bitrix24 Application Pages Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/README.md Lists key Vue.js pages within the frontend application, detailing their purpose such as installation handling, main page redirection, and activity list display. ```vue Application pages in `frontend/app/pages`: - `install.client.vue` - installation handler - `index.client.vue` - main page redirects to `activity-list.client.vue` - `activity-list.client.vue` - shows actions list and app settings - `pages/setting/[code].client.vue` - `placement` handler for BP action parameters (requires customization) ``` -------------------------------- ### Configure App Marketplace Action in Bitrix24 Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/frontend/content/activities/en/AppMarketplace.md This snippet details the process of integrating the 'App Marketplace' action into a Bitrix24 business process. It covers adding the action, searching for apps, installing, configuring integrations, and leveraging app functionality within automated workflows. ```bitrix24 1. Navigate to the "Business Processes" section in Bitrix24. 2. Create or open an existing business process. 3. Locate and add the "App Marketplace" action. 4. Open the App Marketplace interface within Bitrix24. 5. Utilize filters and categories to find desired applications. 6. Review app details, ratings, and user feedback. 7. Click "Install" and follow on-screen prompts. 8. Configure app integration with Bitrix24 data and processes (e.g., CRM, API settings). 9. Set up triggers and actions in business processes to utilize installed app features. 10. Regularly check for app updates and manage installed applications. ``` -------------------------------- ### Project Structure Overview Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/README.md A visual representation of the application's directory structure. It highlights key directories for frontend (Nuxt3), backend API, database models (Prisma/PostgreSQL), action descriptions, localization, and build tools. ```plaintext /frontend /app # Application pages (Nuxt3) /server # API and event handlers /prisma # Database models (PostgreSQL) /content # Markdown action descriptions /i18n # Localization /tools # Translation scripts /consumers /activities # Action consumers /nodejs-pdf-from-html # PDF generator /php-crm-entity-task-calc # Task calculator /chrome # Chrome configuration for rendering ``` -------------------------------- ### PdfFromHtml Consumer Workflow Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/README.md Outlines the workflow for the NodeJS-based PdfFromHtml consumer, detailing data retrieval, JWT token generation, Chrome rendering, PDF conversion, and Bitrix24 integration. ```apidoc Workflow: 1. Gets auth data from message → verifies in DB 2. Creates JWT token (5min TTL) with oAuth params 3. Calls Chrome-rendered page `render/invoice-by-entity/[entityTypeId]-[entityId]` 4. Page script validates JWT → fetches deal/lead data from Bitrix24 5. Generates HTML invoice → converts to PDF via Chrome 6. Sends PDF to Bitrix24 ``` -------------------------------- ### Bitrix24 リードジェネレーション設定手順 Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/frontend/content/activities/ja/LeadGeneration.md Bitrix24のビジネスプロセス内で「リードジェネレーション」アクションを追加し、リードソースの接続、自動処理、育成シナリオの設定、分析を行うための手順を説明します。このアクションは、ウェブサイトフォーム、広告キャンペーン、ソーシャルメディアなどからのリードを収集し、CRMで自動的にリードを作成・分類・処理するために使用されます。 ```APIDOC Bitrix24 Lead Generation Action Configuration: 1. **Add Action to Business Process**: - Navigate to the "Business Processes" section in Bitrix24. - Create a new process or open an existing one. - Find and add the "Lead Generation" action from the list of available actions. 2. **Configure Lead Sources**: - Connect lead sources (e.g., website forms, advertising campaigns, social media). - Set up automatic lead creation in CRM upon data reception. - Use Bitrix24 web forms to collect contact information. - Parameters: - `lead_source_type`: Type of lead source (e.g., 'website_form', 'advertising', 'social_media'). - `crm_integration`: Boolean, whether to automatically create leads in CRM. - `webform_id`: ID of the Bitrix24 web form if used. - Returns: Status of source connection. 3. **Automate Lead Processing**: - Set up automatic lead classification by categories (e.g., source, region, interest). - Configure automatic sending of emails or SMS to new leads using "Robots". - Set up notifications for managers about new leads. - Parameters: - `classification_rules`: Array of rules for automatic lead categorization. - `automation_rules`: Array of automation rules (e.g., send email, send SMS). - `notification_settings`: Object for manager notification configuration. - Returns: Status of automation setup. 4. **Lead Nurturing**: - Create "Sales Funnel" scenarios for staged lead engagement. - Maintain contact using "Email Campaigns" or "Automated Reminders". - Set triggers to convert leads to deals when specific conditions are met. - Parameters: - `sales_funnel_scenario`: Definition of the sales funnel stages and actions. - `nurturing_campaigns`: Configuration for email campaigns and reminders. - `conversion_triggers`: Rules for converting leads to deals. - Returns: Status of nurturing setup. 5. **Analysis and Optimization**: - Analyze lead generation effectiveness (e.g., lead count, conversion rate) using built-in reports. - Set up notifications with key metrics for responsible parties. - Optimize processes based on analytical data. - Parameters: - `reporting_period`: Timeframe for analysis. - `key_metrics`: List of metrics to track. - `optimization_suggestions`: System-generated suggestions for improvement. - Returns: Performance report and optimization insights. ``` -------------------------------- ### Configure Sustainability Initiatives Action Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/frontend/content/activities/en/SustainabilityInitiatives.md Details the configuration parameters for the 'Sustainability Initiatives' action in Bitrix24 workflows, covering practice implementation, impact tracking, goal monitoring, and reporting. ```APIDOC Action: Sustainability Initiatives Configuration Parameters: 1. **Eco-Friendly Practice Implementation**: * **Description**: Define the specific eco-friendly practices to be implemented and assign responsible team members. * **Parameters**: * `practices_definition`: (string) A detailed description or list of practices (e.g., 'waste reduction', 'energy efficiency'). * `responsible_members`: (array of strings) Names or IDs of team members assigned to implement each practice. 2. **Impact Tracking**: * **Description**: Set up metrics for measuring environmental impact and integrate data sources for automatic tracking. * **Parameters**: * `impact_metrics`: (array of strings) Metrics to measure environmental impact (e.g., 'carbon footprint', 'energy savings', 'water usage'). * `data_integration_sources`: (array of strings) Sources for automatic data collection (e.g., 'IoT sensors', 'utility bills API', 'manual input'). 3. **Goal Monitoring**: * **Description**: Establish clear sustainability goals and timelines, and configure progress tracking and alerts. * **Parameters**: * `sustainability_goals`: (array of objects) Goals with descriptions and target dates. * `goal_description`: (string) Description of the sustainability goal. * `target_date`: (date) The deadline for achieving the goal. * `progress_tracking_config`: (object) Configuration for monitoring progress. * `enable_alerts`: (boolean) Whether to send alerts for milestones. * `alert_frequency`: (string) Frequency of progress alerts (e.g., 'weekly', 'monthly'). 4. **Reporting**: * **Description**: Customize report templates and schedule automated report generation and distribution. * **Parameters**: * `report_templates`: (array of strings) Names or paths to custom report templates. * `report_schedule`: (string) Schedule for automated report generation (e.g., 'daily', 'end_of_month'). * `distribution_list`: (array of strings) Email addresses or user groups for report distribution. Usage Steps: 1. Log in to Bitrix24. 2. Navigate to CRM > Automation > Business Processes. 3. Create or edit a Business Process. 4. Drag and drop the 'Sustainability Initiatives' action. 5. Configure the parameters listed above. 6. Save and activate the workflow. ``` -------------------------------- ### JavaScript Module Preload and Fetch Check Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/frontend/template/devServer-loading.html This script enhances module loading by checking for 'modulepreload' support and dynamically fetching modules. It also includes a fallback mechanism that reloads the page if the fetch API is unavailable or if the page content doesn't appear to load correctly within a specified interval. ```javascript (function() { const t = document.createElement("link").relList; if (t && t.supports && t.supports("modulepreload")) return; for (const e of document.querySelectorAll('link[rel="modulepreload"]')) i(e); new MutationObserver(e => { for (const r of e) if (r.type === "childList") for (const o of r.addedNodes) o.tagName === "LINK" && o.rel === "modulepreload" && i(o); }).observe(document, { childList: !0, subtree: !0 }); function s(e) { const r = {}; return e.integrity && (r.integrity = e.integrity), e.referrerPolicy && (r.referrerPolicy = e.referrerPolicy), e.crossOrigin === "use-credentials" ? r.credentials = "include" : e.crossOrigin === "anonymous" ? r.credentials = "omit" : r.credentials = "same-origin", r; } function i(e) { if (e.ep) return; e.ep = !0; const r = s(e); fetch(e.href, r); } })(); if (typeof window.fetch === 'undefined') { setTimeout(() => window.location.reload(), 1000); } else { const check = async () => { try { const body = await window.fetch(window.location.href).then(r => r.text()); if (!body.includes('__NUXT_LOADING__')) { return window.location.reload(); } } catch {} setTimeout(check, 1000); }; check(); } ``` -------------------------------- ### Scale Docker Consumers with Docker Compose Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/README.md Commands to scale specific Docker consumers up to two instances using `docker compose`. This involves stopping the current service and then restarting it with the desired scale. ```shell docker compose -f docker-compose.prod.yml --env-file .env.prod -p prod__app-template-automation-rules down consumer-php-crm-entity-task-calc && \ docker compose -f docker-compose.prod.yml --env-file .env.prod -p prod__app-template-automation-rules up -d --scale consumer-php-crm-entity-task-calc=2 ``` ```shell docker compose -f docker-compose.prod.yml --env-file .env.prod -p prod__app-template-automation-rules down consumer-nodejs-pdf-from-html && \ docker compose -f docker-compose.prod.yml --env-file .env.prod -p prod__app-template-automation-rules up -d --scale consumer-nodejs-pdf-from-html=2 ``` -------------------------------- ### View Docker Compose Service Top Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/README.md Commands to view the resource usage of services managed by Docker Compose for development and production environments. ```shell docker compose -f docker-compose.dev.yml -p dev__app-template-automation-rules top ``` ```shell docker compose -f docker-compose.prod.yml -p prod__app-template-automation-rules top ``` -------------------------------- ### Monitor Docker Resources Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/README.md Shell commands for monitoring Docker container resource usage and status. Includes real-time stats, listing containers, and checking Docker service status. ```shell docker stats docker ps docker ps -a | grep chrome watch -n 2 docker ps sudo systemctl status docker sudo ss -tuln | grep 2376 watch -n 5 "docker stats --no-stream --format 'table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.MemPerc}}'" ``` -------------------------------- ### Bitrix24 Business Process Action Configuration Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/README.md Details the configuration structure for custom business process actions (robots) within Bitrix24, including type, code, filters, properties, and return properties. ```typescript export const activitiesConfig: ActivityOrRobotConfig[] = [ // ... { type: 'robot', CODE: 'NewDemoActivity', FILTER: { /*...*/ }, PROPERTIES: { /*...*/ }, RETURN_PROPERTIES: { /*...*/ } } ] ``` -------------------------------- ### Bitrix24 Business Process Action Description Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/README.md Specifies the metadata format for describing custom business process actions, including title, description, categories, badges, and avatar path. ```markdown --- title: Title for new activity description: Description for new activity categories: - 'category_1' - 'category_2' badges: - 'badge_1' - 'badge_2' avatar: '/activities/NewDemoActivity.webp' --- ``` -------------------------------- ### Container Debugging with Docker Exec Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/README.md Commands to access running containers for debugging purposes. Allows interactive shell access to troubleshoot issues within specific application containers or the database. ```shell docker exec -it prod-frontend sh ``` ```shell docker exec -it prod__app-template-automation-rules-consumer-nodejs-pdf-from-html-1 sh ``` ```shell docker exec -it prod__app-template-automation-rules-consumer-php-crm-entity-task-calc-1 sh ``` ```shell docker exec -it prod-db psql -U dbuser -d dbapp ``` -------------------------------- ### Prune Docker Resources Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/README.md Commands to clean up unused Docker resources, including stopped containers, unused images, and volumes. Use with caution as it removes unreferenced data. ```shell # Delete all stopped containers docker container prune # Remove all unused images docker image prune -a # Delete unused volumes docker volume prune docker volume ls docker volume rm xxx1 xxx2 xxx3 docker volume prune -a # Delete EVERYTHING unused (including volumes and images) docker system prune -a --volumes ``` -------------------------------- ### Konfiguracja Akcji Zarządzanie Infrastrukturą IT Source: https://github.com/bitrix24/app-template-automation-rules/blob/main/frontend/content/activities/pl/ITInfrastructureManagement.md Szczegółowy opis konfiguracji akcji „Zarządzanie Infrastrukturą IT” w Projektancie Procesów Bitrix24. Obejmuje ustawienia monitorowania, alertów, konserwacji i zarządzania incydentami. ```APIDOC Konfiguracja Akcji „Zarządzanie Infrastrukturą IT”: 1. Dostęp do Projektanta Procesów: - Zaloguj się do swojego konta Bitrix24. - Przejdź do **CRM** > **Automatyzacja** > **Procesy Biznesowe**. - Kliknij **Utwórz Proces Biznesowy** lub wybierz istniejący do edycji. 2. Dodanie Akcji Zarządzania Infrastrukturą IT: - W Projektancie Procesów przeciągnij i upuść akcję **Zarządzanie Infrastrukturą IT** z listy dostępnych akcji. - Umieść akcję w miejscu, w którym ma wystąpić w Twoim procesie. 3. Konfiguracja Akcji: - Monitorowanie Systemu: - Zdefiniuj metryki do monitorowania (np. czas pracy serwera, opóźnienie sieci). - Ustaw progi dla alertów wydajności. - Automatyczne Alerty: - Określ warunki wyzwalające alerty (np. użycie CPU powyżej 90%). - Wybierz kanały powiadomień (np. email, SMS, czat Bitrix24). - Planowanie Konserwacji: - Utwórz harmonogram rutynowych zadań (np. kopie zapasowe, aktualizacje). - Przypisz odpowiedzialnych członków zespołu do każdego zadania. - Zarządzanie Incydentami: - Skonfiguruj procesy zgłaszania i rozwiązywania incydentów. - Zdefiniuj ścieżki eskalacji dla nierozwiązanych problemów. 4. Zapisz i Aktywuj: - Sprawdź ustawienia, aby upewnić się, że wszystko jest poprawnie skonfigurowane. - Kliknij **Zapisz**, a następnie **Aktywuj**, aby wprowadzić akcję Zarządzanie Infrastrukturą IT do życia w Twoim procesie. ```