Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 40 additions & 31 deletions docs/intro/projects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,25 @@ and connect to its linked instance with no additional configuration.
Initializing
^^^^^^^^^^^^

To initialize a project, create a new directory and run :gelcmd:`project init`
inside it. You'll see something like this:
To initialize a project, create a new directory and run :gelcmd:`project init` inside it. You'll see something like this:

.. code-block:: bash

$ gel project init
No `gel.toml` found in this repo or above.
Do you want to initialize a new project? [Y/n]
> Y
Specify the name of Gel instance to use with this project
[default: my_instance]:
> my_instance
No `gel.toml` (or `edgedb.toml`) found in `/projects/my_instance` or above
Initializing new project...
Checking Gel versions...
Specify the version of Gel to use with this project [default: x.x]:
> # (left blank for default)
...
Successfully installed x.x+cc4f3b5
Initializing Gel instance...
┌─────────────────────┬────────────────────────────────┐
│ Project directory │ /projects/my_instance │
│ Project config │ /projects/my_instance/gel.toml │
│ Schema dir (empty) │ /projects/my_instance/dbschema │
│ Installation method │ portable package │
│ Version │ x.x+xxxxxxx │
│ Instance name │ my_instance │
│ Branch │ main │
└─────────────────────┴────────────────────────────────┘
Version x.x+xxxxxxx is already downloaded
Initializing Gel instance 'my_instance'...
Applying migrations...
Everything is up to date. Revision initial
Project initialized.
Expand All @@ -78,7 +79,7 @@ This command does a couple important things.
.. code-block:: toml

[instance]
server-version = "6.0"
server-version = "6.9"

3. If no ``dbschema`` directory exists, it will be created, along with an
empty :dotgel:`default` file which will contain your schema. If a
Expand Down Expand Up @@ -108,7 +109,15 @@ executed against the project-linked instance. For instance, you can simply run
.. code-block:: bash

$ gel
Gel x.x+cc4f3b5 (repl x.x+da2788e)
▄██▄
▄▄▄▄▄ ▄▄▄ ████
▄███████▄ ▄███████▄ ████
▀███████▀ ▀███▀▀▀▀▀ ████
▀▀▀▀▀ ▀▀▀ ▀▀
▀▄▄▄▄▄▀
▀▀▀

Gel x.x+xxxxxxx (repl x.x+xxxxxxx)
Type \help for help, \quit to quit.
my_instance:main> select "Hello world!";

Expand All @@ -124,7 +133,15 @@ with the ``-I`` flag.
Hint: Run `gel project init` or use any of `-H`, `-P`, `-I` arguments to
specify connection parameters. See `--help` for details
$ gel -I my_instance
Gel x.x+cc4f3b5 (repl x.x+da2788e)
▄██▄
▄▄▄▄▄ ▄▄▄ ████
▄███████▄ ▄███████▄ ████
▀███████▀ ▀███▀▀▀▀▀ ████
▀▀▀▀▀ ▀▀▀ ▀▀
▀▄▄▄▄▄▀
▀▀▀

Gel x.x+xxxxxxx (repl x.x+xxxxxxx)
Type \help for help, \quit to quit.
my_instance:main>

Expand All @@ -134,12 +151,7 @@ linked instance without additional configuration.
Using remote instances
^^^^^^^^^^^^^^^^^^^^^^

You may want to initialize a project that points to a remote Gel instance.
This is totally a valid case and Gel fully supports it! Before running
:gelcmd:`project init`, you just need to create an alias for the remote
instance using :gelcmd:`instance link`, like so:

.. lint-off
If you want to initialize a project that points to an existing remote Gel instance, first create an alias for the remote instance using :gelcmd:`instance link`, like so:

.. code-block:: bash

Expand All @@ -161,20 +173,17 @@ instance using :gelcmd:`instance link`, like so:
Successfully linked to remote instance. To connect run:
gel -I staging_db

.. lint-on
After receiving the necessary connection information, this command links the remote instance to a local alias ``"staging_db"``. You can now use this as instance name in CLI commands including in :gelcmd:`project init`. To set this linked remote instance as your project instance, you can use the new name in the interactive mode:

After receiving the necessary connection information, this command links the
remote instance to a local alias ``"staging_db"``. You can use this as
instance name in CLI commands.
.. code-block:: bash

.. code-block::
$ gel project init --interactive

$ gel -I staging_db
gel>
or via the ``--server-instance`` command line option:

To initialize a project that uses the remote instance, provide this alias when
prompted for an instance name during the :gelcmd:`project init` workflow.
.. code-block:: bash

$ gel project init --server-instance staging_db

Unlinking
^^^^^^^^^
Expand Down
32 changes: 22 additions & 10 deletions docs/reference/using/cli/gel_project/gel_project_init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,19 @@ Setup a new project.
Description
===========

This command sets up a new project, creating an instance, a schema directory,
and an :ref:`gel.toml <ref_reference_gel_toml>` file. It can also be used
to convert an existing directory to a project directory, connecting the
existing instance to the project. Typically this tool will prompt for specific
details about how the project should be setup.
A "project" is:

- A set of files, notably |gel.toml|, the schema directory, and any migrations.
- A running Gel server instance, either a local, Gel Cloud, or remote instance.
- A set of credentials that link together this particular directory on your
local machine, to a Gel server instance.

This :gelcmd:`project init` command will:

- **A directory with no |gel.toml|**: Create a new instance, or link to an existing
one, create the |gel.toml|, create a schema directory, and run any migrations.
- **A directory with |gel.toml|**: Create a new instance, or link to an existing one,
and run any migrations.


Gel Cloud
Expand All @@ -31,8 +39,8 @@ logging in using :ref:`ref_cli_gel_cloud_login`.
To create a Cloud instance, your instance name should be in the format
``<org-name>/<instance-name>``. Cloud instance names may contain alphanumeric
characters and hyphens (i.e., ``-``). You can provide this Cloud instance name
through the interactive project initiation by running :gelcmd:`project init`
or by providing it via the ``--server-instance`` option.
through the interactive project initiation by providing the ``--interactive``
option or by providing it via the ``--server-instance`` option.

.. note::

Expand Down Expand Up @@ -65,8 +73,13 @@ Options
with existing data.
2. To initialize a new instance but then restore dump to it.

:cli:synopsis:`--interactive`
Present the caller with a list of questions to configure the project
instance, such as the instance name, server version, and default branch

:cli:synopsis:`--non-interactive`
Run in non-interactive mode (accepting all defaults).
Run in non-interactive mode (accepting all defaults). This is the default
behavior, so you do not need to normally specify this.

:cli:synopsis:`--project-dir=<project-dir>`
The project directory can be specified explicitly. Defaults to the
Expand All @@ -77,8 +90,7 @@ Options
project.

:cli:synopsis:`--server-version=<server-version>`
Specifies the Gel server instance to be associated with the
project.
Specifies the Gel server instance to be associated with the project.

By default, when you specify a version, the CLI will use the latest release
in the major version specified. This command, for example, will install the
Expand Down