Skip to main content

Local Usage and Operator Commands

This page summarizes practical local usage and common operations commands from the Scottsdale Hub application repository. All of the commands in this document are to be used with wsl and work great with it.

Requirements

  • PHP 8.4+
  • Composer 2.x
  • Node.js 22+
  • npm 10+
  • MySQL and Redis

Required PHP extensions:

  • ext-intl
  • ext-pcntl
  • ext-posix

Quick Start

composer setup
composer dev
composer dev-no-grok

Therse commands start all queues, services, grok,laravel and more. Use composer dev everytime you need to interact with the site for the best experience. You can also use the non-grok version if you dont want to start that proxy.

Admin UI:

  • http://127.0.0.1:8000/admin

Composer Commands

  • Bootstrap app: composer setup
  • Local dev stack: composer dev
  • Tests: composer test
  • Coverage: composer test:coverage
  • Coverage gate: composer test:coverage:critical

npm Commands

Asset Building and Dev Server

  • Build assets: npm run build
  • Vite dev server: npm run dev

AWS CLI Configuration

Both database tunnel and ops shell commands require AWS credentials. Set up the AWS CLI locally:

Prerequisites:

You need an AWS IAM user with appropriate permissions. Contact your AWS administrator or DevOps team to:

  1. Create an IAM user for your account (if one doesn't exist)
  2. Attach the following policy groups:
    • AmazonSSMManagedInstanceCore (for ECS Ops shell access)
    • AmazonRDSReadOnlyAccess or custom policy for RDS proxy access
  3. Generate an access key and secret key for the user

Setup:

aws configure --profile scottsdale-dev

This will create a special profile on your local for scottsdale-dev and used throughout this project.

When prompted, enter:

  • AWS Access Key ID: Your IAM user's access key
  • AWS Secret Access Key: Your IAM user's secret key (created in IAM console)
  • Default region: us-west-2 (or your deployment region)
  • Default output format: json

Verification:

Test your configuration:

aws sts get-caller-identity

You should see output with your user's ARN and account ID. If configuration is incorrect, database tunnel and ops commands will fail with authentication errors.

Troubleshooting:

  • "User is not authorized": Check IAM policy attachments
  • "InvalidClientTokenId": Verify access key and secret key are correct
  • Region errors: Confirm default region matches deployment region (usually us-west-2)

Database Tunnel

Create a local tunnel to the RDS proxy for direct database inspection and testing. Credentials for the Databases are in LastPass.

Before using this command, ensure you have completed the AWS CLI Configuration section above.

Default local ports by stage:

  • dev → 127.0.0.1:3307
  • production → 127.0.0.1:3309

Usage:

  • Generic (set STAGE=dev|production): npm run db:tunnel
  • Dev: npm run db:tunnel:dev
  • Production: npm run db:tunnel:production

Override local port:

AWS_REGION=us-west-2 STAGE=dev LOCAL_PORT=3310 npm run db:tunnel

ECS Ops Shell - PHP Artisan Command Access

Before using this command, ensure you have completed the AWS CLI Configuration section above.

Open an interactive shell in the Ops ECS service for maintenance commands.

  • Generic (set STAGE=dev|production): npm run ops
  • Dev: npm run ops:dev
  • Local: npm run ops:local
  • Production: npm run ops:production

Common Artisan Commands

  • Migrate: php artisan migrate --force
  • Migration status: php artisan migrate:status --no-ansi
  • Horizon status: php artisan horizon:status
  • Horizon restart: php artisan horizon:terminate

Cache and optimization refresh:

php artisan optimize:clear
php artisan config:cache
php artisan route:cache
php artisan view:cache

Environment URLs

  • Admin login: /admin/login
  • Horizon dashboard: /admin/horizon

Examples:

  • https://dev.hub.scottsdalemint.com/admin/login
  • https://dev.hub.scottsdalemint.com/admin/horizon

ECS Worker Shell Workflow

Use the dedicated Worker ECS service for daily runtime commands.

Open shell:

npm run ops:production
npm run ops:dev

This allows you to SSH into the Worker ECS agent and run php artisan commands on the environment.

Common operations in shell:

php artisan migrate:status --no-ansi
php artisan queue:failed
php artisan cache:clear

Runtime Role Model

Container entrypoint supports role-specific startup:

  • web
  • worker

This keeps web, queue, and scheduler responsibilities isolated across ECS services.

NGrok

For webhooks on local to work correctly we need ngrok to be up and running. You will need to create an account with your own email on https://dashboard.ngrok.com/signup. Once signed up you need the api token.

curl -sSL https://ngrok-agent.s3.amazonaws.com/ngrok.asc \
| sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null \
&& echo "deb https://ngrok-agent.s3.amazonaws.com bookworm main" \
| sudo tee /etc/apt/sources.list.d/ngrok.list \
&& sudo apt update \
&& sudo apt install ngrok

Once grok is installed we need to connect it to the auth token. The auth token is NOT the API Key. You get your Auth Token from here: https://dashboard.ngrok.com/get-started/your-authtoken. Once you have it run the below command

ngrok config add-authtoken <authToken>

Grok should now be configured for your local. Grok is built into the composer dev command by default. In the ENV file make sure to put your dev domain from grok https://dashboard.ngrok.com/domains

ENV File

If you are looking for the configuration for the env file you can go to Here.