Skip to content

Commit f0d66c0

Browse files
authored
update readme, rename to stellar-rpc, make sentry optional (#97)
1 parent 739813c commit f0d66c0

File tree

4 files changed

+48
-75
lines changed

4 files changed

+48
-75
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
captive-core*/
44
.env
55
.DS_Store
6+
env.sh

README.md

+42-70
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ and contribution.
2626
### Running the Server
2727

2828
1. Clone the repository:
29+
2930
```bash
3031
git clone https://github.com/stellar/wallet-backend.git
3132
cd wallet-backend
@@ -39,49 +40,29 @@ This is the simplest and quickest way to start wallet-backend server. All the re
3940
docker services in their respective containers. This config is defined in `docker-compose.yaml` file in the main directory.
4041

4142
1. Copy the example `.env.example`:
43+
4244
```bash
4345
cp .env.example .env
4446
```
4547

4648
2. Add the environment variables:
49+
4750
```bash
4851
CHANNEL_ACCOUNT_ENCRYPTION_PASSPHRASE=
4952
DATABASE_URL=postgres://postgres@localhost:5432/wallet-backend?sslmode\=disable
5053
DISTRIBUTION_ACCOUNT_PRIVATE_KEY=
5154
DISTRIBUTION_ACCOUNT_PUBLIC_KEY=
52-
LOG_LEVEL=TRACE
5355
NETWORK=testnet
54-
PORT=8001
55-
RPC_URL=http://localhost:8000
56-
SERVER_BASE_URL=http://localhost:8001
5756
STELLAR_ENVIRONMENT=development
58-
TRACKER_DSN=
5957
WALLET_SIGNING_KEY=
60-
61-
# TSS RPC Caller Channel Settings
62-
TSS_RPC_CALLER_CHANNEL_BUFFER_SIZE=1000
63-
TSS_RPC_CALLER_CHANNEL_MAX_WORKERS=100
64-
65-
# Error Handler Jitter Channel Settings
66-
ERROR_HANDLER_JITTER_CHANNEL_BUFFER_SIZE=1000
67-
ERROR_HANDLER_JITTER_CHANNEL_MAX_WORKERS=100
68-
ERROR_HANDLER_JITTER_CHANNEL_MIN_WAIT_BETWEEN_RETRIES=10
69-
ERROR_HANDLER_JITTER_CHANNEL_MAX_RETRIES=3
70-
71-
# Error Handler Non-Jitter Channel Settings
72-
ERROR_HANDLER_NON_JITTER_CHANNEL_BUFFER_SIZE=1000
73-
ERROR_HANDLER_NON_JITTER_CHANNEL_MAX_WORKERS=100
74-
ERROR_HANDLER_NON_JITTER_CHANNEL_WAIT_BETWEEN_RETRIES=10
75-
ERROR_HANDLER_NON_JITTER_CHANNEL_MAX_RETRIES=3
76-
77-
# Webhook Handler Channel Settings
78-
WEBHOOK_CHANNEL_MAX_BUFFER_SIZE=1000
79-
WEBHOOK_CHANNEL_MAX_WORKERS=100
80-
WEBHOOK_CHANNEL_MAX_RETRIES=3
81-
WEBHOOK_CHANNEL_MIN_WAIT_BETWEEN_RETRIES=10
8258
```
8359

60+
Note that `CHANNEL_ACCOUNT_ENCRYPTION_PASSPHRASE` is required to be set to a non-empty value. For development purposes,
61+
you can set it to any value. For production, you should set it to a secure passphrase. For `WALLET_SIGNING_KEY`, and
62+
`DISTRIBUTION_ACCOUNT_PRIVATE_KEY` and `DISTRIBUTION_ACCOUNT_PUBLIC_KEY`, you can generate them using the Stellar CLI or by using tools like lab.stellar.org. Note that the `DISTRIBUTION_ACCOUNT_PUBLIC_KEY` is the public key of the account that will be used to sponsor accounts for channel accounts, and therefore must be a valid Stellar account.
63+
8464
3. Start the containers:
65+
8566
```bash
8667
docker-compose up
8768
```
@@ -96,74 +77,65 @@ we started earlier.
9677
This second way of setting up is preferable for more active development where you would
9778
like to add debug points to the code.
9879

99-
1. Start the `db` and `stellar-rpc` containers:
100-
```bash
101-
NETWORK=testnet docker-compose up -d db stellar-rpc
102-
```
80+
1. Create and run the `env.sh` script that exports each of the environment variables with the contents shared in the previous section. Note that some variables need to be added to the script to use localhost URLs instead of the URLs usable within the docker network.
10381

104-
2. Create a shell script `env.sh` and add the required environment variables:
10582
```bash
106-
#!/bin/bash
107-
export CHANNEL_ACCOUNT_ENCRYPTION_PASSPHRASE=
108-
export DATABASE_URL=postgres://postgres@localhost:5432/wallet-backend?sslmode\=disable
109-
export DISTRIBUTION_ACCOUNT_PRIVATE_KEY=
110-
export DISTRIBUTION_ACCOUNT_PUBLIC_KEY=
111-
export LOG_LEVEL=TRACE
112-
export NETWORK=testnet
113-
export PORT=8001
83+
# Add the following to the env.sh file in addition to the other variables:
11484
export RPC_URL=http://localhost:8000
11585
export SERVER_BASE_URL=http://localhost:8001
116-
export STELLAR_ENVIRONMENT=development
117-
export TRACKER_DSN=
118-
export WALLET_SIGNING_KEY=
119-
120-
# TSS RPC Caller Channel Settings
121-
export TSS_RPC_CALLER_CHANNEL_BUFFER_SIZE=1000
122-
export TSS_RPC_CALLER_CHANNEL_MAX_WORKERS=100
123-
124-
# Error Handler Jitter Channel Settings
125-
export ERROR_HANDLER_JITTER_CHANNEL_BUFFER_SIZE=1000
126-
export ERROR_HANDLER_JITTER_CHANNEL_MAX_WORKERS=100
127-
export ERROR_HANDLER_JITTER_CHANNEL_MIN_WAIT_BETWEEN_RETRIES=10
128-
export ERROR_HANDLER_JITTER_CHANNEL_MAX_RETRIES=3
129-
130-
# Error Handler Non-Jitter Channel Settings
131-
export ERROR_HANDLER_NON_JITTER_CHANNEL_BUFFER_SIZE=1000
132-
export ERROR_HANDLER_NON_JITTER_CHANNEL_MAX_WORKERS=100
133-
export ERROR_HANDLER_NON_JITTER_CHANNEL_WAIT_BETWEEN_RETRIES=10
134-
export ERROR_HANDLER_NON_JITTER_CHANNEL_MAX_RETRIES=3
135-
136-
# Webhook Handler Channel Settings
137-
export WEBHOOK_CHANNEL_MAX_BUFFER_SIZE=1000
138-
export WEBHOOK_CHANNEL_MAX_WORKERS=100
139-
export WEBHOOK_CHANNEL_MAX_RETRIES=3
140-
export WEBHOOK_CHANNEL_MIN_WAIT_BETWEEN_RETRIES=10
86+
```
87+
88+
2. Start the `db` and `stellar-rpc` containers:
89+
90+
```bash
91+
docker compose up -d db stellar-rpc
14192
```
14293

14394
3. Instead of spinning up `api` and `ingest` as docker services like we did earlier, we will run them locally.
14495

14596
1. **API**
146-
1. Run migrations:
97+
1. Source the `env.sh` file:
98+
99+
```bash
100+
source env.sh
101+
```
102+
103+
2. Run migrations:
104+
147105
```bash
148106
go run main.go migrate up
149107
```
150108

151-
2. Generate channel accounts
109+
3. Generate channel accounts
110+
152111
```bash
153112
go run main.go channel-account ensure 5
154113
```
155114

156-
3. Start API server
115+
4. Start API server
116+
157117
```bash
158118
go run main.go serve
159119
```
160120

161121
2. **Ingest**
162-
1. In a separate terminal tab, run the ingestion service:
122+
1. In a separate terminal tab, source the `env.sh` file and run the ingestion service:
123+
163124
```bash
125+
source env.sh
164126
go run main.go ingest
165127
```
166128

167129
This allows us to establish a dev cycle where you can make changes to the code and restart the `api` and `ingest` services
168130
to test them. Based on the IDE you are using, you can add the build configurations for these services, along with
169-
the environment variables to add breakpoints to your code.
131+
the environment variables to add breakpoints to your code.
132+
133+
### Testing
134+
135+
To run the tests, you can use the following command:
136+
137+
```bash
138+
go test ./...
139+
```
140+
141+
Note that you must set up your environment as defined in the previous section to run the tests, where the database and stellar-rpc are running in docker containers. Alternatively, you could run the database and stellar-rpc locally and run the tests without docker.

cmd/utils/global_options.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func RPCURLOption(configKey *string) *config.ConfigOption {
7373
Usage: "The URL of the RPC Server.",
7474
OptType: types.String,
7575
ConfigKey: configKey,
76-
FlagDefault: "http://soroban-rpc:8000",
76+
FlagDefault: "http://stellar-rpc:8000",
7777
Required: true,
7878
}
7979
}
@@ -94,7 +94,7 @@ func SentryDSNOption(configKey *string) *config.ConfigOption {
9494
Usage: "The Sentry DSN",
9595
OptType: types.String,
9696
ConfigKey: configKey,
97-
Required: true,
97+
Required: false,
9898
}
9999
}
100100

docker-compose.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ services:
99
ports:
1010
- 5432:5432
1111
stellar-rpc:
12-
image: stellar/soroban-rpc
12+
image: stellar/stellar-rpc:stable
1313
ports:
1414
- 8000:8000
1515
volumes:
@@ -26,7 +26,7 @@ services:
2626
depends_on:
2727
db:
2828
condition: service_started
29-
soroban-rpc:
29+
stellar-rpc:
3030
condition: service_started
3131
ports:
3232
- 8001:8001
@@ -67,7 +67,7 @@ services:
6767
depends_on:
6868
db:
6969
condition: service_started
70-
soroban-rpc:
70+
stellar-rpc:
7171
condition: service_started
7272
entrypoint: ""
7373
command:

0 commit comments

Comments
 (0)