run command

The run command runs common task

gallery.js run

Run common tasks

Commands:
  gallery.js run init    Initialize the gallery configuration
  gallery.js run server  Start the webserver
  gallery.js run import  Import and update new files from sources

Options:
      --version          Show version number                           [boolean]
      --full-version     Show full build version                       [boolean]
  -l, --log-level        Console log level
         [string] [choices: "trace", "debug", "info", "warn", "error", "silent"]
  -J, --log-json-format  Log output format in json                     [boolean]
  -L, --log-file         Log file
      --log-file-level   Log file level
  [string] [choices: "trace", "debug", "info", "warn", "error"] [default: "debug
                                                                              "]
  -c, --config           Configuration file
      --auto-config      Search for configuration on common configuration direct
                         ories                         [boolean] [default: true]
  -h, --help             Show help                                     [boolean]
      --level                                                   [default: debug]

run init command

gallery.js run init

Initialize the gallery configuration

Options:
      --version          Show version number                           [boolean]
      --full-version     Show full build version                       [boolean]
  -l, --log-level        Console log level
         [string] [choices: "trace", "debug", "info", "warn", "error", "silent"]
  -J, --log-json-format  Log output format in json                     [boolean]
  -L, --log-file         Log file
      --log-file-level   Log file level
  [string] [choices: "trace", "debug", "info", "warn", "error"] [default: "debug
                                                                              "]
  -c, --config           Configuration file
      --auto-config      Search for configuration on common configuration direct
                         ories                         [boolean] [default: true]
  -s, --source           Initial source directory or directories
                                                              [array] [required]
  -f, --force            Force, overwrite existing configuration       [boolean]
  -h, --help             Show help                                     [boolean]
      --level                                                   [default: debug]

Use the --source parameter to initialize your media directories. You can edit the sources later in the gallery.config.yml configuration.

See configuration section for all available configuration options.

run server command

gallery.js run server

Start the webserver

Options:
      --version          Show version number                           [boolean]
      --full-version     Show full build version                       [boolean]
  -l, --log-level        Console log level
         [string] [choices: "trace", "debug", "info", "warn", "error", "silent"]
  -J, --log-json-format  Log output format in json                     [boolean]
  -L, --log-file         Log file
      --log-file-level   Log file level
  [string] [choices: "trace", "debug", "info", "warn", "error"] [default: "debug
                                                                              "]
  -c, --config           Configuration file
      --auto-config      Search for configuration on common configuration direct
                         ories                         [boolean] [default: true]
  -h, --help             Show help                                     [boolean]
      --level                                                   [default: debug]
Note

The server command starts the local web server. Source directories are imported and watched for changes by default

run import command

The import command

  • creates or updates the file indices
  • extracts meta data and calculates previews
  • build the media database
  • watch for file changes
gallery.js run import

Import and update new files from sources

Options:
      --version              Show version number                       [boolean]
      --full-version         Show full build version                   [boolean]
  -l, --log-level            Console log level
         [string] [choices: "trace", "debug", "info", "warn", "error", "silent"]
  -J, --log-json-format      Log output format in json                 [boolean]
  -L, --log-file             Log file
      --log-file-level       Log file level
  [string] [choices: "trace", "debug", "info", "warn", "error"] [default: "debug
                                                                              "]
  -c, --config               Configuration file
      --auto-config          Search for configuration on common configuration di
                             rectories                 [boolean] [default: true]
  -i, --initial              Run initial incremental import            [boolean]
  -u, --update               Check and import new files                [boolean]
  -s, --small-files          Import only small files up to 20MB to exclude big f
                             iles such as videos to speed up the initial import
                                                                       [boolean]
  -w, --watch                Watch files for changes and run import on changes
                                                                       [boolean]
      --watch-delay          Delay import after file change detection in seconds
                             . A new file change refreshes the previous delay
                                                          [number] [default: 10]
      --watch-max-delay      Maximum delay after file change detection in second
                             s. Set it to 0 for immediate import on file change
                                                         [number] [default: 600]
      --watch-poll-interval  Use poll interval in seconds. If set 0 watch mode u
                             ses fs events if available.   [number] [default: 0]
      --import-on-start      Run import on watch start [boolean] [default: true]
  -h, --help                 Show help                                 [boolean]
      --level                                                   [default: debug]

The import command supports 3 modes

  • Initial/incremental import
  • Update import
  • Full import

At the beginning you should use the initial import. It batches the import in several chunks to build the database step by step. At the beginning the chunks are small and database updates are done frequently. If you have a many files in the database the chunk sizes grow and database updates happens less frequently.

When all media are imported and processed you should run update import to import only new unknown files. Eg. if you copied new camera files from your memory cart to your hard drive.

The full import processes all files and checks for missing meta data or preview files. This mode should be run after your finished the initial import - just to be safe. This mode is slow since all media files, meta data and previews needs to be checked.

Note

The watch mode should use the polling mechanism for larger, slow or remote media repositories. An polling interval of at least 5 min is recommended.

Note

The import command can run in parallel to the server. If the database is updated, the server and webapp will reload it by default.

Note

If the import command is aborted (eg. by the user), you should run a full import to ensure that all meta data and all previews are available.