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

Prune some log traces from examples #966

Merged
merged 3 commits into from
Oct 24, 2024
Merged
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
4 changes: 2 additions & 2 deletions src/content/doc-surrealdb/cli/start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,10 @@ An instance with a single root user, able to connect to the internet but unable
surreal start --user root --pass root --allow-net --deny-funcs "crypto::md5, http::post, http::delete"
```

An instance with extra verbose logging that uses RocksDB as its storage engine:
An instance with more verbose logging that uses RocksDB as its storage engine:

```bash
surreal start --log trace rocksdb:mydatabase.db
surreal start --log debug rocksdb:mydatabase.db
```

An instance with all capabilities denied except a few functions and a single endpoint:
Expand Down
8 changes: 4 additions & 4 deletions src/content/doc-surrealdb/installation/running/docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ mkdir mydata # Create a directory to store the database, owned by the current us
docker run --rm --pull always -p 8000:8000 --user $(id -u) -v $(pwd)/mydata:/mydata surrealdb/surrealdb:latest start rocksdb:/mydata/mydatabase.db
```

The default logging level for the database server is `info`, resulting in any informational logs to be output to the standard output. To control the logging verbosity, specify the *`--log`* argument. The following command starts the database with `trace` level logging, resulting in most logs being output to the terminal.
The default logging level for the database server is `info`, resulting in any informational logs to be output to the standard output. To control the logging verbosity, specify the *`--log`* argument. The following command starts the database with `debug` level logging, resulting in more logs being output to the terminal. If extra verbosity is not needed, specify a lower level or simply remove the flag, which will default to the `info` level.

```bash
mkdir mydata # Create a directory to store the database, owned by the current user
docker run --rm --pull always -p 8000:8000 --user $(id -u) -v $(pwd)/mydata:/mydata surrealdb/surrealdb:latest start --log trace rocksdb:/mydata/mydatabase.db
docker run --rm --pull always -p 8000:8000 --user $(id -u) -v $(pwd)/mydata:/mydata surrealdb/surrealdb:latest start --log debug rocksdb:/mydata/mydatabase.db
```

### Configuring authentication
Expand All @@ -57,13 +57,13 @@ To set up access as an authenticated user, configure your initial root-level use
The following command starts the database with a top-level user named `root` with a password also set to `root`. The root user will be persisted in storage, which means you don't have to include the command line arguments next time you start SurrealDB.

```bash
docker run --rm --pull always -p 80:8000 -v /mydata:/mydata surrealdb/surrealdb:latest start --log trace --user root --pass root rocksdb:mydatabase.db
docker run --rm --pull always -p 80:8000 -v /mydata:/mydata surrealdb/surrealdb:latest start --user root --pass root rocksdb:mydatabase.db
```

In order to change the default port that SurrealDB uses for web connections and from database clients you can use the Docker *`-p`* command line argument to tunnel the port to the internal SurrealDB port which SurrealDB is served on. The following command starts the database on port `80`.

```bash
docker run --rm --pull always -p 80:8000 -v /mydata:/mydata surrealdb/surrealdb:latest start --log trace --user root --pass root rocksdb:/mydata/mydatabase.db
docker run --rm --pull always -p 80:8000 -v /mydata:/mydata surrealdb/surrealdb:latest start --user root --pass root rocksdb:/mydata/mydatabase.db
```

