Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start standalone using spacetime start #91

Closed
wants to merge 149 commits into from
Closed

Conversation

jdetter
Copy link
Collaborator

@jdetter jdetter commented Jul 20, 2023

Description of Changes

  • This enables users to start a new spacetime server instance via: spacetime start
  • standalone is now a default feature for the spacetimedb-cli crate, if this feature is enabled then standalone will be compiled into the cli. If this feature isn't enabled then spacetime start will not work but will substantially speed up the compilation time of the spacetimedb-cli crate.

This command contains all of the options that were previously available in spacetimedb start, plus some options that I've added for convienence. The help section is explicit about its operation:

boppy@boppy-macbook SpacetimeDB % cargo run -- start --help
Starts a standalone SpacetimeDB instance. This command recognizes the following environment variables: 
	SPACETIMEDB_LOG_CONFIG: The path to the log configuration file. 
	SPACETIMEDB_LOGS_PATH: The path to the directory that should contain logs for SpacetimeDB. 
	STDB_PATH: The path to the directory that should contain the database files for SpacetimeDB. 
	SPACETIMEDB_JWT_PUB_KEY: The path to the public jwt key for verifying identities. 
	SPACETIMEDB_JWT_PRIV_KEY: The path to the private jwt key for issuing identities. 
	SPACETIMEDB_TRACY: Set to 1 to enable Tracy profiling.

Warning: If you set a value on the command line, it will override the value set in the environment variable.

Usage: spacetime start [OPTIONS] [database_path]

Arguments:
  [database_path]  The path to the directory that should contain the database files for SpacetimeDB (STDB_PATH) [default: /Users/boppy/.spacetime/stdb]

Options:
  -l, --listen-addr <listen_addr>
          The address and port where SpacetimeDB should listen for connections. [default: 127.0.0.1:3000]
      --log-conf-path <log_conf_path>
          The path of the file that contains the log configuration for SpacetimeDB (SPACETIMEDB_LOG_CONFIG) [default: /Users/boppy/.spacetime/log.conf]
      --log-dir-path <log_dir_path>
          The path to the directory that should contain logs for SpacetimeDB (SPACETIMEDB_LOGS_PATH) [default: /Users/boppy/.spacetime]
      --allow-create
          Allows for the creation of files and directories that don't exist
      --enable-tracy
          Enable Tracy profiling (SPACETIMEDB_TRACY)
      --jwt-pub-key-path <jwt_pub_key_path>
          The path to the public jwt key for verifying identities (SPACETIMEDB_JWT_PUB_KEY) [default: /Users/boppy/.spacetime/id_ecdsa.pub]
      --jwt-priv-key-path <jwt_priv_key_path>
          The path to the private jwt key for issuing identities (SPACETIMEDB_JWT_PRIV_KEY) [default: /Users/boppy/.spacetime/id_ecdsa]
  -h, --help
          Print help

Run `spacetime help start` for more information.

You can start a new instance of spacetimedb with just:

spacetime start --allow-create

Internally our developers may find it useful to create another database via:

spacetime start --allow-create "~/.spacetime/another_database"

API

  • This is a breaking change to the module API
  • This is a breaking change to the ClientAPI
  • This is a breaking change to the SDK API

If the API is breaking, please state below what will break

cloutiertyler and others added 30 commits June 18, 2023 22:19
* test

* Fixed CI

* Fixed tests

* Fixed formatting

* Fixed test error by removing chrono default features

* Rename smoketests CI thing

* Hopefully fix the testing issue

* Fix typos

* Fixed install git-hooks

* Fixed formatting

* Fixed compile error

* fixed testing issues
Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com>
* Clippy runs on default module

* Fix clippy issue with default module

---------

Co-authored-by: Boppy <no-reply@boppygames.gg>
* I think somehow we are adding all tables as orphans, added log

* Removed unneeded clone

---------

Co-authored-by: Boppy <no-reply@boppygames.gg>
)

* Fix bug for subcription that was not executing or returning if empty

* Clippy

* Filter out deleted rows

* Recover the op_type (DELETED, INSERTED) flag for the row in the subscription
* grandfathered docs improvements in bindings

* improve bindings

* address review comments

* remove late bound lifetime

* undo derive for Timestamp to bisect bug
* Forbid unsupported syntax in SELECT (like ORDER BY) & improve accuracy of sql test suite

* Update crates/sqltest/src/main.rs

Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>

