Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 44 additions & 42 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
POSTGRES_DB: postgres

healthcheck:
test: ['CMD-SHELL', 'pg_isready -U postgres']
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
Expand All @@ -40,15 +40,15 @@ services:
DB_PORT: 5432
START_BLOCK: 1
NETWORK_ENDPOINT: ${POLYMESH_CHAIN_WS:-ws://polymesh-node:9944}
NETWORK_HTTP_ENDPOINT: http://polymesh-node:9933
NETWORK_HTTP_ENDPOINT: http://polymesh-node:9944
NETWORK_CHAIN_ID: ${CHAIN_ID:-}
NODE_ENV: local
command:
- --batch-size=500
- -f=/app
- --local
healthcheck:
test: ['CMD', 'curl', '--fail', 'http://subquery-node:3000/ready']
test: ["CMD", "curl", "--fail", "http://subquery-node:3000/ready"]
interval: 20s
timeout: 5s
retries: 20
Expand Down Expand Up @@ -81,10 +81,10 @@ services:
healthcheck:
test:
[
'CMD',
'curl',
'--fail',
'subquery-graphql:3000/.well-known/apollo/server-health',
"CMD",
"curl",
"--fail",
"subquery-graphql:3000/.well-known/apollo/server-health",
]
interval: 10s
timeout: 5s
Expand All @@ -97,13 +97,12 @@ services:
- polymesh
ports:
- ${POLYMESH_CHAIN_WS_PORT:-9944}:9944
- ${POLYMESH_CHAIN_RPC_PORT:-9933}:9933
- ${POLYMESH_CHAIN_RPC_PORT:-9933}:9944
- ${POLYMESH_CHAIN_P2P_PORT:-30333}:30333
volumes:
- chain-data:/var/lib/polymesh
command:
- --base-path=/var/lib/polymesh
- --unsafe-ws-external
- --unsafe-rpc-external
- --wasm-execution=compiled
- --no-prometheus
Expand All @@ -116,12 +115,12 @@ services:
- --force-authoring
- --port=30333
- --alice
- --chain=dev
- --dev
configs:
- source: polymesh-healthcheck-libp2p
target: /usr/local/bin/polymesh-healthcheck-libp2p.sh
healthcheck:
test: ['CMD', '/usr/local/bin/polymesh-healthcheck-libp2p.sh']
test: ["CMD", "/usr/local/bin/polymesh-healthcheck-libp2p.sh"]
interval: 10s
timeout: 5s
retries: 10
Expand Down Expand Up @@ -150,17 +149,17 @@ services:
PORT: 3000
POLYMESH_NODE_URL: ${POLYMESH_CHAIN_WS:-ws://polymesh-node:9944}
POLYMESH_MIDDLEWARE_V2_URL: ${REST_MIDDLEWARE_URL:-http://subquery-graphql:3000}
AUTH_STRATEGY: 'open'
AUTH_STRATEGY: "open"
DEVELOPER_UTILS: true
VAULT_URL: 'http://vault:8200/v1/transit'
VAULT_URL: "http://vault:8200/v1/transit"
healthcheck:
test:
[
'CMD',
'wget',
'--spider',
'-q',
'http://polymesh-rest-api-vault-sm:3000/network/latest-block',
"CMD",
"wget",
"--spider",
"-q",
"http://polymesh-rest-api-vault-sm:3000/network/latest-block",
]
interval: 30s
timeout: 5s
Expand All @@ -172,7 +171,7 @@ services:
depends_on:
polymesh-rest-api-vault-sm:
condition: service_healthy
restart: 'no'
restart: "no"
entrypoint: /opt/polymesh-rest-api/init.sh
networks:
- polymesh
Expand Down Expand Up @@ -205,18 +204,18 @@ services:
PORT: 3000
POLYMESH_NODE_URL: ${POLYMESH_CHAIN_WS:-ws://polymesh-node:9944}
POLYMESH_MIDDLEWARE_V2_URL: ${REST_MIDDLEWARE_URL:-http://subquery-graphql:3000}
LOCAL_SIGNERS: 'alice,bob,charlie'
LOCAL_MNEMONICS: '//Alice,//Bob,//Charlie'
AUTH_STRATEGY: 'open'
LOCAL_SIGNERS: "alice,bob,charlie"
LOCAL_MNEMONICS: "//Alice,//Bob,//Charlie"
AUTH_STRATEGY: "open"
DEVELOPER_UTILS: true
healthcheck:
test:
[
'CMD',
'wget',
'--spider',
'-q',
'http://polymesh-rest-api-local-sm:3000/network/latest-block',
"CMD",
"wget",
"--spider",
"-q",
"http://polymesh-rest-api-local-sm:3000/network/latest-block",
]
interval: 30s
timeout: 5s
Expand All @@ -243,20 +242,23 @@ services:
# This will make sure vault is initialized and unsealed on the first run and unsealed on subsequent runs
vault-init:
image: hashicorp/vault:${VAULT_VERSION:-latest}
user: "0:0"
networks:
- polymesh
restart: 'no'
restart: "no"
depends_on:
vault:
condition: service_started
postgres:
condition: service_healthy
volumes:
- vault-root-token:/vault-token:rw
# This will prevent the container from creating additional volumes
tmpfs:
- /vault/file
- /vault/logs
environment:
VAULT_ADDR: 'http://vault:8200'
VAULT_ADDR: "http://vault:8200"
PGPASSWORD: postgres
PGUSER: postgres
PGDATABASE: services_status
Expand Down Expand Up @@ -301,7 +303,7 @@ services:
exit 0
fi
'
restart: 'no'
restart: "no"
networks:
- polymesh

Expand All @@ -328,25 +330,25 @@ configs:
volumes:
psql-data:
labels:
- 'network.polymesh.project=polymesh'
- 'network.polymesh.description=Indexer PostgreSQL data'
- "network.polymesh.project=polymesh"
- "network.polymesh.description=Indexer PostgreSQL data"
chain-data:
labels:
- 'network.polymesh.project=polymesh'
- 'network.polymesh.description=Polymesh chain data'
- "network.polymesh.project=polymesh"
- "network.polymesh.description=Polymesh chain data"
vault-volume:
labels:
- 'network.polymesh.project=polymesh'
- 'network.polymesh.description=Hashicorp Vault data'
- "network.polymesh.project=polymesh"
- "network.polymesh.description=Hashicorp Vault data"
vault-log-volume:
labels:
- 'network.polymesh.project=polymesh'
- 'network.polymesh.description=Hashicorp Vault logs'
- "network.polymesh.project=polymesh"
- "network.polymesh.description=Hashicorp Vault logs"
vault-root-token:
labels:
- 'network.polymesh.project=polymesh'
- 'network.polymesh.description=Hashicorp Vault root token'
- "network.polymesh.project=polymesh"
- "network.polymesh.description=Hashicorp Vault root token"
rest-api-accounts-init:
labels:
- 'network.polymesh.project=polymesh'
- 'network.polymesh.description=REST API signer init'
- "network.polymesh.project=polymesh"
- "network.polymesh.description=REST API signer init"
15 changes: 15 additions & 0 deletions envs/8.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
COMPOSE_PROJECT_NAME=polymesh

POLYMESH_CHAIN_IMAGE=polymeshassociation/polymesh:latest-develop-debian

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be pined to a v8 image

POLYMESH_CHAIN_WS_PORT=9944
POLYMESH_CHAIN_RPC_PORT=9933
POLYMESH_CHAIN_P2P_PORT=30333

POLYMESH_REST_API_IMAGE=polymeshassociation/polymesh-rest-api:v8.1.0-alpha.3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can now be updated to the released v8.1.0

POLYMESH_REST_API_LOCAL_SM_PORT=3004
POLYMESH_REST_API_VAULT_SM_PORT=3005

POLYMESH_SUBQUERY_IMAGE=polymeshassociation/polymesh-subquery:v19.6.0

POLYMESH_SUBQUERY_GRAPHQL_IMAGE=onfinality/subql-query:v2.25.0
POLYMESH_SUBQUERY_GRAPHQL_PORT=3000
8 changes: 4 additions & 4 deletions envs/latest
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
COMPOSE_PROJECT_NAME=polymesh

POLYMESH_CHAIN_IMAGE=polymeshassociation/polymesh:7.3.0-mainnet-debian
POLYMESH_CHAIN_IMAGE=polymeshassociation/polymesh:latest-develop-debian
POLYMESH_CHAIN_WS_PORT=9944
POLYMESH_CHAIN_RPC_PORT=9933
POLYMESH_CHAIN_P2P_PORT=30333

POLYMESH_REST_API_IMAGE=polymeshassociation/polymesh-rest-api:v8.1.0-alpha.1
POLYMESH_REST_API_IMAGE=polymeshassociation/polymesh-rest-api:v8.1.0-alpha.3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for latest should we use latest tags. Same comment for SubQuery.

Also should latest pull always as the tag is reused for new updates?

POLYMESH_REST_API_LOCAL_SM_PORT=3004
POLYMESH_REST_API_VAULT_SM_PORT=3005

POLYMESH_SUBQUERY_IMAGE=polymeshassociation/polymesh-subquery:v19.3.0
POLYMESH_SUBQUERY_IMAGE=polymeshassociation/polymesh-subquery:v19.6.0

POLYMESH_SUBQUERY_GRAPHQL_IMAGE=onfinality/subql-query:v2.9.0
POLYMESH_SUBQUERY_GRAPHQL_IMAGE=onfinality/subql-query:v2.25.0
POLYMESH_SUBQUERY_GRAPHQL_PORT=3000
1 change: 1 addition & 0 deletions scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export VAULT_TOKEN=$("${SCRIPT_DIR}/get-vault-token.sh")

# Run jest with default maxWorkers and any additional arguments passed to this script
echo "[RUN TESTS] Beginning tests..."
cd "${SCRIPT_DIR}/../tests"
yarn jest --maxWorkers=8 "$@"
2 changes: 1 addition & 1 deletion scripts/vault-init-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if ! command -v jq >/dev/null 2>&1; then
fi
if ! command -v psql >/dev/null 2>&1; then
apk update
apk add postgresql15-client
apk add postgresql-client
fi

/opt/vault/init.sh
15 changes: 15 additions & 0 deletions scripts/vault-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ set_status() {
psql -c "INSERT INTO status (service_name, service_available) VALUES ('vault', $1) ON CONFLICT (service_name) DO UPDATE SET service_available = EXCLUDED.service_available" > /dev/null
}

wait_for_postgres() {
SECONDS_DELTA=$SECONDS
while [[ $(($SECONDS - $SECONDS_DELTA)) -lt "$TIMEOUT_SECONDS" ]]; do
if psql -c "SELECT 1" > /dev/null 2>&1; then
echo "Postgres is ready"
return 0
fi
sleep 1
done

>&2 echo "Timed out waiting for Postgres to become ready"
return 1
}

wait_for_postgres
set_status "false"

initialize_vault() {
Expand Down
4 changes: 2 additions & 2 deletions tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"typescript": "^5.8.3"
},
"dependencies": {
"@polymeshassociation/local-signing-manager": "^4.0.0",
"@polymeshassociation/polymesh-sdk": "29.1.0-beta.15",
"@polymeshassociation/local-signing-manager": "^4.1.1",
"@polymeshassociation/polymesh-sdk": "30.0.0",
"cross-fetch": "^4.1.0",
"dotenv": "^16.5.0"
},
Expand Down
4 changes: 2 additions & 2 deletions tests/src/__tests__/rest/assets/controllerTransfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('Fungible AssetController transfer', () => {
expect(results).toContainEqual(
expect.objectContaining({
identity: issuer.did,
balance: '99990',
balance: '9990',
})
);
expect(results).toContainEqual(
Expand Down Expand Up @@ -117,7 +117,7 @@ describe('Fungible AssetController transfer', () => {
expect.arrayContaining([
{
identity: issuer.did,
balance: '100000',
balance: '10000',
},
])
);
Expand Down
Loading
Loading