Skip to content

Commit

Permalink
Merge pull request #129 from GeneralMagicio/staging
Browse files Browse the repository at this point in the history
staging to main
  • Loading branch information
aminlatifi authored Nov 3, 2024
2 parents 234cc93 + 5ecbff6 commit 01d2492
Show file tree
Hide file tree
Showing 60 changed files with 2,001 additions and 1,231 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
name: Run Inverter Sync Script
name: run-funding-pot-service

on:
schedule:
- cron: '0 0 * * 1' # Runs at midnight every Monday
# schedule:
# - cron: '0 0 * * 1' # Runs at midnight every Monday
workflow_dispatch: # This allows manual triggering

jobs:
run-script:
runs-on: ubuntu-latest

steps:
- name: SSH into Server and Run Inverter Sync Script
- name: SSH into Server and Run Funding Pot Service
uses: appleboy/[email protected]
env:
DELEGATE_PK_FOR_FUNDING_POT: ${{ secrets.DELEGATE_PK_FOR_FUNDING_POT }}
ANKR_API_KEY_FOR_FUNDING_POT: ${{ secrets.ANKR_API_KEY_FOR_FUNDING_POT }}
with:
host: ${{ secrets.STAGING_HOST }}
username: ${{ secrets.STAGING_USERNAME }}
key: ${{ secrets.STAGING_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd QAcc-BE
docker compose -f docker-compose-staging.yml exec qacc-be npm run sync:inverter:production
docker compose -f docker-compose-staging.yml exec qacc-be npm run execute:inverter:production
docker compose -f docker-compose-staging.yml logs qacc-be
16 changes: 14 additions & 2 deletions config/example.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
GRAPHQL_MODE=true
JOB_MODE=true

JWT_SECRET=
JWT_MAX_AGE=
TYPEORM_DATABASE_TYPE=
Expand Down Expand Up @@ -260,7 +263,7 @@ BASE_SEPOLIA_NODE_HTTP_URL=


ZKEVM_MAINNET_SCAN_API_URL=https://api-zkevm.polygonscan.com/api
ZKEVM_MAINET_SCAN_API_KEY=0000000000000000000000000000000000
ZKEVM_MAINNET_SCAN_API_KEY=0000000000000000000000000000000000
ZKEVM_CARDONA_SCAN_API_URL=https://api-cardona-zkevm.polygonscan.com/api
ZKEVM_CARDONA_SCAN_API_KEY=0000000000000000000000000000000000

Expand Down Expand Up @@ -288,4 +291,13 @@ PRIVADO_VERIFIER_NETWORK_ID=
PRIVADO_VERIFIER_CONTRACT_ADDRESS=
PRIVADO_REQUEST_ID=

INVERTER_GRAPHQL_ENDPOINT=
INVERTER_GRAPHQL_ENDPOINT=

# Funding pot service variables
DELEGATE_PK_FOR_FUNDING_POT=
ANKR_API_KEY_FOR_FUNDING_POT=

# Sync donations with ankr
ENABLE_ANKR_SYNC=
ANKR_RPC_URL=
ANKR_SYNC_CRONJOB_EXPRESSION=
13 changes: 11 additions & 2 deletions config/test.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
GRAPHQL_MODE=true
JOB_MODE=true

JWT_SECRET=00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
MAILER_JWT_SECRET=0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
JWT_MAX_AGE=7d
Expand Down Expand Up @@ -214,7 +217,7 @@ ZKEVM_MAINET_SCAN_API_KEY=0000000000000000000000000000000000
ZKEVM_CARDONA_SCAN_API_URL=https://api-cardona-zkevm.polygonscan.com/api
ZKEVM_CARDONA_SCAN_API_KEY=0000000000000000000000000000000000
# ZKEVM MAINNET we should fill it as Infura doesnt support polygon zkevm, I found this rpc link from https://chainlist.org/chain/1101
ZKEVM_MAINNET_NODE_HTTP_URL=https://polygon-zkevm.drpc.org
ZKEVM_MAINNET_NODE_HTTP_URL=https://zkevm-rpc.com

# ZKEVM CARDONA we should fill it as Infura doesnt support polygon zkevm, I found this rpc link from https://chainlist.org/chain/2442
ZKEVM_CARDONA_NODE_HTTP_URL=https://rpc.cardona.zkevm-rpc.com
Expand All @@ -230,4 +233,10 @@ PRIVADO_VERIFIER_NETWORK_ID=2442

INVERTER_GRAPHQL_ENDPOINT=https://indexer.bigdevenergy.link/a414bf3/v1/graphql

QACC_NETWORK_ID=11155420
QACC_NETWORK_ID=1101

QACC_DONATION_TOKEN_ADDRESS=0x22B21BedDef74FE62F031D2c5c8F7a9F8a4b304D
QACC_DONATION_TOKEN_DECIMALS=18
QACC_DONATION_TOKEN_NAME=Polygon Ecosystem Token
QACC_DONATION_TOKEN_SYMBOL=POL

24 changes: 22 additions & 2 deletions docker-compose-local.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
services:
qacc-be:
container_name: qacc-be
qacc-be-graph-ql:
container_name: qacc-be-graph-ql
build: .
profiles:
- server
command: npm run start:docker:locally
environment:
- ENVIRONMENT=local
- LOG_PATH=/usr/src/app/logs/qacc.log
- GRAPHQL_MODE=true
restart: always
volumes:
- ./config:/usr/src/app/config
Expand All @@ -18,6 +19,24 @@ services:
ports:
- '4001:4000'

qacc-be:
container_name: qacc-be-job
build: .
profiles:
- server
command: npm run start:docker:locally
environment:
- ENVIRONMENT=local
- LOG_PATH=/usr/src/app/logs/qacc.log
- JOB_MODE=true
restart: always
volumes:
- ./config:/usr/src/app/config
- ./config:/usr/src/app/build/config
- ./logs:/usr/src/app/logs
networks:
- qacc

qacc-postgres:
container_name: qacc-postgres
image: postgres:16
Expand Down Expand Up @@ -62,6 +81,7 @@ services:
image: redis:7-alpine
profiles:
- server
- test
- local
environment:
- REDIS_ALLOW_EMPTY_PASSWORD=yes
Expand Down
27 changes: 22 additions & 5 deletions docker-compose-production.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
services:
qacc-be:
container_name: qacc-be
qacc-be-graph-ql:
container_name: qacc-be-graph-ql
image: ghcr.io/generalmagicio/qacc-be:main
command: npm run start:docker:server
environment:
- ENVIRONMENT=production
- LOG_PATH=/usr/src/app/logs/qacc.log
- GRAPHQL_MODE=true
restart: always
volumes:
- ./config:/usr/src/app/config
- ./config:/usr/src/app/build/config
- ./logs:/usr/src/app/logs
- ./logs-graph-ql:/usr/src/app/logs
networks:
- qacc
ports:
- "4001:4000"
- '4001:4000'

qacc-be-job:
container_name: qacc-be-job
image: ghcr.io/generalmagicio/qacc-be:main
command: npm run start:docker:server
environment:
- ENVIRONMENT=production
- LOG_PATH=/usr/src/app/logs/qacc.log
- JOB_MODE=true
restart: always
volumes:
- ./config:/usr/src/app/config
- ./config:/usr/src/app/build/config
- ./logs-job:/usr/src/app/logs
networks:
- qacc

qacc-redis:
container_name: qacc-redis
Expand All @@ -27,7 +44,7 @@ services:
networks:
- qacc
ports:
- "6379:6379"
- '6379:6379'

caddy:
image: caddy:2-alpine
Expand Down
29 changes: 23 additions & 6 deletions docker-compose-staging.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
services:
qacc-be:
container_name: qacc-be
qacc-be-graph-ql:
container_name: qacc-be-graph-ql
image: ghcr.io/generalmagicio/qacc-be:staging
command: npm run start:docker:server
environment:
- ENVIRONMENT=production
- LOG_PATH=/usr/src/app/logs/qacc.log
- GRAPHQL_MODE=true
restart: always
volumes:
- ./config:/usr/src/app/config
- ./config:/usr/src/app/build/config
- ./logs:/usr/src/app/logs
- ./logs-graph-ql:/usr/src/app/logs
networks:
- qacc
ports:
- "4001:4000"
- '4001:4000'

qacc-be-job:
container_name: qacc-be-job
image: ghcr.io/generalmagicio/qacc-be:staging
command: npm run start:docker:server
environment:
- ENVIRONMENT=production
- LOG_PATH=/usr/src/app/logs/qacc.log
- JOB_MODE=true
restart: always
volumes:
- ./config:/usr/src/app/config
- ./config:/usr/src/app/build/config
- ./logs-job:/usr/src/app/logs
networks:
- qacc

qacc-redis:
container_name: qacc-redis
Expand All @@ -27,7 +44,7 @@ services:
networks:
- qacc
ports:
- "6379:6379"
- '6379:6379'

caddy:
image: caddy:2-alpine
Expand Down Expand Up @@ -56,4 +73,4 @@ volumes:
networks:
qacc:
name: qacc-be_qacc
external: true
external: true
Empty file added logs-graph-ql/.gitkeep
Empty file.
Empty file added logs-job/.gitkeep
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddIsBatchMintingExecutedFieldToRoundsTables1729133444025
implements MigrationInterface
{
name = 'AddIsBatchMintingExecutedFieldToRoundsTables1729133444025';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "qf_round" ADD "isBatchMintingExecuted" boolean NOT NULL DEFAULT false`,
);
await queryRunner.query(
`ALTER TABLE "early_access_round" ADD "isBatchMintingExecuted" boolean NOT NULL DEFAULT false`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "early_access_round" DROP COLUMN "isBatchMintingExecuted"`,
);
await queryRunner.query(
`ALTER TABLE "qf_round" DROP COLUMN "isBatchMintingExecuted"`,
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddBatchMintingTransactionNumbersToProject1730076158010
implements MigrationInterface
{
name = 'AddBatchMintingTransactionNumbersToProject1730076158010';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "project" ADD "numberOfBatchMintingTransactions" integer`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "project" DROP COLUMN "numberOfBatchMintingTransactions"`,
);
}
}
15 changes: 15 additions & 0 deletions migration/1730217125698-addAnkrState.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddAnkrState1730217125698 implements MigrationInterface {
name = 'AddAnkrState1730217125698';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "ankr_state" ("id" boolean NOT NULL, "timestamp" integer NOT NULL, CONSTRAINT "CHK_69b5646f9179ec91582413e97b" CHECK ("id"), CONSTRAINT "PK_3599fb1e1f37fa9a8da5b4113b7" PRIMARY KEY ("id"))`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE "ankr_state"`);
}
}
31 changes: 31 additions & 0 deletions migration/1730264518648-changeBatchNumberTXsFieldInPorjectTable.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class ChangeBatchNumberTXsFieldInPorjectTable1730264518648
implements MigrationInterface
{
name = 'ChangeBatchNumberTXsFieldInPorjectTable1730264518648';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "project" RENAME COLUMN "numberOfBatchMintingTransactions" TO "batchNumbersWithSafeTransactions"`,
);
await queryRunner.query(
`ALTER TABLE "project" DROP COLUMN "batchNumbersWithSafeTransactions"`,
);
await queryRunner.query(
`ALTER TABLE "project" ADD "batchNumbersWithSafeTransactions" integer array NOT NULL DEFAULT '{}'`,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "project" DROP COLUMN "batchNumbersWithSafeTransactions"`,
);
await queryRunner.query(
`ALTER TABLE "project" ADD "batchNumbersWithSafeTransactions" integer`,
);
await queryRunner.query(
`ALTER TABLE "project" RENAME COLUMN "batchNumbersWithSafeTransactions" TO "numberOfBatchMintingTransactions"`,
);
}
}
17 changes: 17 additions & 0 deletions migration/1730476526611-addDonationTransactionUniqIdx.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddDonationTransactionUniqIdx1730476526611
implements MigrationInterface
{
name = 'AddDonationTransactionUniqIdx1730476526611';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE UNIQUE INDEX "unique_transaction_id" ON "donation" ("transactionId") `,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP INDEX "public"."unique_transaction_id"`);
}
}
Loading

0 comments on commit 01d2492

Please sign in to comment.