After running the above command, you should see the SurrealDB server startup successfully.
Expand Down
10 changes: 5 additions & 5 deletions src/content/doc-surrealdb/installation/running/file.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@ For the purposes of getting started with SurrealDB quickly, we will start a Rock
surreal start rocksdb:mydatabase.db
```

The default logging level for the database server is `info`, resulting in any informational logs to be output to the standard output. To control the logging verbosity, specify the *`--log`* argument. The following command starts the database with `trace` level logging, resulting in most logs being output to the terminal.
The default logging level for the database server is `info`, resulting in any informational logs to be output to the standard output. To control the logging verbosity, specify the *`--log`* argument. The following command starts the database with `debug` level logging, resulting in more logs being output to the terminal. If extra verbosity is not needed, specify a lower level or simply remove the flag, which will default to the `info` level.

```bash
surreal start --log trace rocksdb:mydatabase.db
surreal start --log debug rocksdb:mydatabase.db
```

In versions of SurrealDB before 2.0.0, anyone would be able to connect to this server to begin running queries. However, SurrealDB since version 2.0.0 runs with authentication by default. In order to disable it, the `--unauthenticated` flag can be passed in.

```bash
surreal start --log trace --unauthenticated rocksdb:mydatabase.db
surreal start --unauthenticated rocksdb:mydatabase.db
```

However, for anything but simple testing, it is better to configure your initial root-level user by setting the *`--user`* and *`--pass`* command-line arguments. The following command starts the database with a top-level user named root with a password also set to `root`. The root user will be persisted in storage, which means you don't have to include the command line arguments next time you start SurrealDB.

```bash
surreal start --log trace --user root --pass root rocksdb:mydatabase.db
surreal start --user root --pass root rocksdb:mydatabase.db
```

In order to change the default port that SurrealDB uses for web connections and from database clients you can use the *`--bind`* argument. The following command starts the database on port `8080`.

```bash
surreal start --log trace --user root --pass root --bind 0.0.0.0:8080 rocksdb://path/to/mydatabase
surreal start --user root --pass root --bind 0.0.0.0:8080 rocksdb://path/to/mydatabase
```
After running the above command, you should see the SurrealDB server startup successfully.

Expand Down
12 changes: 6 additions & 6 deletions src/content/doc-surrealdb/installation/running/memory.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,33 @@ SurrealDB will assume `memory` in case this argument is not passed in, so the fo
surreal start
```

The default logging level for the database server is `info`, resulting in any informational logs to be output to the standard output. To control the logging verbosity, specify the *`--log`* argument. The following command starts the database with `trace` level logging, resulting in most logs being output to the terminal.
The default logging level for the database server is `info`, resulting in any informational logs to be output to the standard output. To control the logging verbosity, specify the *`--log`* argument. The following command starts the database with `debug` level logging, resulting in more logs being output to the terminal. If extra verbosity is not needed, specify a lower level or simply remove the flag, which will default to the `info` level.

```bash
surreal start --log trace memory
surreal start --log debug memory
```

In versions of SurrealDB before `2.0`, anyone would be able to connect to this server to begin running queries. However, SurrealDB since version `2.0` runs with authentication by default. In order to disable it, the `--unauthenticated` flag can be passed in.

```bash
surreal start --log trace --unauthenticated memory
surreal start --unauthenticated memory
```

However, for anything but simple testing, it is better to configure your initial root-level user by setting the *`--user`* and *`--pass`* command-line arguments. The following command starts the database with a top-level user named `root` with a password also set to `root`.

```bash
surreal start --log trace --user root --pass root memory
surreal start --user root --pass root memory
```

The previous command will bootstrap the server with the provided initial credentials, you can now remove those args and rely on [DEFINE USER](/docs/surrealql/statements/define/user) to change the password or create more users.

```bash
surreal start --log trace --user username --pass 123456 memory
surreal start --user username --pass 123456 memory
```
In order to change the default port that SurrealDB uses for web connections and from database clients you can use the *`--bind`* argument. The following command starts the database on port `8080`.

```bash
surreal start --log trace --user root --pass root --bind 0.0.0.0:8080 memory
surreal start --user root --pass root --bind 0.0.0.0:8080 memory
```

After running the above command, you should see the SurrealDB server startup successfully.
Expand Down
8 changes: 4 additions & 4 deletions src/content/doc-surrealdb/installation/running/tikv.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ Once TiKV is up and running, we can start a SurrealDB server instance, specifyin
```bash
surreal start tikv://127.0.0.1:2379
```
The default logging level for the database server is `info`, resulting in any informational logs to be output to the standard output. To control the logging verbosity, specify the *`--log`* argument. The following command starts the database with `trace` level logging, resulting in most logs being output to the terminal.
The default logging level for the database server is `info`, resulting in any informational logs to be output to the standard output. To control the logging verbosity, specify the *`--log`* argument. The following command starts the database with `debug` level logging, resulting in more logs being output to the terminal. If extra verbosity is not needed, specify a lower level or simply remove the flag, which will default to the `info` level.

