### Run the automated installation script Source: https://stackwarden.mysticastra.org/docs/installation Executes the installation script to pull images and start the StackWarden services. ```bash $ curl -fsSL https://stackwarden.mysticastra.org/install.sh | bash ``` -------------------------------- ### Install the SDK Source: https://stackwarden.mysticastra.org/docs/sdk/laravel Install the package via Composer. ```bash $ composer require stackwarden/laravel ``` -------------------------------- ### Install Stackwarden via Script Source: https://stackwarden.mysticastra.org/docs/nginx Set environment variables and execute the installation script to deploy the stack. ```bash export STACKWARDEN_DIR=/var/www/sw.example.com export WEB_PORT=8001 export PUBLIC_WEB_URL=https://sw.example.com export PUBLIC_API_URL=https://sw.example.com curl -fsSL https://stackwarden.mysticastra.org/install.sh | bash ``` -------------------------------- ### Install StackWarden Source: https://stackwarden.mysticastra.org/docs/quickstart Sets the web port and executes the installation script on a VPS or Docker environment. ```bash $ export WEB_PORT=8001 $ curl -fsSL https://stackwarden.mysticastra.org/install.sh | bash ``` -------------------------------- ### Configuration environment variables Source: https://stackwarden.mysticastra.org/docs/sdk/laravel Example configuration settings for the .env file. ```text STACKWARDEN_DSN=http://sw_…@127.0.0.1:8001 STACKWARDEN_TRACES_SAMPLE_RATE=1.0 STACKWARDEN_ENABLE_LOGS=true STACKWARDEN_ENABLE_METRICS=true ``` -------------------------------- ### Install with custom domain and port Source: https://stackwarden.mysticastra.org/docs/installation Configures custom environment variables before running the installation script to set the web port and public URL. ```bash export WEB_PORT=8001 export PUBLIC_WEB_URL=https://sw.example.com curl -fsSL https://stackwarden.mysticastra.org/install.sh | bash ``` -------------------------------- ### Verify installation Source: https://stackwarden.mysticastra.org/docs/sdk/laravel Run the test command to verify the integration. ```bash $ php artisan stackwarden:test $ php artisan stackwarden:test --all # event + sample trace / log / metric ``` -------------------------------- ### Enable TLS with Certbot Source: https://stackwarden.mysticastra.org/docs/nginx Install Certbot and generate SSL certificates for the domain. ```bash # Debian/Ubuntu $ sudo apt install -y certbot python3-certbot-nginx $ sudo certbot --nginx -d sw.example.com ``` -------------------------------- ### Install Stackwarden via CLI Source: https://stackwarden.mysticastra.org/docs/sdk/flutter Add the package to your Flutter project using the command line. ```bash $ flutter pub add stackwarden ``` -------------------------------- ### Integrate Laravel SDK Source: https://stackwarden.mysticastra.org/docs/quickstart Installs the package via Composer and publishes the configuration with the project DSN. ```bash $ composer require stackwarden/laravel $ php artisan stackwarden:publish --dsn="http://sw_YOUR_PROJECT_KEY@127.0.0.1:8001" ``` -------------------------------- ### Install Stackwarden via pubspec.yaml Source: https://stackwarden.mysticastra.org/docs/sdk/flutter Add the dependency manually to your pubspec.yaml file. ```yaml dependencies: stackwarden: ^1.0.0 ``` -------------------------------- ### Configure Environment Variables and Verify Service Source: https://stackwarden.mysticastra.org/docs/nginx Update the .env file with public URLs and verify the local service response. ```text PUBLIC_WEB_URL=https://sw.example.com PUBLIC_API_URL=https://sw.example.com WEB_PORT=8001 ``` ```bash $ cd /var/www/sw.example.com $ docker compose up -d $ curl -I http://127.0.0.1:8001/ ``` -------------------------------- ### Manual usage and instrumentation Source: https://stackwarden.mysticastra.org/docs/sdk/laravel Capture exceptions, configure scope, and manually start/finish transactions. ```php use Stackwarden\Facade as Stackwarden; try { risky(); } catch (Throwable $e) { Stackwarden::captureException($e); } Stackwarden::configureScope(function ($scope) { $scope->setTag('tenant', 'acme'); $scope->setUser(['id' => (string) auth()->id()]); }); $tx = Stackwarden::startTransaction('POST /checkout', 'http.server'); // … Stackwarden::finishTransaction('ok'); ``` -------------------------------- ### Configure DSN via Artisan Source: https://stackwarden.mysticastra.org/docs/sdk/laravel Publish the DSN configuration using the artisan command. ```bash $ php artisan stackwarden:publish --dsn="http://sw_YOUR_PROJECT_KEY@127.0.0.1:8001" ``` -------------------------------- ### Configure DSN via .env Source: https://stackwarden.mysticastra.org/docs/sdk/laravel Set the DSN or split configuration variables in the .env file. ```text STACKWARDEN_DSN=http://sw_YOUR_PROJECT_KEY@127.0.0.1:8001 # Equivalent split form: # STACKWARDEN_BASE_URL=http://127.0.0.1:8001 # STACKWARDEN_PROJECT_KEY=sw_YOUR_PROJECT_KEY ``` -------------------------------- ### Configure DNS Records Source: https://stackwarden.mysticastra.org/docs/nginx Point your domain to the server IP and verify the configuration. ```text sw.example.com -> your.server.ip ``` ```bash $ dig +short sw.example.com ``` -------------------------------- ### Initialize Stackwarden with Integration.runApp Source: https://stackwarden.mysticastra.org/docs/sdk/flutter Wrap your application entry point with Integration.runApp to automatically capture unhandled Flutter and platform errors. ```dart import 'package:stackwarden/stackwarden.dart'; Future main() async { await Integration.runApp( () async { // Plugin / binding init here - not before Integration.runApp. return const MyApp(); }, options: Options.fromMap({ 'dsn': const String.fromEnvironment( 'STACKWARDEN_DSN', defaultValue: 'http://sw_YOUR_PROJECT_KEY@127.0.0.1:8001', ), 'environment': 'development', 'traces_sample_rate': 1.0, 'enable_logs': true, 'enable_metrics': true, }), ); } ``` -------------------------------- ### Pull and recreate containers Source: https://stackwarden.mysticastra.org/docs/updating Use these commands to update the application to the latest images and restart the services. ```bash $ cd stackwarden # or your STACKWARDEN_DIR $ docker compose pull $ docker compose up -d ``` -------------------------------- ### Integration.runApp Source: https://stackwarden.mysticastra.org/docs/sdk/flutter Initializes the StackWarden integration, wrapping the application to capture unhandled Flutter errors, platform errors, and zone errors. ```APIDOC ## Integration.runApp ### Description Initializes the StackWarden SDK and wraps the application to automatically capture unhandled errors from FlutterError, PlatformDispatcher, and runZonedGuarded. ### Parameters - **appBuilder** (Function) - Required - A function that returns the root widget of the application. - **options** (Options) - Required - Configuration object created via Options.fromMap or the Options constructor. ``` -------------------------------- ### Integrate Flutter SDK Source: https://stackwarden.mysticastra.org/docs/quickstart Adds the dependency to the project and runs the application with the DSN defined as a dart-define variable. ```bash $ flutter pub add stackwarden $ flutter run --dart-define=STACKWARDEN_DSN=http://sw_…@127.0.0.1:8001 ``` -------------------------------- ### Define DSN via Dart Define Source: https://stackwarden.mysticastra.org/docs/sdk/flutter Pass the DSN configuration at runtime using the --dart-define flag. ```bash $ flutter run --dart-define=STACKWARDEN_DSN=http://sw_…@127.0.0.1:8001 ``` -------------------------------- ### configureScope Source: https://stackwarden.mysticastra.org/docs/sdk/flutter Configures the current scope with tags and user information. ```APIDOC ## configureScope ### Description Allows setting tags and user context that will be attached to subsequent events. ### Parameters - **callback** (Function(Scope)) - Required - A function that receives the current scope to modify. ``` -------------------------------- ### Wire unhandled exceptions for Laravel 11+ Source: https://stackwarden.mysticastra.org/docs/sdk/laravel Register the exception handler in bootstrap/app.php. ```php ->withExceptions(function (Exceptions $exceptions) { \Stackwarden\Integration::handles($exceptions); }) ``` -------------------------------- ### Uninstall Stackwarden Source: https://stackwarden.mysticastra.org/docs/updating Stops all containers and removes the Postgres volume, resulting in permanent data loss. ```bash $ cd stackwarden $ docker compose down -v ``` -------------------------------- ### Capture Exceptions, Configure Scope, and Send Telemetry Source: https://stackwarden.mysticastra.org/docs/sdk/flutter Use these methods to manually report exceptions, set user context, and send custom logs or metrics. ```dart try { risky(); } catch (e, st) { await captureException(e, stackTrace: st); } configureScope((scope) { scope.setTag('tenant', 'acme'); scope.setUser({'id': currentUserId}); }); await captureLog('Order placed', attributes: {'order_id': '42'}); await captureMetric('checkout.latency', 12.5, unit: 'ms'); await flush(); ``` -------------------------------- ### captureException Source: https://stackwarden.mysticastra.org/docs/sdk/flutter Manually captures and reports an exception to StackWarden. ```APIDOC ## captureException ### Description Manually reports an exception and its associated stack trace to the StackWarden dashboard. ### Parameters - **exception** (dynamic) - Required - The error object to report. - **stackTrace** (StackTrace) - Optional - The stack trace associated with the exception. ``` -------------------------------- ### Configure Nginx Reverse Proxy Source: https://stackwarden.mysticastra.org/docs/nginx Define the server block for Nginx and apply the configuration changes. ```nginx server { listen 80; server_name sw.example.com; location / { proxy_pass http://127.0.0.1:8001; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; client_max_body_size 20m; } } ``` ```bash $ sudo ln -sf /etc/nginx/sites-available/sw.example.com \ /etc/nginx/sites-enabled/ $ sudo nginx -t && sudo systemctl reload nginx ``` -------------------------------- ### captureLog Source: https://stackwarden.mysticastra.org/docs/sdk/flutter Reports a custom log message with optional attributes. ```APIDOC ## captureLog ### Description Sends a custom log message to the StackWarden platform. ### Parameters - **message** (String) - Required - The log message. - **attributes** (Map) - Optional - Key-value pairs providing additional context. ``` -------------------------------- ### Wire unhandled exceptions for Laravel 10 Source: https://stackwarden.mysticastra.org/docs/sdk/laravel Register the exception handler in app/Exceptions/Handler.php. ```php public function register(): void { $this->reportable(function (Throwable $e) { \Stackwarden\Integration::captureUnhandledException($e); }); } ``` -------------------------------- ### captureMetric Source: https://stackwarden.mysticastra.org/docs/sdk/flutter Reports a custom metric value. ```APIDOC ## captureMetric ### Description Records a custom metric for performance monitoring. ### Parameters - **name** (String) - Required - The name of the metric. - **value** (num) - Required - The numeric value to record. - **unit** (String) - Optional - The unit of measurement (e.g., 'ms'). ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.