-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: rename api + provider proxy + backup + db from cloudmos to con…
…sole
- Loading branch information
Showing
9 changed files
with
65 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
# Console API | ||
|
||
- [Environment Variables](#environment-variables) | ||
|
@@ -8,35 +7,35 @@ | |
|
||
1. Make sure you have a valid [Akash database](../README.md#how-to-run) first. | ||
2. Make sure you have a valid User database. If the user database is empty, the necessary tables will be created automatically. | ||
2. Create a `.env` file with the necessary [environment variables](#environment-variables). | ||
3. Run `npm install` to install dependencies. | ||
4. Start the app with `npm start`. | ||
3. Create a `.env` file with the necessary [environment variables](#environment-variables). | ||
4. Run `npm install` to install dependencies. | ||
5. Start the app with `npm start`. | ||
|
||
You can make sure the api is working by accessing the status endpoint: `http://localhost:3080/status` | ||
|
||
## Environment Variables | ||
|
||
When running the api locally the following environment variables can be set in a `.env` file. | ||
|
||
|Name|Value|Note| | ||
|-|-|- | ||
Network|`mainnet` or `testnet`|Specify if the api should be in mainnet or testnet mode. Default: `mainnet`. | ||
RestApiNodeUrl|ex: `"https://api.akashnet.net"`|Rest api to use. Will default to `"https://rest.cosmos.directory/akash"` for mainnet and `"https://api.testnet-02.aksh.pw:443"` for testnet. | ||
ServerOrigin|ex: `http://localhost:3080`|Origin of the api server. Will be used to populate the swagger server list. | ||
HealthchecksEnabled|`true` or `false`|Specify if the [Scheduler](./src/index.ts#L42) should send health check pings. | ||
SentryDSN|ex: `"https://[email protected]/1234"`|[Sentry DSN](https://docs.sentry.io/product/sentry-basics/dsn-explainer/) used when [initializing](./src/index.ts#L29) Sentry | ||
AkashDatabaseCS|ex: `postgres://user:password@localhost:5432/cloudmos-akash`|Akash Database Connection String | ||
AkashTestnetDatabaseCS|ex: `postgres://user:password@localhost:5432/cloudmos-akash-testnet`|Akash Testnet Database Connection String | ||
UserDatabaseCS|ex: `postgres://user:password@localhost:5432/cloudmos-users`|User Database Connection String | ||
Auth0JWKSUri|ex: `'https://1a2b3c.us.auth0.com/.well-known/jwks.json'`| | ||
Auth0Audience|ex: `'https://api.cloudmos.io'` | ||
Auth0Issuer|ex: `'https://dev-5aprb0lr.us.auth0.com/'` | ||
Auth0Issuer|ex: `'https://auth.cloudmos.io/'` | ||
StripeSecretKey|ex: `sk_test_12aw315wdawd3...293d12d32df8jf` | ||
WebsiteUrl|`http://localhost:3001` | ||
|
||
| Name | Value | Note | | ||
| ---------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| Network | `mainnet` or `testnet` | Specify if the api should be in mainnet or testnet mode. Default: `mainnet`. | | ||
| RestApiNodeUrl | ex: `"https://api.akashnet.net"` | Rest api to use. Will default to `"https://rest.cosmos.directory/akash"` for mainnet and `"https://api.testnet-02.aksh.pw:443"` for testnet. | | ||
| ServerOrigin | ex: `http://localhost:3080` | Origin of the api server. Will be used to populate the swagger server list. | | ||
| HealthchecksEnabled | `true` or `false` | Specify if the [Scheduler](./src/index.ts#L42) should send health check pings. | | ||
| SentryDSN | ex: `"https://[email protected]/1234"` | [Sentry DSN](https://docs.sentry.io/product/sentry-basics/dsn-explainer/) used when [initializing](./src/index.ts#L29) Sentry | | ||
| AkashDatabaseCS | ex: `postgres://user:password@localhost:5432/console-akash` | Akash Database Connection String | | ||
| AkashTestnetDatabaseCS | ex: `postgres://user:password@localhost:5432/console-akash-testnet` | Akash Testnet Database Connection String | | ||
| UserDatabaseCS | ex: `postgres://user:password@localhost:5432/console-users` | User Database Connection String | | ||
| Auth0JWKSUri | ex: `'https://1a2b3c.us.auth0.com/.well-known/jwks.json'` | | ||
| Auth0Audience | ex: `'https://api.console.akash.network'` | | ||
| Auth0Issuer | ex: `'https://dev-5aprb0lr.us.auth0.com/'` | | ||
| Auth0Issuer | ex: `'https://auth.console.akash.network/'` | | ||
| StripeSecretKey | ex: `sk_test_12aw315wdawd3...293d12d32df8jf` | | ||
| WebsiteUrl | `http://localhost:3001` | | ||
|
||
## Testing | ||
|
||
Project is configured to use [Jest](https://jestjs.io/) for testing. It is intended to be covered with unit and functional tests where applicable. | ||
|
||
### Running tests | ||
|
@@ -45,7 +44,7 @@ To execute both **unit and functional** tests, run: | |
|
||
```shell | ||
npm test | ||
```` | ||
``` | ||
|
||
To run **unit** tests exclusively, use: | ||
|
||
|
@@ -60,22 +59,27 @@ npm run test:functional | |
``` | ||
|
||
#### Watch Mode | ||
|
||
To automatically re-run tests upon any changes, use the following watch mode commands: | ||
|
||
```shell | ||
npm test:watch | ||
npm run test:unit:watch | ||
npm run test:functional:watch | ||
``` | ||
|
||
#### Collecting Coverage | ||
|
||
To collect and view test coverage, use the following commands: | ||
|
||
```shell | ||
npm test:coverage | ||
npm run test:unit:coverage | ||
npm run test:functional:coverage | ||
``` | ||
|
||
### Contributing to Tests | ||
|
||
**Unit Tests**: Focus on testing individual functions and components in isolation, without external dependencies. | ||
|
||
**Test File Structure**: For consistency, each component tested with unit tests should reside in its own directory, named after the component. Place the test file alongside the component, suffixed with .spec. For example: | ||
|
@@ -94,37 +98,36 @@ src/ | |
|
||
### Api Versioning | ||
|
||
The public api version will now be included in the url like so: api.cloudmos.io/**v1**/\<endpoint> | ||
The public api version will now be included in the url like so: api.console.akash.network/**v1**/\<endpoint> | ||
|
||
Changes that are backward compatible like adding a new endpoint will be done in the existing version. | ||
Changes that are **not** backward compatible, such as removing an endpoint, will be done in a new version. When releasing a new version, a list of breaking changes will be made available. We will keep the old version available for a while to give users enough time to migrate their applications to the latest version. | ||
|
||
### Swagger Documentation | ||
|
||
A swagger documentation is now available at https://api.cloudmos.io/v1/swagger. You can use it to see the list of available endpoints and try them directly in your browser. | ||
A swagger documentation is now available at https://api.console.akash.network/v1/swagger. You can use it to see the list of available endpoints and try them directly in your browser. | ||
|
||
### Route Changes | ||
|
||
The `/api` prefix was removed from every public endpoints and instead the version should be used (ex: `/v1/<endpoint>`) | ||
|
||
Here is a list of endpoints that have changed in this release. Old endpoints will temporarily redirect to the new ones. In future releases, the [versioning system](#api-versioning) will be used instead of redirects. | ||
|
||
|Old|New| | ||
|-|- | ||
|`/dashboardData`|`/dashboard-data` | ||
|`/getNetworkCapacity`|`/network-capacity` | ||
|`/getMainnetNodes`|`/nodes/mainnet` | ||
|`/getSandboxNodes`|`/nodes/sandbox` | ||
|`/getTestnetNodes`|`/nodes/testnet` | ||
|`/getProviderAttributesSchema`|`/provider-attributes-schema` | ||
|`/getMainnetVersion`|`/version/mainnet` | ||
|`/getSandboxVersion`|`/version/sandbox` | ||
|`/getTestnetVersion`|`/version/testnet` | ||
|`/getProviderGraphData/<dataName>`|`/provider-graph-data/<dataName>` | ||
|`/getProviderActiveLeasesGraphData/<address>`|`/provider-active-leases-graph-data/<address>` | ||
|`/getGraphData/<dataName>`|`/graph-data/<dataName>` | ||
|`/marketData`|`/market-data` | ||
|`/predicted-block-date/<height>/<blockWindow>` | `/predicted-block-date/<height>?blockWindow=<blockWindow>` | ||
|`/predicted-date-height/<timestamp>/<blockWindow>` | `/predicted-date-height/<timestamp>?blockWindow=<blockWindow>` | ||
|`/providers/<provider>/deployments/<skip>/<take>/<status>`|`/providers/<provider>/deployments/<skip>/<take>?status=<status>` | ||
| Old | New | | ||
| ---------------------------------------------------------- | ----------------------------------------------------------------- | | ||
| `/dashboardData` | `/dashboard-data` | | ||
| `/getNetworkCapacity` | `/network-capacity` | | ||
| `/getMainnetNodes` | `/nodes/mainnet` | | ||
| `/getSandboxNodes` | `/nodes/sandbox` | | ||
| `/getTestnetNodes` | `/nodes/testnet` | | ||
| `/getProviderAttributesSchema` | `/provider-attributes-schema` | | ||
| `/getMainnetVersion` | `/version/mainnet` | | ||
| `/getSandboxVersion` | `/version/sandbox` | | ||
| `/getTestnetVersion` | `/version/testnet` | | ||
| `/getProviderGraphData/<dataName>` | `/provider-graph-data/<dataName>` | | ||
| `/getProviderActiveLeasesGraphData/<address>` | `/provider-active-leases-graph-data/<address>` | | ||
| `/getGraphData/<dataName>` | `/graph-data/<dataName>` | | ||
| `/marketData` | `/market-data` | | ||
| `/predicted-block-date/<height>/<blockWindow>` | `/predicted-block-date/<height>?blockWindow=<blockWindow>` | | ||
| `/predicted-date-height/<timestamp>/<blockWindow>` | `/predicted-date-height/<timestamp>?blockWindow=<blockWindow>` | | ||
| `/providers/<provider>/deployments/<skip>/<take>/<status>` | `/providers/<provider>/deployments/<skip>/<take>?status=<status>` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters