Skip to content

Commit

Permalink
chore: rename api + provider proxy + backup + db from cloudmos to con…
Browse files Browse the repository at this point in the history
…sole
  • Loading branch information
baktun14 committed Jul 9, 2024
1 parent 2a15721 commit 93b863a
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 67 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Directory: [provider-proxy](/provider-proxy/)

Provides data to the deploy website. The data is fetched from our Indexer database + coingecko for market data. This api also provide the endpoint for the [Web3 Index](https://web3index.org/) integration.

Url: [api.cloudmos.io](https://api.cloudmos.io)
Url: [api.console.akash.network](https://api.console.akash.network)
Directory: [api](/api/)

## Indexer
Expand Down Expand Up @@ -138,9 +138,9 @@ Due to the extensive time required to index Akash from block #1, it's recommende

### Available Backups

- **Mainnet Database (~30 GB):** [cloudmos-akash-mainnet.sql.gz](https://storage.googleapis.com/cloudmos-postgresql-backups/cloudmos-akash-mainnet.sql.gz)
- **Mainnet Database (~30 GB):** [console-akash-mainnet.sql.gz](https://storage.googleapis.com/console-postgresql-backups/console-akash-mainnet.sql.gz)
- Suitable for scenarios requiring complete data.
- **Sandbox Database (< 300 MB):** [cloudmos-akash-sandbox.sql.gz](https://storage.googleapis.com/cloudmos-postgresql-backups/cloudmos-akash-sandbox.sql.gz)
- **Sandbox Database (< 300 MB):** [console-akash-sandbox.sql.gz](https://storage.googleapis.com/console-postgresql-backups/console-akash-sandbox.sql.gz)
- Ideal for most development needs, although it may lack recent chain updates.

### Restoration Steps
Expand All @@ -150,7 +150,7 @@ Due to the extensive time required to index Akash from block #1, it's recommende

For a .sql.gz file:
```sh
gunzip -c /path/to/cloudmos-akash-sandbox.sql.gz | psql --host "localhost" --port "5432" --username "postgres" --dbname "cloudmos-akash"
gunzip -c /path/to/console-akash-sandbox.sql.gz | psql --host "localhost" --port "5432" --username "postgres" --dbname "console-akash"
```
After restoring the database, you can proceed with the specific project's README instructions for further setup and running the application.

Expand Down
89 changes: 46 additions & 43 deletions apps/api/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Console API

- [Environment Variables](#environment-variables)
Expand All @@ -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
Expand All @@ -45,7 +44,7 @@ To execute both **unit and functional** tests, run:

```shell
npm test
````
```

To run **unit** tests exclusively, use:

Expand All @@ -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:
Expand All @@ -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>` |
2 changes: 1 addition & 1 deletion apps/deploy-web/src/components/layout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const Sidebar: React.FunctionComponent<Props> = ({ isMobileOpen, handleDr
{
title: "API",
icon: props => <OpenInWindow {...props} />,
url: "https://api.cloudmos.io/v1/swagger",
url: "https://api.console.akash.network/v1/swagger",
activeRoutes: [],
target: "_blank"
},
Expand Down
14 changes: 6 additions & 8 deletions apps/deploy-web/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ export enum RouteStepKeys {
createLeases = "create-leases"
}

const productionMainnetApiUrl = "https://api.cloudmos.io";
const productionTestnetApiUrl = "https://api-testnet.cloudmos.io";
const productionSandboxApiUrl = "https://api-sandbox.cloudmos.io";
const productionMainnetApiUrl = "https://api.console.akash.network";
const productionTestnetApiUrl = "https://api-testnet.console.akash.network";
const productionSandboxApiUrl = "https://api-sandbox.console.akash.network";
const productionStatsAppUrl = "https://stats.akash.network";
const productionHostnames = ["deploy.cloudmos.io", "console.akash.network", "staging-console.akash.network", "beta.cloudmos.io"];
const productionHostnames = ["console.akash.network", "staging-console.akash.network"];

export const isProd = process.env.NODE_ENV === "production";
export const isMaintenanceMode = process.env.MAINTENANCE_MODE === "true";
Expand Down Expand Up @@ -112,15 +112,13 @@ function getStatsAppUrl() {
function getProviderProxyHttpUrl() {
if (process.env.PROVIDER_PROXY_URL) return process.env.PROVIDER_PROXY_URL;
if (typeof window === "undefined") return "http://localhost:3040";
if (window.location?.hostname === "deploybeta.cloudmos.io") return "https://deployproxybeta.cloudmos.io";
if (productionHostnames.includes(window.location?.hostname)) return "https://providerproxy.cloudmos.io";
if (productionHostnames.includes(window.location?.hostname)) return "https://providerproxy.console.akash.network";
return "http://localhost:3040";
}

function getProviderProxyWsUrl() {
if (typeof window === "undefined") return "ws://localhost:3040";
if (window.location?.hostname === "deploybeta.cloudmos.io") return "wss://deployproxybeta.cloudmos.io";
if (productionHostnames.includes(window.location?.hostname)) return "wss://providerproxy.cloudmos.io";
if (productionHostnames.includes(window.location?.hostname)) return "wss://providerproxy.console.akash.network";
return "ws://localhost:3040";
}

Expand Down
2 changes: 1 addition & 1 deletion apps/indexer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ HealthChecks_SyncBlocks|ex: `041b2561-be28-4a36-bb3f-36a68f86224e`|[HealthChecks
HealthChecks_SyncAKTPriceHistory|ex: `041b2561-be28-4a36-bb3f-36a68f86224e`|[HealthChecks.io](https://healthchecks.io) check ID for the `SyncAKTPriceHistory` task.
HealthChecks_SyncProviderInfo|ex: `041b2561-be28-4a36-bb3f-36a68f86224e`|[HealthChecks.io](https://healthchecks.io) check ID for the `SyncProviderInfo` task.
HealthChecks_SyncKeybaseInfo|ex: `041b2561-be28-4a36-bb3f-36a68f86224e`|[HealthChecks.io](https://healthchecks.io) check ID for the `SyncKeybaseInfo` task.
AkashDatabaseCS|ex: `postgres://user:password@localhost:5432/cloudmos-akash`|Akash Database Connection String
AkashDatabaseCS|ex: `postgres://user:password@localhost:5432/console-akash`|Akash Database Connection String
ActiveChain|ex: `akash`|Chain code from [chainDefinitions.ts](../shared/chainDefinitions.ts)
KeepCache|`true` or `false`|Specify if the [block & block response cache](#block-cache-structure) should be kept on drive. Takes a lot of space, but allow rebuilding the database without redownloading every blocks.
Standby|`true` or `false`|If `true`, indexer will not start. Useful for stopping an indexer deployed on akash without needing to close the lease.
Expand Down
3 changes: 0 additions & 3 deletions apps/provider-proxy/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ const webSocketStats: ClientWebSocketStats[] = [];
const whitelist = [
"http://localhost:3001",
"http://localhost:3000",
"https://deploybeta.cloudmos.io",
"https://deploy.cloudmos.io",
"https://cloudmos.grafana.net",
"https://console.akash.network",
"https://beta.cloudmos.io",
"https://staging-console.akash.network"
];

Expand Down
6 changes: 3 additions & 3 deletions apps/stats-web/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export const selectedRangeValues: { [key: string]: number } = {
ALL: Number.MAX_SAFE_INTEGER
};

const productionMainnetApiUrl = "https://api.cloudmos.io";
const productionTestnetApiUrl = "https://api-testnet.cloudmos.io";
const productionSandboxApiUrl = "https://api-sandbox.cloudmos.io";
const productionMainnetApiUrl = "https://api.console.akash.network";
const productionTestnetApiUrl = "https://api-testnet.console.akash.network";
const productionSandboxApiUrl = "https://api-sandbox.console.akash.network";
const productionHostnames = ["stats.akash.network"];

export const isProd = process.env.NODE_ENV === "production";
Expand Down
6 changes: 3 additions & 3 deletions doc/Internal_Endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Those endpoints are used for debugging and analytics purposes.

## GPU Stats

Url: https://api.cloudmos.io/internal/gpu
Url: https://api.console.akash.network/internal/gpu

Returns a summary of the gpus on the network.

Expand Down Expand Up @@ -54,11 +54,11 @@ Returns a summary of the gpus on the network.
| memory_size | Ex: `16Gi` |

All query parameters can be combined, ex:
`https://api.cloudmos.io/internal/gpu?provider=akash175llqyjvxfle9qwt740vm46772dzaznpzgm576&vendor=nvidia&model=rtx3060ti&memory_size=8Gi`
`https://api.console.akash.network/internal/gpu?provider=akash175llqyjvxfle9qwt740vm46772dzaznpzgm576&vendor=nvidia&model=rtx3060ti&memory_size=8Gi`

## Provider Versions

Url: https://api.cloudmos.io/internal/provider-versions
Url: https://api.console.akash.network/internal/provider-versions

Returns a list of versions and the providers that are currently on that version. The `<UNKNOWN>` version corresponds to providers where the version could not be determined. The `/version` endpoint was broken for a long time, but is now fixed in [v0.5.0-rc11](https://github.com/akash-network/provider/releases/tag/v0.5.0-rc11)

Expand Down
2 changes: 1 addition & 1 deletion docker/bin/prepare-and-seed-postgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

echo "DB_SEEDER: Importing databases from cloud storage..."

BASE_URL="https://storage.googleapis.com/cloudmos-postgresql-backups"
BASE_URL="https://storage.googleapis.com/console-postgresql-backups"

if [ -z "${POSTGRES_USER:-}" ]; then
echo "DB_SEEDER: POSTGRES_USER is not set. Skipping seeding."
Expand Down

0 comments on commit 93b863a

Please sign in to comment.