Skip to content

Commit

Permalink
Merge branch 'feature/provider/pricing' into feature/provider/settings
Browse files Browse the repository at this point in the history
  • Loading branch information
jigar-arc10 committed Nov 14, 2024
2 parents ff748cd + f519f09 commit ad06e23
Show file tree
Hide file tree
Showing 243 changed files with 8,752 additions and 2,602 deletions.
3 changes: 2 additions & 1 deletion .commitlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"stats",
"release",
"repo",
"styling"
"styling",
"observability"
]
]
}
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/release-all-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ jobs:
node-version: 20.14.0

- name: Restore root node_modules cache
uses: martijnhols/actions-cache@v3
uses: actions/cache@v4
id: cache
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
path: |
node_modules
apps/api/node_modules
apps/deploy-web/node_modules
packages/*/node_modules
key: common-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/release-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ jobs:
node-version: 20.14.0

- name: Restore root node_modules cache
uses: martijnhols/actions-cache@v3
uses: actions/cache@v4
id: cache
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
path: |
node_modules
apps/${{ github.event.inputs.app }}/node_modules
packages/*/node_modules
key: ${{ github.event.inputs.app }}-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/validate-n-build-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ jobs:

- name: Restore root node_modules cache
if: steps.filter.outputs.api == 'true'
uses: martijnhols/actions-cache@v3
uses: actions/cache@v4
id: cache
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
path: |
node_modules
apps/api/node_modules
packages/*/node_modules
key: api-${{ runner.os }}-${{ hashFiles('package-lock.json') }}

- name: Install dependencies
if: steps.filter.outputs.api == 'true' && steps.cache.outputs.cache-hit != 'true'
Expand Down
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/bin/bash

if [[ "$CI" != "true" ]]; then
npm run update-apps-local-deps -w packages/database
npm run update-apps-local-deps -w packages/env-loader
npm run update-apps-local-deps -w packages/http-sdk
npm run update-apps-local-deps -w packages/ui
npm run update-apps-local-deps -w packages/network-store
npm run update-apps-local-deps -w packages/logging
git add ./apps/*/mvm.lock
fi
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

