Skip to content

Commit

Permalink
fixed package-lock.json merge issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jigar-arc10 committed Oct 10, 2024
2 parents c977e2e + ed22ad7 commit 66d0f11
Show file tree
Hide file tree
Showing 493 changed files with 29,004 additions and 26,239 deletions.
23 changes: 23 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": ["@commitlint/config-conventional"],
"rules": {
"scope-enum": [
2,
"always",
[
"network",
"wallet",
"sdl",
"user",
"auth",
"billing",
"provider",
"deployment",
"certificate",
"dx",
"config",
"stats"
]
]
}
}
2 changes: 0 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
**/.env.*.local
**/.env.*.test

apps/deploy-web/.env*
apps/indexer/.env*
apps/landing/.env*
apps/provider-console/.env*
apps/provider-proxy/.env*
apps/stats-web/.env*

**/.next
*.md
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-deploy-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
- name: Build the Docker image
if: steps.filter.outputs.deploy-web == 'true'
run: npm run dc:build -- deploy-web
run: npm run dc:build -- --build-arg DEPLOYMENT_ENV=production deploy-web
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-stats-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
- name: Build the Docker image
if: steps.filter.outputs.stats-web == 'true'
run: npm run dc:build -- stats-web
run: npm run dc:build -- --build-arg DEPLOYMENT_ENV=production stats-web
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,20 @@ build.ps1
.yarn-integrity

# dotenv environment variable files
apps/deploy-web/.env
apps/indexer/.env
apps/provider-console/.env
apps/provider-proxy/.env
apps/stats-web/.env
.env.*.local
.env.local
.env.test

# IDE files
.idea
.vscode
.vscode-test

# Data Folder
data
data
testdata
test-results
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit $1
67 changes: 67 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
## Contribution Guidelines for Akash Network Console Repository
### Overview

Thank you for considering contributing to the Akash Network Console repository. These guidelines ensure that all contributions are valuable, feasible, and maintain our project's quality standards.

### I. Before Contributing

1. **Open an Issue**: Before making changes, open an issue to discuss your proposed feature or bug fix.
2. **Describe Clearly**: Provide a clear description of the change, including any required information specified in the issue labels.

### II. Pull Requests

1. **Single Purpose**: Each PR should address one specific feature or bug.
2. **Keep it Small**: Limit changes per PR. Multiple small PRs are preferred over large ones.
3. **Link to Issue**: Reference the related issue in your PR description.

### III. Monorepo

Akash Console repo is a monorepo which contains multiple applications under the `/apps` folder. There's also a `/packages` folder that contains re-used projects between applications. Please take the time to review all the available packages to make sure you don't duplicate code that is already available.

Installing an npm package to console must be done at the root with the following example:

```
npm i -w ./apps/deploy-web name-of-the-package@version
```

### IV. Commit Messages

Follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard:

```
fix: resolved bug in node dockerfile
# Notes:
If your commit targets a specific feature/domain, add it to your commit like so:
feat(wallet): add a new function to compute wallet balance
```
### V. Code Quality and Readability

- **Apply Best Practices for Code Readability**: Ensure your code follows established best practices for coding standards, documentation, and formatting.
- **Include Unit Tests (When Applicable)**: Verifiable unit tests aid in maintaining code quality and prevent additional bugs from being introduced.
- **Linting**: Run `npm run lint:fix` to make sure your code is properly formatted.

### Big Features

For large features or significant changes:

1. Create a fork of the main repository.
2. Implement your feature in small, incremental pull requests to your fork.
3. This allows us to gradually review the changes and provide guidance throughout the development process.
4. Once the feature is complete and has gone through the review process on the fork, we can then merge it into the main repository.

This approach helps manage complex features more effectively and ensures that large changes are thoroughly reviewed before being integrated into the main codebase.

### Contribution Process Overview

If you're ready to contribute, follow our guidelines:

- Open an issue describing the bug or feature you'd like to address
- Once issues are created and reviewed, make changes while following the mentioned guidelines
- Once you're satisfied with your contributions, submit a pull request according to our guidelines
- A Core Developer Team member will assist and review your included changes accordingly.

Note that this process allows multiple developers to collaborate effectively and maintain high-quality code for a long-lasting entity; the project.

*That your commitment to following these specs will make a difference.*
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2023 Overclock Labs, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
</div>

- [Quick Start](#quick-start)
- [Apps Configuration](./doc/apps-configuration.md)
- [Services](#services)
- [Monitoring](#monitoring)
- [Example SQL Queries](#example-sql-queries)
Expand Down Expand Up @@ -64,7 +65,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 provides the endpoint for the [Web3 Index](https://web3index.org/) integration.

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

## Indexer
Expand Down Expand Up @@ -138,9 +139,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/console-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/console-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 +151,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
73 changes: 30 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,30 +7,14 @@

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

This app utilizes `.env*` files to manage environment variables. The list of environment variables can be found in the `env/.env.sample` file. These files are included in version control and should only contain non-sensitive values. Sensitive values are provided by the deployment system.

### Important Notes:
- **Sensitive Values**: The only env file that's ignored by Git is `env/.env.local`, which is intended for sensitive values used in development.
- **Loading Order**: Environment files are loaded in a specific order, depending on two environment variables: `DEPLOYMENT_ENV` and `NETWORK`.

### Loading Order:
1. `env/.env.local` - Contains sensitive values for development.
2. `env/.env` - Default values applicable to all environments.
3. `env/.env.${DEPLOYMENT_ENV}` - Values specific to the deployment environment.
4. `env/.env.${NETWORK}` - Values specific to the network.

### Additional Details:
- **Variable Precedence**: If a variable is already set in the environment, it will not be overridden by values in the `.env*` files. This behavior is critical when adjusting the loading order of these files.

## 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 @@ -40,7 +23,7 @@ To execute both **unit and functional** tests, run:

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

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

Expand All @@ -55,22 +38,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 @@ -89,37 +77,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: console-api.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://console-api.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>` |
71 changes: 71 additions & 0 deletions apps/api/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
version: "2.0"

services:
api:
image: <IMAGE_NAME>:<IMAGE_TAG>
depends-on: cloud-sql-proxy
env:
- DOPPLER_TOKEN=
- SENTRY_SERVER_NAME=
expose:
- port: 3080
as: 80
accept:
- console-api-sandbox-staging.akash.network
to:
- global: true
cloud-sql-proxy:
image: redm4x/cloud-sql-proxy:1.31.2
env:
- KeyPath=/custom/proxy_key.json
- ConnectionName=cloudmos-explorer:us-central1:cloudmos-postgresql
- Token=<AUTH>
command:
- "sh"
- "-c"
args:
- 'echo "${Token}" | base64 --decode > $KeyPath && /cloud_sql_proxy -instances=$ConnectionName=tcp:0.0.0.0:5432 -credential_file=$KeyPath'
expose:
- port: 5432
as: 5432
to:
- service: api

profiles:
compute:
api:
resources:
cpu:
units: 1
memory:
size: 2Gi
storage:
size: 2Gi
cloud-sql-proxy:
resources:
cpu:
units: 0.5
memory:
size: 512mi
storage:
size: 2Gi
placement:
dcloud:
pricing:
api:
denom: uakt
amount: 1000
cloud-sql-proxy:
denom: uakt
amount: 1000

deployment:
api:
dcloud:
profile: api
count: 1
cloud-sql-proxy:
dcloud:
profile: cloud-sql-proxy
count: 1
Loading

0 comments on commit 66d0f11

Please sign in to comment.