---------

Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>
Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com>
Co-authored-by: Boppy <no-reply@boppygames.gg>
* Working on improving commands that use identities

* Fix lints

* Reverted file that shouldn't have changed

* Found and fixed all other todos

* Addressed more CLI TODOs

* Fixes for formatting issues

* Set names of identities

* Set name of identities + clippy

* Small fix

* Added the start of a doc comment, switching over to another PR

* Fixed tests that needed to be updated

* Addressed more feedback and fixed several clippy issues

* Small fix

* Apply suggestions from code review

Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com>

* Added more doc comments

* Addressing more feedback

* Fixed really old bug in SpacetimeDB

* Tests to verify new functionality

* Fix clippy lints

* Email during identity creation is optional

* Fix output so testsuite passes

---------

Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com>
Co-authored-by: Boppy <no-reply@boppygames.gg>
Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
* Some work

* Getting smoketests working on mac

* All tests are passing except known failing tests

---------

Co-authored-by: Boppy <no-reply@boppygames.gg>
…urn wether or not reducer has subscribers; Moved all ReducerEvent and ReducerArgs code into a single file (#10)

Co-authored-by: Steve <steve@codefics.com>
Co-authored-by: Boppy <no-reply@boppygames.gg>
* Changed C# reducer signature; Change reducer invocation method to return wether or not reducer has subscribers; Moved all ReducerEvent and ReducerArgs code into a single file

* Formatting, tests

* Clippy

* Removed union from C# codegen

* Tests

* Update crates/cli/src/subcommands/generate/csharp.rs

Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com>

* Removed duplicate code

* Lint

* Clippy

* CLIPPY

* Generating custom indexes for unique / primary keys

---------

Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com>
Co-authored-by: Steve <steve@codefics.com>
Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
* Fix incomplete transaction bug

* Clippy
Co-authored-by: Steve <steve@codefics.com>
tokio runtimes cannot be nested, so we only create one if no ambient
context can be found and pass around a runtime handle for spawning
tasks.
* integrate jdetter's review

* address phoebe's comments

* improve errnos naming
Prior to this commit, callbacks in the Rust client SDK shared access to the global
ClientCache while running asynchronously. This meant that a long-running or delayed
callback could observe the ClientCache in a state later than the one that caused the
callback's invocation, and had no way to access the specific state for which it was
invoked.

With this commit, each `Invoke` message to the callback worker includes an
`Arc<ClientCache>` snapshot of the DB state when that callback was invoked. The callback
worker stores that state in a `thread_local`, and methods that inspect
tables (e.g. `TableType::iter`) read the state out of the `thread_local` when it is
present. This allows callbacks to observe exactly the state which caused their invocation,
never a later state, while maintaining the C#-like API where `ClientCache` access is based
on free functions or static trait methods.

---------

Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
* Fix bug and added a test

* Test updates

* Fix tests

---------

Co-authored-by: Boppy <no-reply@boppygames.gg>
cloutiertyler and others added 20 commits July 29, 2023 18:02
spacetimedb.com/spacetimedb

Co-authored-by: Boppy <no-reply@boppygames.gg>
This commit renames the first argument to connect from host to spacetimedb_uri. It's not just a host(name), it's the URI of the SpacetimeDB instance.
* Fix bug in locating fields when a JOIN clause is present

* Update crates/lib/src/relation.rs

Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>

* Update crates/lib/src/relation.rs

Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>

* Update crates/core/src/subscription/subscription.rs

Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>

* Update crates/core/src/subscription/subscription.rs

Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>

* Update crates/core/src/subscription/subscription.rs

Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>

* Update crates/core/src/subscription/query.rs

Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>

* Small doc nits

* Fix test

---------

Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>
Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
This commit adds the `quickstart-chat` Rust module and client to the appropriate examples dirs.
* Refactoring some stuff for energy

* Fix an issue with i128 query params

* Infinite budget in Standalone

* Energy and crash fixes

* Hopefully fixed the test that now has energy

* Addresses Centril's comments

* Cargo fmt

---------

Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Committing suggested changes (comments only for now)

Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com>
Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: Derek Brinkmann <dbrinkmann@citadelstudios.net>
Copy link
Contributor

@cloutiertyler cloutiertyler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dbrinkmanncw
Copy link
Contributor

I've tested this with the changes and it no longer requires the $HOME env variable

@jdetter jdetter mentioned this pull request Aug 2, 2023
3 tasks
@cloutiertyler cloutiertyler deleted the jdetter/spacetime-start branch August 2, 2023 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.