**Akash Console** is a powerful application that allows you to deploy any [Docker container](https://www.docker.com/) on the [Akash Network](https://akash.network) with just a few clicks. 🚀

![version](https://img.shields.io/github/stars/akash-network/console)
![license](https://img.shields.io/github/license/akash-network/console)
[![version](https://img.shields.io/github/stars/akash-network/console)](https://github.com/akash-network/console/stargazers)
[![license](https://img.shields.io/github/license/akash-network/console)](https://github.com/akash-network/console/blob/main/LICENSE)
[![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/akashnet_)](https://x.com/akashnet_)
[![Discord](https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat)](https://discord.gg/akash)
</div>
Expand Down Expand Up @@ -140,4 +140,4 @@ If you'd like to contribute to the development of Akash Console, please refer to

## License

This project is licensed under the [Apache License 2.0](./LICENSE).
This project is licensed under the [Apache License 2.0](./LICENSE).
97 changes: 97 additions & 0 deletions apps/api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,102 @@


## [2.29.1](https://github.com/akash-network/console/compare/console-api/v2.29.1-beta.0...console-api/v2.29.1) (2024-11-13)

## [2.29.1-beta.0](https://github.com/akash-network/console/compare/console-api/v2.29.0...console-api/v2.29.1-beta.0) (2024-11-13)


### Bug Fixes

* **deployment:** set owner of custodial wallet as fee granter for top up ([b3b9474](https://github.com/akash-network/console/commit/b3b94745a91c9fdd1f1ac39cb176add2d579aac0)), closes [#395](https://github.com/akash-network/console/issues/395)

## [2.29.0](https://github.com/akash-network/console/compare/console-api/v2.29.0-beta.0...console-api/v2.29.0) (2024-11-12)

## [2.29.0-beta.0](https://github.com/akash-network/console/compare/console-api/v2.28.1-beta.0...console-api/v2.29.0-beta.0) (2024-11-12)


### Features

* **deployment:** implement auto top up summary logging ([b0a40a2](https://github.com/akash-network/console/commit/b0a40a234a6a2fa380c6fffe230cd1f361e8d322)), closes [#395](https://github.com/akash-network/console/issues/395)
* **deployment:** implement deployment top up dry run ([be1274b](https://github.com/akash-network/console/commit/be1274b889de555cb4307d746f77af582950460d)), closes [#395](https://github.com/akash-network/console/issues/395)
* **deployment:** implement top up message sending ([f5d7233](https://github.com/akash-network/console/commit/f5d7233c6ce1e7fc880e817e7d8ff66967b8a547)), closes [#395](https://github.com/akash-network/console/issues/395)


### Bug Fixes

* **deployment:** ensure draining deployments result as array ([23234d6](https://github.com/akash-network/console/commit/23234d614fef179b914a264ced64d6575e9152d7)), closes [#395](https://github.com/akash-network/console/issues/395)

## [2.28.1-beta.0](https://github.com/akash-network/console/compare/console-api/v2.28.0...console-api/v2.28.1-beta.0) (2024-11-11)


### Bug Fixes

* **deployment:** trial provider attributes ([6f5c94d](https://github.com/akash-network/console/commit/6f5c94d41879a8d23ed129857f5d28285d4f9ee9)), closes [#453](https://github.com/akash-network/console/issues/453)

## [2.28.0](https://github.com/akash-network/console/compare/console-api/v2.28.0-beta.10...console-api/v2.28.0) (2024-11-08)

## [2.28.0-beta.10](https://github.com/akash-network/console/compare/console-api/v2.28.0-beta.9...console-api/v2.28.0-beta.10) (2024-11-08)


### Features

* **deployment:** properly log clean up on error ([99e3c04](https://github.com/akash-network/console/commit/99e3c0446665f059b720b36b2c06914a7cf63b28))

## [2.28.0-beta.9](https://github.com/akash-network/console/compare/console-api/v2.28.0-beta.8...console-api/v2.28.0-beta.9) (2024-11-08)


### Features

* **deployment:** ensure there's sufficient fees allowance on cleanup ([fbbec68](https://github.com/akash-network/console/commit/fbbec68e3e430f41ab12424a5ffb47aff059a79d))

## [2.28.0-beta.8](https://github.com/akash-network/console/compare/console-api/v2.28.0-beta.7...console-api/v2.28.0-beta.8) (2024-11-08)


### Features

* **deployment:** implement clean up of managed deployments ([882fac4](https://github.com/akash-network/console/commit/882fac457f91d968bd9ecd3129c9a2113c3dd0bf)), closes [#395](https://github.com/akash-network/console/issues/395)

## [2.28.0-beta.7](https://github.com/akash-network/console/compare/console-api/v2.28.0-beta.6...console-api/v2.28.0-beta.7) (2024-11-06)


### Features

* **deployment:** implements managed deployments top up data collection ([98d8b72](https://github.com/akash-network/console/commit/98d8b72ec82acdb8fab064008758dce7158e76ae)), closes [#395](https://github.com/akash-network/console/issues/395)

## [2.28.0-beta.6](https://github.com/akash-network/console/compare/console-api/v2.28.0-beta.5...console-api/v2.28.0-beta.6) (2024-11-06)


### Features

* add provider stats endpoint ([#402](https://github.com/akash-network/console/issues/402)) ([0570d24](https://github.com/akash-network/console/commit/0570d24a3ffaf14a59f5a234a68572a852a1f8b0))

## [2.28.0-beta.5](https://github.com/akash-network/console/compare/console-api/v2.28.0-beta.4...console-api/v2.28.0-beta.5) (2024-11-06)


### Features

* **deployment:** implements custodial deployments top up data collection ([108f073](https://github.com/akash-network/console/commit/108f0736359cc866bb9aa01e3935105c413c8aae)), closes [#39](https://github.com/akash-network/console/issues/39)

## [2.28.0-beta.4](https://github.com/akash-network/console/compare/console-api/v2.28.0-beta.3...console-api/v2.28.0-beta.4) (2024-11-06)


### Bug Fixes

* **observability:** make sure otl data is added to logs ([820870d](https://github.com/akash-network/console/commit/820870d43203ddec5d3cd101d5c46b4b67e1d16d))

## [2.28.0-beta.3](https://github.com/akash-network/console/compare/console-api/v2.28.0-beta.2...console-api/v2.28.0-beta.3) (2024-11-06)


### Features

* **package:** extract logger into packages ([bac463b](https://github.com/akash-network/console/commit/bac463b4f4f18ef73a630d69eba7355cb20d4643)), closes [#429](https://github.com/akash-network/console/issues/429)

## [2.28.0-beta.2](https://github.com/akash-network/console/compare/console-api/v2.28.0-beta.1...console-api/v2.28.0-beta.2) (2024-11-04)


### Bug Fixes

* **wallet:** init nextPageKey with null when paginating grants ([2698b14](https://github.com/akash-network/console/commit/2698b14fc9ade6eab56e189daab753372677b9de))

## [2.28.0-beta.1](https://github.com/akash-network/console/compare/console-api/v2.28.0-beta.0...console-api/v2.28.0-beta.1) (2024-10-31)


Expand Down
4 changes: 2 additions & 2 deletions apps/api/env/.env.functional.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ AKASH_SANDBOX_DATABASE_CS=postgres://postgres:password@localhost:5432/console-ak
USER_DATABASE_CS=postgres://postgres:password@localhost:5432/console-users
POSTGRES_DB_URI=postgres://postgres:password@localhost:5432/console-users
MASTER_WALLET_MNEMONIC="motion isolate mother convince snack twenty tumble boost elbow bundle modify balcony"
UAKT_TOP_UP_MASTER_WALLET_MNEMONIC="motion isolate mother convince snack twenty tumble boost elbow bundle modify balcony"
USDC_TOP_UP_MASTER_WALLET_MNEMONIC="motion isolate mother convince snack twenty tumble boost elbow bundle modify balcony"
UAKT_TOP_UP_MASTER_WALLET_MNEMONIC="since bread kind field rookie stairs elephant tent horror rice gain tongue collect goose rural garment cover client biology toe ability boat afford mind"
USDC_TOP_UP_MASTER_WALLET_MNEMONIC="leaf brush weapon puppy depart hockey walnut hospital orphan require unfair hunt ribbon toe cereal eagle hour door awesome dress mouse when phone return"
NETWORK=sandbox
RPC_NODE_ENDPOINT=https://rpc.sandbox-01.aksh.pw:443
TRIAL_DEPLOYMENT_ALLOWANCE_AMOUNT=20000000
Expand Down
25 changes: 25 additions & 0 deletions apps/api/env/.env.unit.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
AKASH_SANDBOX_DATABASE_CS=postgres://postgres:password@localhost:5432/console-akash-sandbox
USER_DATABASE_CS=postgres://postgres:password@localhost:5432/console-users
POSTGRES_DB_URI=postgres://postgres:password@localhost:5432/console-users
MASTER_WALLET_MNEMONIC="motion isolate mother convince snack twenty tumble boost elbow bundle modify balcony"
UAKT_TOP_UP_MASTER_WALLET_MNEMONIC="since bread kind field rookie stairs elephant tent horror rice gain tongue collect goose rural garment cover client biology toe ability boat afford mind"
USDC_TOP_UP_MASTER_WALLET_MNEMONIC="leaf brush weapon puppy depart hockey walnut hospital orphan require unfair hunt ribbon toe cereal eagle hour door awesome dress mouse when phone return"
NETWORK=sandbox
RPC_NODE_ENDPOINT=https://rpc.sandbox-01.aksh.pw:443
TRIAL_DEPLOYMENT_ALLOWANCE_AMOUNT=20000000
DEPLOYMENT_ALLOWANCE_REFILL_AMOUNT=20000000
DEPLOYMENT_ALLOWANCE_REFILL_THRESHOLD=2000000
TRIAL_FEES_ALLOWANCE_AMOUNT=5000000
FEE_ALLOWANCE_REFILL_AMOUNT=5000000
FEE_ALLOWANCE_REFILL_THRESHOLD=500000
DEPLOYMENT_GRANT_DENOM=uakt
LOG_LEVEL=debug
BILLING_ENABLED=true
ANONYMOUS_USER_TOKEN_SECRET=ANONYMOUS_USER_TOKEN_SECRET
STRIPE_SECRET_KEY=STRIPE_SECRET_KEY
STRIPE_PRICE_ID=STRIPE_PRICE_ID
STRIPE_WEBHOOK_SECRET=STRIPE_WEBHOOK_SECRET
ALLOWED_CHECKOUT_REFERRERS=["http://localhost:3000"]
STRIPE_CHECKOUT_REDIRECT_URL=http://localhost:3000
STD_OUT_LOG_FORMAT=pretty
SQL_LOG_FORMAT=pretty
3 changes: 2 additions & 1 deletion apps/api/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ module.exports = {
displayName: "unit",
...common,
testMatch: ["<rootDir>/src/**/*.spec.ts"],
setupFilesAfterEnv: ["./test/setup-unit-tests.ts"]
setupFilesAfterEnv: ["./test/setup-unit-tests.ts"],
setupFiles: ["./test/setup-unit-env.ts"]
},
{
displayName: "functional",
Expand Down
3 changes: 2 additions & 1 deletion apps/api/mvm.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"dependencies": {
"@akashnetwork/database": "1.0.0",
"@akashnetwork/env-loader": "1.0.1",
"@akashnetwork/http-sdk": "1.0.7"
"@akashnetwork/http-sdk": "1.0.8",
"@akashnetwork/logging": "2.0.0"
}
}
13 changes: 6 additions & 7 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@akashnetwork/console-api",
"version": "2.28.0-beta.1",
"version": "2.29.1",
"description": "Api providing data to the deploy tool",
"repository": {
"type": "git",
Expand Down Expand Up @@ -39,6 +39,7 @@
"@akashnetwork/database": "*",
"@akashnetwork/env-loader": "*",
"@akashnetwork/http-sdk": "*",
"@akashnetwork/logging": "*",
"@casl/ability": "^6.7.1",
"@chain-registry/assets": "^1.64.79",
"@cosmjs/amino": "^0.32.4",
Expand All @@ -53,9 +54,9 @@
"@hono/swagger-ui": "0.2.1",
"@hono/zod-openapi": "0.9.5",
"@octokit/rest": "^18.12.0",
"@opentelemetry/instrumentation-http": "^0.52.1",
"@opentelemetry/instrumentation-pino": "^0.41.0",
"@opentelemetry/sdk-node": "^0.52.1",
"@opentelemetry/instrumentation": "^0.54.0",
"@opentelemetry/instrumentation-http": "^0.54.0",
"@opentelemetry/sdk-node": "^0.54.0",
"@sentry/node": "^7.55.2",
"@supercharge/promise-pool": "^3.2.0",
"@types/jsonwebtoken": "^9.0.6",
Expand Down Expand Up @@ -84,9 +85,6 @@
"node-fetch": "^2.6.1",
"pg": "^8.12.0",
"pg-hstore": "^2.3.4",
"pino": "^9.4.0",
"pino-fluentd": "^0.2.4",
"pino-pretty": "^11.2.1",
"postgres": "^3.4.4",
"protobufjs": "^6.11.2",
"semver": "^7.3.8",
Expand Down Expand Up @@ -130,6 +128,7 @@
"supertest": "^6.1.5",
"ts-jest": "^29.1.4",
"ts-loader": "^9.2.5",
"type-fest": "^4.26.1",
"typescript": "5.1.3",
"webpack": "^5.91.0",
"webpack-cli": "4.10.0",
Expand Down
20 changes: 8 additions & 12 deletions apps/api/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import "reflect-metadata";
import "@src/core/providers/sentry.provider";

import { LoggerService } from "@akashnetwork/logging";
import { serve } from "@hono/node-server";
// TODO: find out how to properly import this
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
import { sentry } from "@hono/sentry";
import { Hono } from "hono";
import { Context, Hono, Next } from "hono";
import { cors } from "hono/cors";
import { container } from "tsyringe";

import { config } from "@src/core/config";
import { getSentry, sentryOptions } from "@src/core/providers/sentry.provider";
import { HonoErrorHandlerService } from "@src/core/services/hono-error-handler/hono-error-handler.service";
import { HttpLoggerService } from "@src/core/services/http-logger/http-logger.service";
import { LoggerService } from "@src/core/services/logger/logger.service";
import { RequestContextInterceptor } from "@src/core/services/request-context-interceptor/request-context.interceptor";
import { HonoInterceptor } from "@src/core/types/hono-interceptor.type";
import packageJson from "../package.json";
Expand Down Expand Up @@ -49,16 +45,16 @@ const scheduler = new Scheduler({

appHono.use(container.resolve(HttpLoggerService).intercept());
appHono.use(container.resolve(RequestContextInterceptor).intercept());
appHono.use(
"*",
sentry({
appHono.use("*", async (c: Context, next: Next) => {
const { sentry } = await import("@hono/sentry");
return sentry({
...sentryOptions,
beforeSend: event => {
event.server_name = config.SENTRY_SERVER_NAME;
return event;
}
})
);
})(c, next);
});

appHono.route("/", legacyRouter);
appHono.route("/", apiRouter);
Expand Down Expand Up @@ -105,7 +101,7 @@ function startScheduler() {
scheduler.start();
}

const appLogger = new LoggerService({ context: "APP" });
const appLogger = LoggerService.forContext("APP");

/**
* Initialize database
Expand Down
1 change: 0 additions & 1 deletion apps/api/src/billing/providers/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import "./config.provider";
import "./http-sdk.provider";
import "./wallet.provider";

export * from "./config.provider";
2 changes: 1 addition & 1 deletion apps/api/src/billing/providers/signing-client.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { container, inject } from "tsyringe";
import { config } from "@src/billing/config";
import { TYPE_REGISTRY } from "@src/billing/providers/type-registry.provider";
import { MANAGED_MASTER_WALLET, UAKT_TOP_UP_MASTER_WALLET, USDC_TOP_UP_MASTER_WALLET } from "@src/billing/providers/wallet.provider";
import { MasterSigningClientService } from "@src/billing/services";
import { MasterSigningClientService } from "@src/billing/services/master-signing-client/master-signing-client.service";
import { MasterWalletType } from "@src/billing/types/wallet.type";

export const MANAGED_MASTER_SIGNING_CLIENT = "MANAGED_MASTER_SIGNING_CLIENT";
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/billing/providers/type-registry.provider.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import "@src/utils/protobuf";

import { getAkashTypeRegistry } from "@akashnetwork/akashjs/build/stargate";
import { Registry } from "@cosmjs/proto-signing";
import { defaultRegistryTypes } from "@cosmjs/stargate";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { LoggerService } from "@akashnetwork/logging";
import { backOff } from "exponential-backoff";
import { singleton } from "tsyringe";

import { ApiPgDatabase, ApiPgTables, InjectPg, InjectPgTable } from "@src/core/providers";
import { AbilityParams, BaseRepository } from "@src/core/repositories/base.repository";
import { LoggerService, TxService } from "@src/core/services";
import { TxService } from "@src/core/services";

type Table = ApiPgTables["CheckoutSessions"];
export type CheckoutSessionsInput = Partial<Table["$inferInsert"]>;
export type CheckoutSessionsOutput = Table["$inferSelect"];

@singleton()
export class CheckoutSessionRepository extends BaseRepository<Table, CheckoutSessionsInput, CheckoutSessionsOutput> {
private readonly logger = new LoggerService({ context: CheckoutSessionRepository.name });
private readonly logger = LoggerService.forContext(CheckoutSessionRepository.name);

constructor(
@InjectPg() protected readonly pg: ApiPgDatabase,
Expand Down
Loading

0 comments on commit ad06e23

Please sign in to comment.