fauna local
fauna local [flags]
Start a local Fauna container.
Once started, use the --local
flag to run CLI commands in the container. See
Use a Local Fauna container with the CLI.
To use this command, you must have Docker or similar software installed and running.
The command uses health checks to determine whether the container is ready. The
checks ping the container at regular intervals until a successful response is
received or the maximum number of attempts is reached. You can configure the
checks using --interval
and ---max-attempts
.
Use --database
to optionally create a database in the container. Use
--typechecked
, --protected
, and --priority
to configure the database.
When creating a database, use --dir
to push a local directory of .fsl
schema
files to the database using fauna schema push
. The
schema is immediately applied to the database’s active schema with no prompts.
Flags
- Output
-
--color
-
Enable color formatting for output. Enabled by default. Use
--no-color
to disable. --json
-
Output results as JSON.
--quiet
-
Suppress all log messages except fatal errors. Output only command results. Overrides
--verbosity
and--verbose-component
.
- Config
-
--config <string>
-
Path to a CLI config file to use. If provided, must specify a profile.
-p
,--profile <string>
-
Profile from the CLI config file. A profile is a group of CLI settings.
- Debug
-
--verbose-component <array>
-
Components to emit logs for. Overrides
--verbosity
.Accepts the following values:
-
argv
-
config
-
creds
-
error
-
fetch
Pass values as a space-separated list. Example:
--verbose-component argv config
. -
--verbosity <number>
-
Least critical log level to emit. Accepts integers ranging from
1
(fatal) to5
(debug). Lower values represent more critical logs. Log messages with a level greater than this value are not logged.
- Options
-
-h
,--help
-
Show help.
--version
-
Show the Fauna CLI version.
--container-port <number>
-
Port inside the container where the Fauna instance listens for requests. Defaults to
8443
. --host-port <number>
-
Port on your host machine that maps to the
--container-port
. The CLI and other external clients can send HTTP API requests to Fauna using this port. Defaults to8443
. --host-ip <string>
-
IP address to bind the container’s port to. Defaults to
0.0.0.0
. --interval <number>
-
Interval, in milliseconds, between health check attempts. How often the CLI checks if the container is ready. Defaults to
10000
. Must be greater than or equal to0
. ---max-attempts <number>
-
Maximum number of health check attempts allowed before container startup fails. Defaults to
100
. Must be greater than0
. --name <string>
-
Name for the container. Defaults to
faunadb
. --pull
-
Pull the latest
fauna/faunadb
image before starting the container. Defaults to true. Use--no-pull
to disable. --database <string>
-
Name of the database to create. Omit to create no database.
--typechecked
-
Enable typechecking for the database. Use
--no-typechecked
to disable.Defaults to enabled for databases in a Fauna container. Only valid if
--database
is set. --protected
-
Enable protected mode for the database.
Only valid if
--database
is set. --priority <number>
-
User-defined priority for the database. Must be an integer.
Only valid if
--database
is set. --fsl-directory
,--dir
,--directory <string>
-
Path to a local directory containing
.fsl
files for the database. Recursively scans subdirectories. Defaults to the current directory (.
).Only valid if
--database
is set.
Examples
# Start a local Fauna container with
# default name and ports.
fauna local
# Start a container named 'local-fauna'.
fauna local \
--name local-fauna
# Map host port `1234` to container port `6789`.
# Equivalent to `-p 1234:6789` in Docker.
fauna local \
--host-port 1234 \
--container-port 6789
# Start a local Fauna container.
# Create the 'my_db' database in the container.
fauna local \
--database my_db
# Start a local Fauna container.
# Create the 'my_db' database in the container.
# Immediately apply changes to the 'my_db' database's
# active schema.
fauna local \
--database my_db \
--dir /path/to/schema/dir
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!