```bash
surreal start --log trace tikv://127.0.0.1:2379
surreal start --log debug tikv://127.0.0.1:2379
```
In order to keep SurrealDB secure, configure your initial root-level user by setting the *`--user`* and *`--pass`* command-line arguments. The following command starts the database with a top-level user named root with a password also set to `root`. The root user will be persisted in storage, which means you don't have to include the command line arguments next time you start SurrealDB.

```bash
surreal start --log trace --user root --pass root tikv://127.0.0.1:2379
surreal start --user root --pass root tikv://127.0.0.1:2379
```
In order to change the default port that SurrealDB uses for web connections and from database clients you can use the *`--bind`* argument. The following command starts the database on port `8080`.

```bash
surreal start --log trace --user root --pass root --bind 0.0.0.0:8080 tikv://placement.driver.hostname.or.ip:2379
surreal start --user root --pass root --bind 0.0.0.0:8080 tikv://placement.driver.hostname.or.ip:2379
```
After running the above command, you should see the SurrealDB server startup successfully.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This guide assumes the following:

```bash
docker run --rm --pull always -p 8000:8000 surrealdb/surrealdb:latest \
start --log trace --user root --pass root
start --user root --pass root
```

To run the SurrealQL statements mentioned in this guide, you will also need an interactive shell.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This guide assumes the following:

```bash
docker run --rm --pull always -p 8000:8000 surrealdb/surrealdb:latest \
start --log trace --user root --pass root
start --user root --pass root
```

To run the SurrealQL statements mentioned in this guide, you will also need an interactive shell.
Expand Down Expand Up @@ -296,7 +296,7 @@ For this guide, we will create a simple client-side web application that will di

We have developed an [example application](https://github.com/surrealdb/examples/tree/main/aws-cognito) that uses plain JavaScript to authenticate with Cognito using basic HTTP requests against the [login endpoint](https://docs.aws.amazon.com/cognito/latest/developerguide/login-endpoint.html) of the Cognito Hosted UI and the Cognito [token endpoint](https://docs.aws.amazon.com/cognito/latest/developerguide/token-endpoint.html). For the purposes of following this guide, we recommend using our example code. However, keep in mind that this code aims to be as simple as possible and is not suitable for production applications. Alternatively, you can develop this application yourself using the [Cognito SDK](https://docs.aws.amazon.com/cognito/latest/developerguide/service_code_examples_cognito-identity-provider.html) or the new [Amplify SDK](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-integrate-apps.html#cognito-integrate-apps-amplify).

When using our example code, you will only need to update the `config.json` file with the values that you saved after creating your user pool and run the web application using the `start.sh` script or any equivalent web server. Once in the web application, clicking the "Log in" button should take you to the Cognito Hosted UI to log in with your test user, after which you should be redirected back to your web application. For this to work, the URL of your web application (without a trailing slash) should be present in the "Allowed callback URLs" list that you defined when configuring the user pool client. After redirection, the web application will show some information about the authenticated user and attempt to create it in SurrealDB via the configured endpoint. After the user is created, subsequent logins will retrieve its information from SurrealDB and display it in the web application. If that is not the case, use the developer console of your browser together with the SurrealDB logs (ideally running with `--log trace`) to understand why.
When using our example code, you will only need to update the `config.json` file with the values that you saved after creating your user pool and run the web application using the `start.sh` script or any equivalent web server. Once in the web application, clicking the "Log in" button should take you to the Cognito Hosted UI to log in with your test user, after which you should be redirected back to your web application. For this to work, the URL of your web application (without a trailing slash) should be present in the "Allowed callback URLs" list that you defined when configuring the user pool client. After redirection, the web application will show some information about the authenticated user and attempt to create it in SurrealDB via the configured endpoint. After the user is created, subsequent logins will retrieve its information from SurrealDB and display it in the web application. If that is not the case, use the developer console of your browser together with the SurrealDB logs (running with `--log trace` during the debugging for maximum verbosity) to understand why.

Once the example web application is working, you can inspect the simple code under `app.js` to understand how.

Expand Down