From 9ae403d6950a9b8c9e522b5e116be0b827b4b3dc Mon Sep 17 00:00:00 2001 From: bitfalt <75431447+bitfalt@users.noreply.github.com> Date: Sun, 25 Aug 2024 17:37:22 -0600 Subject: [PATCH 01/15] README.md draft with instructions --- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..38205af2 --- /dev/null +++ b/README.md @@ -0,0 +1,66 @@ +# API Starknet Quest + +API for Starknet Quest Client project built in Rust + +## About + +API Starknet Quest provides the backend infrastructure for Starnet Quest Client an app which helps protocs attract and retain users by creating gamified quests experiences on Starknet. + +## Prerequisites + +### Install Rust + +To run the project without issues you need to have a Rust version >= 1.73.0. To check your rust version run the following command in a terminal. + +```bash +rustc --version +``` +If you don't have Rust installed, please go to the [Rust installation page](https://doc.rust-lang.org/book/ch01-01-installation.html) for further instructions. + +### Install Git + +Go to the [Git installation page](https://git-scm.com/downloads) and follow the instructions for your operating system to install Git. + +### Install Docker + +To run the database a Docker container is necessary, you need to have Docker engine version >= 1.13.0. To check your Docker engine version run the following command in a terminal. + +```bash +docker --version +``` +If you don't have Docker installed, please go to the [Docker installation page](https://docs.docker.com/get-started/get-docker/) for further instructions. + +## Installaction Instructions + +Fork the repository and clone the forked repository to your local system + +```bash +git clone https://github.com//api.starknet.quest.git +``` + +## Build instructions + +To build the project use the following command in a terminal + +```bash +cargo build +``` + +The command above will run `cargo build` with the `--debug` flag, which compiles faster, includes debug symbols for easier debugging. However it produces a larger binary, for development purposes the command above is fine. + +If you wish to create an optimized binary without debug information run the following command in a terminal + +```bash +cargo build --release +``` + +## Running the project + +1. Deploy `db-docker-compose.yml` file to use MongoDB database +2. Create `config.toml` file using the `config.template.toml` file +3. Replace `connection_string` in `config.toml` with the proper connection string to the MongoDB database, if default credentials in `db-docker-compose.yml` file are used the connection string is: mongodb://quests:password@localhost:27017 +4. Starknet RPC_URL -> can be from lava or alchemy +5. Starkscan API KEY create one + +once the config.toml file is done, use cargo run to start testing + From a0ec82ea6255fb1fb815cd2b29291783bdb6baae Mon Sep 17 00:00:00 2001 From: bitfalt <75431447+bitfalt@users.noreply.github.com> Date: Sun, 25 Aug 2024 17:49:30 -0600 Subject: [PATCH 02/15] fix: typo in About section --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 38205af2..272cb109 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ API for Starknet Quest Client project built in Rust ## About -API Starknet Quest provides the backend infrastructure for Starnet Quest Client an app which helps protocs attract and retain users by creating gamified quests experiences on Starknet. +API Starknet Quest provides the backend infrastructure for Starknet Quest Client, an app which helps protocols attract and retain users by creating gamified quests experiences on Starknet. ## Prerequisites From b7bff81ddbab68eb0b342260e50e68bd198b3fce Mon Sep 17 00:00:00 2001 From: bitfalt <75431447+bitfalt@users.noreply.github.com> Date: Mon, 26 Aug 2024 23:35:08 -0600 Subject: [PATCH 03/15] Finish Running the Project section --- README.md | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 272cb109..c5ee1119 100644 --- a/README.md +++ b/README.md @@ -56,11 +56,38 @@ cargo build --release ## Running the project +To run the project successfully you'll need to do the following steps: 1. Deploy `db-docker-compose.yml` file to use MongoDB database +Once inside the directory of the project, you need to run the following command: +```bash +docker-compose -f db-docker-compose.yml up -d +``` +The command above will create a container running the MongoDB database, however the information you add to the database isn't persistent, you'll need to modify the db-docker-compose.yml file to include a volume. For more information regarding Docker-compose files and volumes go the this [page](https://docs.docker.com/engine/storage/volumes/). + 2. Create `config.toml` file using the `config.template.toml` file -3. Replace `connection_string` in `config.toml` with the proper connection string to the MongoDB database, if default credentials in `db-docker-compose.yml` file are used the connection string is: mongodb://quests:password@localhost:27017 -4. Starknet RPC_URL -> can be from lava or alchemy -5. Starkscan API KEY create one +To run the project successfully you need to create a `config.toml` file using the `config.template.toml` file. You can copy the file and modify the following fields accordingly: + +- connection_string, if the `db-docker-compose.yml` isn't changed the connection string would be: mongodb://quests:password@localhost:27017 +- secret_key, this is the secret used for the JWT token. You can change it or leave as is. +- expiry_duration, this is the expiry duration of the JWT token. You should change it according to your needs the time is stored in miliseconds. +- rpc_url, this is to interact with the blockchain you can use a public RPC such as [Lava](https://www.lavanet.xyz/get-started/starknet) or a private node provider such as [Alchemy](https://www.alchemy.com) or [Infura](https://www.infura.io) + +3. Run the project +Once the `config.toml` file is created properly, you're going to be able to run the project using the following command + +```bash +cargo run +``` +If you've setup everything correctly, you should see the following output + +```bash + Finished `dev` profile [unoptimized + debuginfo] target(s) in 59.57s + Running `target/debug/quest_server` +quest_server: starting v0.1.0 +database: connected +server: listening on http://0.0.0.0:8080 +``` +Otherwise refer the to the Troubleshooting guide below. -once the config.toml file is done, use cargo run to start testing +## Troubleshooting From 1b462a9d5b360bd671e0bef19e9a6e8979cca8f0 Mon Sep 17 00:00:00 2001 From: bitfalt <75431447+bitfalt@users.noreply.github.com> Date: Mon, 26 Aug 2024 23:37:20 -0600 Subject: [PATCH 04/15] fix typos --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c5ee1119..a8bf06e0 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ docker --version ``` If you don't have Docker installed, please go to the [Docker installation page](https://docs.docker.com/get-started/get-docker/) for further instructions. -## Installaction Instructions +## Installation Instructions Fork the repository and clone the forked repository to your local system @@ -38,7 +38,7 @@ Fork the repository and clone the forked repository to your local system git clone https://github.com//api.starknet.quest.git ``` -## Build instructions +## Build Instructions To build the project use the following command in a terminal @@ -54,7 +54,7 @@ If you wish to create an optimized binary without debug information run the foll cargo build --release ``` -## Running the project +## Running the Project To run the project successfully you'll need to do the following steps: 1. Deploy `db-docker-compose.yml` file to use MongoDB database From d5cc858d0b2fc112a0367ae1cfd047a7ba53c03d Mon Sep 17 00:00:00 2001 From: bitfalt <75431447+bitfalt@users.noreply.github.com> Date: Tue, 27 Aug 2024 01:00:07 -0600 Subject: [PATCH 05/15] add initial Troubleshooting section --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a8bf06e0..9033465d 100644 --- a/README.md +++ b/README.md @@ -67,10 +67,10 @@ The command above will create a container running the MongoDB database, however 2. Create `config.toml` file using the `config.template.toml` file To run the project successfully you need to create a `config.toml` file using the `config.template.toml` file. You can copy the file and modify the following fields accordingly: -- connection_string, if the `db-docker-compose.yml` isn't changed the connection string would be: mongodb://quests:password@localhost:27017 -- secret_key, this is the secret used for the JWT token. You can change it or leave as is. -- expiry_duration, this is the expiry duration of the JWT token. You should change it according to your needs the time is stored in miliseconds. -- rpc_url, this is to interact with the blockchain you can use a public RPC such as [Lava](https://www.lavanet.xyz/get-started/starknet) or a private node provider such as [Alchemy](https://www.alchemy.com) or [Infura](https://www.infura.io) +- `connection_string`, this is the string to connect to the database. If the `db-docker-compose.yml` isn't changed the connection string would be: mongodb://quests:password@localhost:27017 +- `secret_key`, this is the secret used for the JWT token. You can change it or leave as is. +- `expiry_duration`, this is the expiry duration of the JWT token. You should change it according to your needs the time is stored in miliseconds. +- `rpc_url`, this is to interact with the blockchain you can use a public RPC such as [Lava](https://www.lavanet.xyz/get-started/starknet) or a private node provider such as [Alchemy](https://www.alchemy.com) or [Infura](https://www.infura.io) 3. Run the project Once the `config.toml` file is created properly, you're going to be able to run the project using the following command @@ -91,3 +91,48 @@ Otherwise refer the to the Troubleshooting guide below. ## Troubleshooting +If your expected output doesn't includes the following text: +```bash +database: connected +server: listening on http://0.0.0.0:8080 +``` +This means you didn't run the Docker container which runs the database. To fix this, you'll need to run the Docker container with the command mentioned in the first step of the section Running the Project. + +If you get the following output: + +```bash + Finished `dev` profile [unoptimized + debuginfo] target(s) in 59.57s + Running `target/debug/quest_server` +quest_server: starting v0.1.0 +thread 'main' panicked at src/config.rs:212:9: +error: unable to read file with path "config.toml" +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +``` + +This means you didn't create the `config.toml` file. To fix this, you'll need to create the `config.toml` file with the steps mentioned in the second step of the section Running the Project. + +If you get the following output: + +```bash + Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.55s + Running `target/debug/quest_server` +quest_server: starting v0.1.0 +thread 'main' panicked at src/main.rs:34:49: +called `Result::unwrap()` on an `Err` value: RelativeUrlWithoutBase +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +``` + +This means you didn't add the `rpc_url` in the `config.toml` file. To fix this, you'll need to add the `rpc_url` to the `config.toml` file. Please refer the second step of the section Running the Project for further instructions on how to add the `rpc_url`. + +If you get the following output: + +```bash + Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.49s + Running `target/debug/quest_server` +quest_server: starting v0.1.0 +thread 'main' panicked at src/main.rs:29:10: +called `Result::unwrap()` on an `Err` value: Error { kind: InvalidArgument { message: "connection string contains no scheme" }, labels: {}, wire_version: None, source: None } +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +``` + +This means you didn't add the `connection_string` in the `config.toml` file. To fix this, you'll need to add the `connection_string` to the `config.toml` file. Please refer to the second step of the section Running the Project for further instructions on how to add the `connection_string`. \ No newline at end of file From 09bcfdcea9f10e5671ecb35c2a92894bd1155862 Mon Sep 17 00:00:00 2001 From: bitfalt <75431447+bitfalt@users.noreply.github.com> Date: Tue, 27 Aug 2024 02:31:01 -0600 Subject: [PATCH 06/15] fix punctuation marks and formatting --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9033465d..6c676c61 100644 --- a/README.md +++ b/README.md @@ -57,22 +57,22 @@ cargo build --release ## Running the Project To run the project successfully you'll need to do the following steps: -1. Deploy `db-docker-compose.yml` file to use MongoDB database +1. Deploy `db-docker-compose.yml` file to use MongoDB database. Once inside the directory of the project, you need to run the following command: ```bash docker-compose -f db-docker-compose.yml up -d ``` The command above will create a container running the MongoDB database, however the information you add to the database isn't persistent, you'll need to modify the db-docker-compose.yml file to include a volume. For more information regarding Docker-compose files and volumes go the this [page](https://docs.docker.com/engine/storage/volumes/). -2. Create `config.toml` file using the `config.template.toml` file +2. Create `config.toml` file using the `config.template.toml` file. To run the project successfully you need to create a `config.toml` file using the `config.template.toml` file. You can copy the file and modify the following fields accordingly: -- `connection_string`, this is the string to connect to the database. If the `db-docker-compose.yml` isn't changed the connection string would be: mongodb://quests:password@localhost:27017 +- `connection_string`, this is the string to connect to the database. If the `db-docker-compose.yml` isn't changed the connection string would be: `mongodb://quests:password@localhost:27017` - `secret_key`, this is the secret used for the JWT token. You can change it or leave as is. - `expiry_duration`, this is the expiry duration of the JWT token. You should change it according to your needs the time is stored in miliseconds. - `rpc_url`, this is to interact with the blockchain you can use a public RPC such as [Lava](https://www.lavanet.xyz/get-started/starknet) or a private node provider such as [Alchemy](https://www.alchemy.com) or [Infura](https://www.infura.io) -3. Run the project +3. Run the project. Once the `config.toml` file is created properly, you're going to be able to run the project using the following command ```bash From b1faa748ef228f32b433f6535f4b37aee2387e51 Mon Sep 17 00:00:00 2001 From: bitfalt <75431447+bitfalt@users.noreply.github.com> Date: Tue, 27 Aug 2024 16:43:14 -0600 Subject: [PATCH 07/15] finish Troubleshooting section tested README steps successfully on both Mac and Windows computers. --- README.md | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6c676c61..56acdb99 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,9 @@ quest_server: starting v0.1.0 database: connected server: listening on http://0.0.0.0:8080 ``` -Otherwise refer the to the Troubleshooting guide below. +If you have a different output, refer the to the Troubleshooting guide below. + +If you wish to test admin endpoints, you need to add the admin manually to the database. ## Troubleshooting @@ -135,4 +137,24 @@ called `Result::unwrap()` on an `Err` value: Error { kind: InvalidArgument { mes note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` -This means you didn't add the `connection_string` in the `config.toml` file. To fix this, you'll need to add the `connection_string` to the `config.toml` file. Please refer to the second step of the section Running the Project for further instructions on how to add the `connection_string`. \ No newline at end of file +This means you didn't add the `connection_string` in the `config.toml` file. To fix this, you'll need to add the `connection_string` to the `config.toml` file. Please refer to the second step of the section Running the Project for further instructions on how to add the `connection_string`. + +If you get the following output: + +```bash + Finished `dev` profile [unoptimized + debuginfo] target(s) in 5.41s + Running `target\debug\quest_server.exe` +quest_server: starting v0.1.0 +thread 'main' panicked at src\config.rs:218:13: +error: unable to deserialize config. newline in string found at line 6 column 63 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +error: process didn't exit successfully: `target\debug\quest_server.exe` (exit code: 101) +``` + +This means you probably forgot the following character in the `config.toml` file: ". To fix this, you'll need to check that the fields you modified while creating the `config.toml` file have their opening and closing character. As an example, it should look like this: + +`connection_string = "mongodb://quests:password@localhost:27017"` + +and NOT like this + +`connection_string = "mongodb://quests:password@localhost:27017` \ No newline at end of file From 52e87c48f55b115fd165ea60b47ad9a3ebb78a3c Mon Sep 17 00:00:00 2001 From: bitfalt <75431447+bitfalt@users.noreply.github.com> Date: Sun, 25 Aug 2024 17:37:22 -0600 Subject: [PATCH 08/15] README.md draft with instructions --- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..38205af2 --- /dev/null +++ b/README.md @@ -0,0 +1,66 @@ +# API Starknet Quest + +API for Starknet Quest Client project built in Rust + +## About + +API Starknet Quest provides the backend infrastructure for Starnet Quest Client an app which helps protocs attract and retain users by creating gamified quests experiences on Starknet. + +## Prerequisites + +### Install Rust + +To run the project without issues you need to have a Rust version >= 1.73.0. To check your rust version run the following command in a terminal. + +```bash +rustc --version +``` +If you don't have Rust installed, please go to the [Rust installation page](https://doc.rust-lang.org/book/ch01-01-installation.html) for further instructions. + +### Install Git + +Go to the [Git installation page](https://git-scm.com/downloads) and follow the instructions for your operating system to install Git. + +### Install Docker + +To run the database a Docker container is necessary, you need to have Docker engine version >= 1.13.0. To check your Docker engine version run the following command in a terminal. + +```bash +docker --version +``` +If you don't have Docker installed, please go to the [Docker installation page](https://docs.docker.com/get-started/get-docker/) for further instructions. + +## Installaction Instructions + +Fork the repository and clone the forked repository to your local system + +```bash +git clone https://github.com//api.starknet.quest.git +``` + +## Build instructions + +To build the project use the following command in a terminal + +```bash +cargo build +``` + +The command above will run `cargo build` with the `--debug` flag, which compiles faster, includes debug symbols for easier debugging. However it produces a larger binary, for development purposes the command above is fine. + +If you wish to create an optimized binary without debug information run the following command in a terminal + +```bash +cargo build --release +``` + +## Running the project + +1. Deploy `db-docker-compose.yml` file to use MongoDB database +2. Create `config.toml` file using the `config.template.toml` file +3. Replace `connection_string` in `config.toml` with the proper connection string to the MongoDB database, if default credentials in `db-docker-compose.yml` file are used the connection string is: mongodb://quests:password@localhost:27017 +4. Starknet RPC_URL -> can be from lava or alchemy +5. Starkscan API KEY create one + +once the config.toml file is done, use cargo run to start testing + From d8e6e0c015618237798d658186a6de615495baa9 Mon Sep 17 00:00:00 2001 From: bitfalt <75431447+bitfalt@users.noreply.github.com> Date: Sun, 25 Aug 2024 17:49:30 -0600 Subject: [PATCH 09/15] fix: typo in About section --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 38205af2..272cb109 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ API for Starknet Quest Client project built in Rust ## About -API Starknet Quest provides the backend infrastructure for Starnet Quest Client an app which helps protocs attract and retain users by creating gamified quests experiences on Starknet. +API Starknet Quest provides the backend infrastructure for Starknet Quest Client, an app which helps protocols attract and retain users by creating gamified quests experiences on Starknet. ## Prerequisites From b7dc1a2e8776448ace6fe3f7f98e24dc075a64b8 Mon Sep 17 00:00:00 2001 From: bitfalt <75431447+bitfalt@users.noreply.github.com> Date: Mon, 26 Aug 2024 23:35:08 -0600 Subject: [PATCH 10/15] Finish Running the Project section --- README.md | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 272cb109..c5ee1119 100644 --- a/README.md +++ b/README.md @@ -56,11 +56,38 @@ cargo build --release ## Running the project +To run the project successfully you'll need to do the following steps: 1. Deploy `db-docker-compose.yml` file to use MongoDB database +Once inside the directory of the project, you need to run the following command: +```bash +docker-compose -f db-docker-compose.yml up -d +``` +The command above will create a container running the MongoDB database, however the information you add to the database isn't persistent, you'll need to modify the db-docker-compose.yml file to include a volume. For more information regarding Docker-compose files and volumes go the this [page](https://docs.docker.com/engine/storage/volumes/). + 2. Create `config.toml` file using the `config.template.toml` file -3. Replace `connection_string` in `config.toml` with the proper connection string to the MongoDB database, if default credentials in `db-docker-compose.yml` file are used the connection string is: mongodb://quests:password@localhost:27017 -4. Starknet RPC_URL -> can be from lava or alchemy -5. Starkscan API KEY create one +To run the project successfully you need to create a `config.toml` file using the `config.template.toml` file. You can copy the file and modify the following fields accordingly: + +- connection_string, if the `db-docker-compose.yml` isn't changed the connection string would be: mongodb://quests:password@localhost:27017 +- secret_key, this is the secret used for the JWT token. You can change it or leave as is. +- expiry_duration, this is the expiry duration of the JWT token. You should change it according to your needs the time is stored in miliseconds. +- rpc_url, this is to interact with the blockchain you can use a public RPC such as [Lava](https://www.lavanet.xyz/get-started/starknet) or a private node provider such as [Alchemy](https://www.alchemy.com) or [Infura](https://www.infura.io) + +3. Run the project +Once the `config.toml` file is created properly, you're going to be able to run the project using the following command + +```bash +cargo run +``` +If you've setup everything correctly, you should see the following output + +```bash + Finished `dev` profile [unoptimized + debuginfo] target(s) in 59.57s + Running `target/debug/quest_server` +quest_server: starting v0.1.0 +database: connected +server: listening on http://0.0.0.0:8080 +``` +Otherwise refer the to the Troubleshooting guide below. -once the config.toml file is done, use cargo run to start testing +## Troubleshooting From 9819d85afea1e2114b0599a298a55581a9166407 Mon Sep 17 00:00:00 2001 From: bitfalt <75431447+bitfalt@users.noreply.github.com> Date: Mon, 26 Aug 2024 23:37:20 -0600 Subject: [PATCH 11/15] fix typos --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c5ee1119..a8bf06e0 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ docker --version ``` If you don't have Docker installed, please go to the [Docker installation page](https://docs.docker.com/get-started/get-docker/) for further instructions. -## Installaction Instructions +## Installation Instructions Fork the repository and clone the forked repository to your local system @@ -38,7 +38,7 @@ Fork the repository and clone the forked repository to your local system git clone https://github.com//api.starknet.quest.git ``` -## Build instructions +## Build Instructions To build the project use the following command in a terminal @@ -54,7 +54,7 @@ If you wish to create an optimized binary without debug information run the foll cargo build --release ``` -## Running the project +## Running the Project To run the project successfully you'll need to do the following steps: 1. Deploy `db-docker-compose.yml` file to use MongoDB database From 93c74c3adbdfaf69dd42bf57facc5e205360b7a4 Mon Sep 17 00:00:00 2001 From: bitfalt <75431447+bitfalt@users.noreply.github.com> Date: Tue, 27 Aug 2024 01:00:07 -0600 Subject: [PATCH 12/15] add initial Troubleshooting section --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a8bf06e0..9033465d 100644 --- a/README.md +++ b/README.md @@ -67,10 +67,10 @@ The command above will create a container running the MongoDB database, however 2. Create `config.toml` file using the `config.template.toml` file To run the project successfully you need to create a `config.toml` file using the `config.template.toml` file. You can copy the file and modify the following fields accordingly: -- connection_string, if the `db-docker-compose.yml` isn't changed the connection string would be: mongodb://quests:password@localhost:27017 -- secret_key, this is the secret used for the JWT token. You can change it or leave as is. -- expiry_duration, this is the expiry duration of the JWT token. You should change it according to your needs the time is stored in miliseconds. -- rpc_url, this is to interact with the blockchain you can use a public RPC such as [Lava](https://www.lavanet.xyz/get-started/starknet) or a private node provider such as [Alchemy](https://www.alchemy.com) or [Infura](https://www.infura.io) +- `connection_string`, this is the string to connect to the database. If the `db-docker-compose.yml` isn't changed the connection string would be: mongodb://quests:password@localhost:27017 +- `secret_key`, this is the secret used for the JWT token. You can change it or leave as is. +- `expiry_duration`, this is the expiry duration of the JWT token. You should change it according to your needs the time is stored in miliseconds. +- `rpc_url`, this is to interact with the blockchain you can use a public RPC such as [Lava](https://www.lavanet.xyz/get-started/starknet) or a private node provider such as [Alchemy](https://www.alchemy.com) or [Infura](https://www.infura.io) 3. Run the project Once the `config.toml` file is created properly, you're going to be able to run the project using the following command @@ -91,3 +91,48 @@ Otherwise refer the to the Troubleshooting guide below. ## Troubleshooting +If your expected output doesn't includes the following text: +```bash +database: connected +server: listening on http://0.0.0.0:8080 +``` +This means you didn't run the Docker container which runs the database. To fix this, you'll need to run the Docker container with the command mentioned in the first step of the section Running the Project. + +If you get the following output: + +```bash + Finished `dev` profile [unoptimized + debuginfo] target(s) in 59.57s + Running `target/debug/quest_server` +quest_server: starting v0.1.0 +thread 'main' panicked at src/config.rs:212:9: +error: unable to read file with path "config.toml" +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +``` + +This means you didn't create the `config.toml` file. To fix this, you'll need to create the `config.toml` file with the steps mentioned in the second step of the section Running the Project. + +If you get the following output: + +```bash + Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.55s + Running `target/debug/quest_server` +quest_server: starting v0.1.0 +thread 'main' panicked at src/main.rs:34:49: +called `Result::unwrap()` on an `Err` value: RelativeUrlWithoutBase +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +``` + +This means you didn't add the `rpc_url` in the `config.toml` file. To fix this, you'll need to add the `rpc_url` to the `config.toml` file. Please refer the second step of the section Running the Project for further instructions on how to add the `rpc_url`. + +If you get the following output: + +```bash + Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.49s + Running `target/debug/quest_server` +quest_server: starting v0.1.0 +thread 'main' panicked at src/main.rs:29:10: +called `Result::unwrap()` on an `Err` value: Error { kind: InvalidArgument { message: "connection string contains no scheme" }, labels: {}, wire_version: None, source: None } +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +``` + +This means you didn't add the `connection_string` in the `config.toml` file. To fix this, you'll need to add the `connection_string` to the `config.toml` file. Please refer to the second step of the section Running the Project for further instructions on how to add the `connection_string`. \ No newline at end of file From bcf108124bcbdccdf2eead1aaf15769ade5e563b Mon Sep 17 00:00:00 2001 From: bitfalt <75431447+bitfalt@users.noreply.github.com> Date: Tue, 27 Aug 2024 02:31:01 -0600 Subject: [PATCH 13/15] fix punctuation marks and formatting --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9033465d..6c676c61 100644 --- a/README.md +++ b/README.md @@ -57,22 +57,22 @@ cargo build --release ## Running the Project To run the project successfully you'll need to do the following steps: -1. Deploy `db-docker-compose.yml` file to use MongoDB database +1. Deploy `db-docker-compose.yml` file to use MongoDB database. Once inside the directory of the project, you need to run the following command: ```bash docker-compose -f db-docker-compose.yml up -d ``` The command above will create a container running the MongoDB database, however the information you add to the database isn't persistent, you'll need to modify the db-docker-compose.yml file to include a volume. For more information regarding Docker-compose files and volumes go the this [page](https://docs.docker.com/engine/storage/volumes/). -2. Create `config.toml` file using the `config.template.toml` file +2. Create `config.toml` file using the `config.template.toml` file. To run the project successfully you need to create a `config.toml` file using the `config.template.toml` file. You can copy the file and modify the following fields accordingly: -- `connection_string`, this is the string to connect to the database. If the `db-docker-compose.yml` isn't changed the connection string would be: mongodb://quests:password@localhost:27017 +- `connection_string`, this is the string to connect to the database. If the `db-docker-compose.yml` isn't changed the connection string would be: `mongodb://quests:password@localhost:27017` - `secret_key`, this is the secret used for the JWT token. You can change it or leave as is. - `expiry_duration`, this is the expiry duration of the JWT token. You should change it according to your needs the time is stored in miliseconds. - `rpc_url`, this is to interact with the blockchain you can use a public RPC such as [Lava](https://www.lavanet.xyz/get-started/starknet) or a private node provider such as [Alchemy](https://www.alchemy.com) or [Infura](https://www.infura.io) -3. Run the project +3. Run the project. Once the `config.toml` file is created properly, you're going to be able to run the project using the following command ```bash From 1629d15737cfb191f5d102b25324bad4e33adcb1 Mon Sep 17 00:00:00 2001 From: bitfalt <75431447+bitfalt@users.noreply.github.com> Date: Tue, 27 Aug 2024 16:43:14 -0600 Subject: [PATCH 14/15] finish Troubleshooting section tested README steps successfully on both Mac and Windows computers. --- README.md | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6c676c61..56acdb99 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,9 @@ quest_server: starting v0.1.0 database: connected server: listening on http://0.0.0.0:8080 ``` -Otherwise refer the to the Troubleshooting guide below. +If you have a different output, refer the to the Troubleshooting guide below. + +If you wish to test admin endpoints, you need to add the admin manually to the database. ## Troubleshooting @@ -135,4 +137,24 @@ called `Result::unwrap()` on an `Err` value: Error { kind: InvalidArgument { mes note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace ``` -This means you didn't add the `connection_string` in the `config.toml` file. To fix this, you'll need to add the `connection_string` to the `config.toml` file. Please refer to the second step of the section Running the Project for further instructions on how to add the `connection_string`. \ No newline at end of file +This means you didn't add the `connection_string` in the `config.toml` file. To fix this, you'll need to add the `connection_string` to the `config.toml` file. Please refer to the second step of the section Running the Project for further instructions on how to add the `connection_string`. + +If you get the following output: + +```bash + Finished `dev` profile [unoptimized + debuginfo] target(s) in 5.41s + Running `target\debug\quest_server.exe` +quest_server: starting v0.1.0 +thread 'main' panicked at src\config.rs:218:13: +error: unable to deserialize config. newline in string found at line 6 column 63 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +error: process didn't exit successfully: `target\debug\quest_server.exe` (exit code: 101) +``` + +This means you probably forgot the following character in the `config.toml` file: ". To fix this, you'll need to check that the fields you modified while creating the `config.toml` file have their opening and closing character. As an example, it should look like this: + +`connection_string = "mongodb://quests:password@localhost:27017"` + +and NOT like this + +`connection_string = "mongodb://quests:password@localhost:27017` \ No newline at end of file From b331625db502c2ad4197a77e3e3edf5e1bfd55af Mon Sep 17 00:00:00 2001 From: bitfalt <75431447+bitfalt@users.noreply.github.com> Date: Wed, 28 Aug 2024 02:50:06 -0600 Subject: [PATCH 15/15] add troubleshoot issue due to logger and improve redaction --- README.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 56acdb99..db4d3ca2 100644 --- a/README.md +++ b/README.md @@ -65,12 +65,13 @@ docker-compose -f db-docker-compose.yml up -d The command above will create a container running the MongoDB database, however the information you add to the database isn't persistent, you'll need to modify the db-docker-compose.yml file to include a volume. For more information regarding Docker-compose files and volumes go the this [page](https://docs.docker.com/engine/storage/volumes/). 2. Create `config.toml` file using the `config.template.toml` file. -To run the project successfully you need to create a `config.toml` file using the `config.template.toml` file. You can copy the file and modify the following fields accordingly: +Create a `config.toml` file by copying and modifying the `config.template.toml` file. Make sure you update the following fields as required to run the project successfully: - `connection_string`, this is the string to connect to the database. If the `db-docker-compose.yml` isn't changed the connection string would be: `mongodb://quests:password@localhost:27017` - `secret_key`, this is the secret used for the JWT token. You can change it or leave as is. - `expiry_duration`, this is the expiry duration of the JWT token. You should change it according to your needs the time is stored in miliseconds. -- `rpc_url`, this is to interact with the blockchain you can use a public RPC such as [Lava](https://www.lavanet.xyz/get-started/starknet) or a private node provider such as [Alchemy](https://www.alchemy.com) or [Infura](https://www.infura.io) +- `rpc_url`, this is to interact with the blockchain you can use a public RPC such as [Lava](https://www.lavanet.xyz/get-started/starknet) or a private node provider such as [Alchemy](https://www.alchemy.com) or [Infura](https://www.infura.io). Alchemy and Infura require an account to get a private RPC, while Lava is completely public. +- In the section of `[watchtower]`, set `enabled` to false. If you wish to setup the watchtower correctly, you can check the Watchtower repositories for further information. [Watchtower frontend](https://github.com/starknet-id/watchtower.starknet.id) and [Watchtower backend](https://github.com/starknet-id/watchtower_server) 3. Run the project. Once the `config.toml` file is created properly, you're going to be able to run the project using the following command @@ -157,4 +158,15 @@ This means you probably forgot the following character in the `config.toml` file and NOT like this -`connection_string = "mongodb://quests:password@localhost:27017` \ No newline at end of file +`connection_string = "mongodb://quests:password@localhost:27017` + +If you get the following output: + +```bash + Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.53s + Running `target/debug/quest_server` +INFO: quest_server: starting v0.1.0 +Failed to post log: "Invalid token or token expired" +``` + +This means that you didn't setup the credentials for Watchtower. To fix this, you'll need to set the `enabled` field in `[watchtower]` to false in the `config.toml` file. Please refer the second step of the section Running the Project for further instructions if you wish to keep the `[watchtower]` enabled. \ No newline at end of file