Getting Started

Command Line Arguments

Gigantics can be configured using command line arguments when starting the server. These arguments provide a way to override configuration file settings or specify runtime options.

Basic Usage

./gig start [options]

Available Arguments

Configuration File

  • --config or -c - Specify the configuration file path
    • Default: ./config/default.yaml
    • Example: ./gig start -c ./config/production.yaml

Daemon Mode

  • --daemon or -d - Run the server as a daemon process in the background
    • Default: false
    • Example: ./gig start -d

Process Identifier

  • --name or -n - Set the main process identifier name
    • Example: ./gig start -n "gigantics-production"

Server Configuration Overrides

  • --hostname - Override the server hostname
    • Example: ./gig start --hostname=0.0.0.0
  • --baseUrl - Override the server base URL
    • Example: ./gig start --baseUrl=https://gigantics.company.com
  • --port - Override the server port
    • Example: ./gig start --port=8080

Database Configuration Overrides

  • --db-host - Override the database host
    • Example: ./gig start --db-host=mongodb.company.com
  • --db-port - Override the database port
    • Example: ./gig start --db-port=27018
  • --db - Override the database name
    • Example: ./gig start --db=gigantics_prod

Logging Override

  • --logLevel - Override the logging level
    • Options: error, warn, info, http, verbose, debug, silly
    • Example: ./gig start --logLevel=debug

Worker Configuration

  • --web or -w - Start web workers (cluster mode)
    • Values:
      • -1 - Disable clustering
      • 0 - Fork to all available CPUs
      • N - Fork to N workers (positive number)
    • Example: ./gig start -w=4
  • --job or -j - Start job workers
    • Example: ./gig start -j=3

Examples

Production Start with Daemon Mode

./gig start -c config/production.yaml -d

Development Start with Debug Logging

./gig start -c config/development.yaml --logLevel=debug

Custom Port and Host

./gig start --hostname=0.0.0.0 --port=8080

Cluster Mode

./gig start -w=0  # Use all available CPUs
./gig start -w=4  # Use 4 workers

Database Override

./gig start --db-host=mongodb-prod.company.com --db=gigantics_production

Combined Arguments

./gig start -c config/production.yaml -d -w=0 --hostname=0.0.0.0 --port=80

Argument Priority

Command line arguments override configuration file settings in this order:

  1. Default values in code
  2. Configuration file settings
  3. Environment variables (where applicable)
  4. Command line arguments

Windows Usage

On Windows, use the .exe extension:

gig.exe start [options]

Best Practices

  1. Configuration Files: Use configuration files for persistent settings and command line arguments for temporary overrides
  2. Production: Always specify a configuration file in production environments
  3. Security: Be careful with logging levels in production as verbose logging may expose sensitive information
  4. Documentation: Document all command line arguments used in your deployment procedures
  5. Testing: Test command line arguments in development before using them in production

Common Deployment Patterns

Development

./gig start -c config/development.yaml --logLevel=silly

Staging

./gig start -c config/staging.yaml -d --logLevel=info

Production

./gig start -c config/production.yaml -d -w=0 --logLevel=http

These command line arguments provide flexibility in how you deploy and run Gigantics, allowing you to override specific settings without modifying configuration files.

Individual Command Documentation

For detailed information about each available command in Gigantics, see the individual command documentation: