Skip to content

Commit

Permalink
fix: auto start platform services with docker-compose (#1043)
Browse files Browse the repository at this point in the history
* fix: auto start platform services with docker-compose

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

* chore: remove additional /

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>

---------

Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
  • Loading branch information
GHkrishna authored Oct 21, 2024
1 parent c87d8a1 commit 2c2c6f2
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 12 deletions.
130 changes: 130 additions & 0 deletions .env.demo
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
API_GATEWAY_PROTOCOL=http
API_GATEWAY_HOST=0.0.0.0
API_GATEWAY_PORT=5000
API_GATEWAY_PROTOCOL_SECURE=http
API_ENDPOINT=your-ip:5000

FRONT_END_URL=http://localhost:3001

MOBILE_APP=ADEYA
MOBILE_APP_NAME=ADEYA SSI App
MOBILE_APP_DOWNLOAD_URL='https://blockster.global/products/adeya'
PLAY_STORE_DOWNLOAD_LINK=https://play.google.com/store/apps/details?id=id.credebl.adeya&pli=1
IOS_DOWNLOAD_LINK=https://apps.apple.com/in/app/adeya-ssi-wallet/id6463845498

PLATFORM_NAME=CREDEBL
POWERED_BY=Blockster Labs Pvt. Ltd.
PLATFORM_WEB_URL=https://credebl.id/
POWERED_BY_URL=https://blockster.global
UPLOAD_LOGO_HOST=devapi.credebl.id
BRAND_LOGO=https://credebl.id/images/CREDEBL_LOGO.png
PLATFORM_ADMIN_EMAIL=platform.admin@yopmail.com

SOCKET_HOST=ws://your-ip:5000

NATS_HOST=your-ip
NATS_PORT=4222
NATS_URL=nats://your-ip:4222

REDIS_HOST=your-ip
REDIS_PORT=6379

SENDGRID_API_KEY=

WALLET_STORAGE_HOST=your-ip
WALLET_STORAGE_PORT=5432
WALLET_STORAGE_USER='postgres'
WALLET_STORAGE_PASSWORD='postgres'

CRYPTO_PRIVATE_KEY=dzIvVU5uMa0R3sYwdjEEuT4id17mPpjr
PLATFORM_URL=https://devapi.credebl.id
PLATFORM_PROFILE_MODE=DEV

PUBLIC_LOCALHOST_URL=http://localhost:5000
PUBLIC_DEV_API_URL=https://devapi.credebl.id
PUBLIC_QA_API_URL=https://qa-api.credebl.id
PUBLIC_PRODUCTION_API_URL=https://api.credebl.id
PUBLIC_SANDBOX_API_URL=https://sandboxapi.credebl.id
PUBLIC_PLATFORM_SUPPORT_EMAIL=support@blockster.global

AFJ_VERSION=credo-0.5.3:latest

PLATFORM_WALLET_NAME=platform-admin
PLATFORM_WALLET_PASSWORD='U2FsdGVkX19l6w/PpuicnGBYThBHolzF27oN0JwfWkc='
PLATFORM_SEED=000000000000000000000000Steward1
PLATFORM_ID=1

# The format for below is as follows: postgresql://{postgres.user}:{postgres.password}@{your-ip}:{postgres.port}/{database-name}
POOL_DATABASE_URL="postgresql://postgres:postgres@your-ip:5432/credebl"
DATABASE_URL="postgresql://postgres:postgres@your-ip:5432/credebl"

# Used for Bulk issuance of credential
# Optional (Can be skipped if Bulk issuance is not used)
AWS_ACCESS_KEY=
AWS_SECRET_KEY=
AWS_REGION=
AWS_BUCKET=

# Used for Adding org-logo during org creation and update
# Optional (Can be skipped if no image is added during org creation and updation)
AWS_PUBLIC_ACCESS_KEY=
AWS_PUBLIC_SECRET_KEY=
AWS_PUBLIC_REGION=
AWS_ORG_LOGO_BUCKET_NAME=

# Used for storing connection URL generated from Agent and creating shortened URL
# Required (As connecting to org requires Shortened url)
AWS_S3_STOREOBJECT_ACCESS_KEY=
AWS_S3_STOREOBJECT_SECRET_KEY=
AWS_S3_STOREOBJECT_REGION=
AWS_S3_STOREOBJECT_BUCKET=

# Please refere AWS to determine your bucket url
# https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html#path-style-access
SHORTENED_URL_DOMAIN='https://AWS_S3_STOREOBJECT_REGION.amazonaws.com/AWS_S3_STOREOBJECT_BUCKET'
DEEPLINK_DOMAIN='https://link.credebl.id?url='

ENABLE_CORS_IP_LIST=http://localhost:3000, http://localhost:3001, http://localhost:5000,http://localhost:8085,https://verify.credebl.id,https://verifyed.credebl.id,https://verify-api.credebl.id,https://qa.credebl.id,https://dev.credebl.id,https://credebl.id

USER_NKEY_SEED=SUAILBO6CYQF4RPIZYCVCFRIOMJ7BW33PFZDFEZKOHV65MN3W37FFJA3JY
API_GATEWAY_NKEY_SEED=SUAI7SDZAHS24I7JWOB77BK6EFE3ZS3NCF5FW22PMWCXGE56OBPYHK5734
ORGANIZATION_NKEY_SEED=SUABORS4UFEV2OAWNEXB7JA76XNOF7A6YJAFOGRZTWOEGCXER36P2NP7JQ
AGENT_PROVISIONING_NKEY_SEED=SUAIUEPEC5D4KMTLK45UOPZ45JQ5QUMMIIJY2UT37RMQE6GENBTJTT2MSQ
AGENT_SERVICE_NKEY_SEED=SUABOFFEQNQY7YR4BIZDJENJ5T24CCDYOYTVHBKQLEWTZUTPTL3EQ3IZ3U
VERIFICATION_NKEY_SEED=SUAOTKYQMN6RGVWLZII22A4EFURAT65H4PGU3G5QXKM427HZ3JKIQZ7KU4
LEDGER_NKEY_SEED=SUABKZWIZCMUROUKCSHL774UOLKFQZR2UPQXII5FCGXHF25GFQX2XLIPLI
ISSUANCE_NKEY_SEED=SUAG7GEESSHO2ZF4J2IUKB6QPF4ENTLO7MLXZSSF67MEETTFZWFGJNDYVU
CONNECTION_NKEY_SEED=SUALLWKCDN2KBB4YTZUNUUFP7ZNSI4PBXVK7X5FPNX6LQ3DCHFGYX4JPLQ
ECOSYSTEM_NKEY_SEED=SUAGUAGZZLT2LYEA3SRWFXCJL32MXR5GCBAZNYJLLIUH4O76GDEGQAYM74
CREDENTAILDEFINITION_NKEY_SEED=SUAAYNLVKEP2E4JPCJ7OYSQ6OFCDBQ3GCTOPARBXBNP64JFESDWH7N3FQA
SCHEMA_NKEY_SEED=SUAESXIRPE4PBJR26T44XPPIAONQ3YJTN45VSTRNZUW77GAF5RBP3SEBFA
UTILITIES_NKEY_SEED=SUAHLF3PYEGNN3J2LZHHT6LOQ4GQ2CPGATEO66XRXLCEE6QYSM26TKCNUM
CLOUD_WALLET_NKEY_SEED=SUAJ3VT7IFZXVE7SSTX3JFE6F2U6DYDROW6VTCCGFVVB6D7O6C7OWJWTPM
GEOLOCATION_NKEY_SEED=SUAA3YQLMQPKEK224OVFGENQ3VRYD57LNPJFMGDULOO57CUYOQLAA7KBJU
NOTIFICATION_NKEY_SEED=SUAF5V6RN6HHOLBJX6UV7443PBNT7NSAJ6YCUOW7LTZQ77PXXAMH25AHPI

KEYCLOAK_DOMAIN=http://localhost:8080/
KEYCLOAK_ADMIN_URL=http://localhost:8080
KEYCLOAK_MASTER_REALM=master
KEYCLOAK_MANAGEMENT_CLIENT_ID=adminClient
KEYCLOAK_MANAGEMENT_CLIENT_SECRET=
KEYCLOAK_REALM=credebl-platform

SCHEMA_FILE_SERVER_URL='https://schema.credebl.id/schemas/'
SCHEMA_FILE_SERVER_TOKEN=

GEO_LOCATION_MASTER_DATA_IMPORT_SCRIPT=/prisma/scripts/geo_location_data_import.sh
UPDATE_CLIENT_CREDENTIAL_SCRIPT=/prisma/scripts/update_client_credential_data.sh
# Note: the below 3 variables are only in case of starting services using docker
AFJ_AGENT_TOKEN_PATH=/agent-provisioning/AFJ/token/
AFJ_AGENT_SPIN_UP=/agent-provisioning/AFJ/scripts/docker_start_agent.sh
AFJ_AGENT_ENDPOINT_PATH=/agent-provisioning/AFJ/endpoints/
# Uncomment bellow three lines and comment the above to start services locally without using docker, using pnpm
# AFJ_AGENT_TOKEN_PATH=/apps/agent-provisioning/AFJ/token/
# AFJ_AGENT_SPIN_UP=/apps/agent-provisioning/AFJ/scripts/docker_start_agent.sh
# AFJ_AGENT_ENDPOINT_PATH=/apps/agent-provisioning/AFJ/endpoints/

AGENT_PROTOCOL=http
OOB_BATCH_SIZE=10
MAX_ORG_LIMIT=10
FIDO_API_ENDPOINT=http://localhost:8000
21 changes: 14 additions & 7 deletions agent.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,24 @@ IDLE_TIMEOUT=30000
SESSION_ACQUIRE_TIMEOUT=2147483647
SESSION_LIMIT=2147483647
INMEMORY_LRU_CACHE_LIMIT=2147483647
windowMs=1000
maxRateLimit=800
BCOVRIN_REGISTER_URL=http://test.bcovrin.vonx.io/register
INDICIO_NYM_URL=https://selfserve.indiciotech.io/nym
# Contract address for Polygon amoy (testnet)
SCHEMA_MANAGER_CONTRACT_ADDRESS=0x4742d43C2dFCa5a1d4238240Afa8547Daf87Ee7a
DID_CONTRACT_ADDRESS=0xcB80F37eDD2bE3570c6C9D5B0888614E04E1e49E
RPC_URL=https://rpc-amoy.polygon.technology

# Contract address for Polygon (mainnet)
SCHEMA_MANAGER_CONTRACT_ADDRESS=0x4B16719E73949a62E9A7306F352ec73F1B143c27
DID_CONTRACT_ADDRESS=0x0C16958c4246271622201101C83B9F0Fc7180d15
RPC_URL=https://polygon-rpc.com
# Contract address for Polygon (testnet)
# SCHEMA_MANAGER_CONTRACT_ADDRESS=0x4742d43C2dFCa5a1d4238240Afa8547Daf87Ee7a
# DID_CONTRACT_ADDRESS=0xcB80F37eDD2bE3570c6C9D5B0888614E04E1e49E
# RPC_URL=https://rpc-amoy.polygon.technology

# Add url and token from your file server
SERVER_URL=https://schema.credebl.id
FILE_SERVER_TOKEN=
windowMs=1000
maxRateLimit=800

BCOVRIN_TEST_GENESIS='{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node1","blskey":"4N8aUNHSgjQVgkpm8nhNEfDf6txHznoYREg9kirmJrkivgL4oSEimFF6nsQ6M41QvhM2Z33nves5vfSn9n1UwNFJBYtWVnHYMATn76vLuL3zU88KyeAYcHfsih3He6UHcXDxcaecHVz6jhCYz1P2UZn2bDVruL5wXpehgBfBaLKm3Ba","blskey_pop":"RahHYiCvoNCtPTrVtP7nMC5eTYrsUA8WjXbdhNc8debh1agE9bGiJxWBXYNFbnJXoXhWFMvyqhqhRoq737YQemH5ik9oL7R4NTTCz2LEZhkgLJzB3QRQqJyBNyv7acbdHrAT8nQ9UkLbaVL9NBpnWXBTw4LEMePaSHEw66RzPNdAX1","client_ip":"138.197.138.255","client_port":9702,"node_ip":"138.197.138.255","node_port":9701,"services":["VALIDATOR"]},"dest":"Gw6pDLhcBcoQesN72qfotTgFa7cbuqZpkX3Xo6pLhPhv"},"metadata":{"from":"Th7MpTaRZVRYnPiabds81Y"},"type":"0"},"txnMetadata":{"seqNo":1,"txnId":"fea82e10e894419fe2bea7d96296a6d46f50f93f9eeda954ec461b2ed2950b62"},"ver":"1"}
{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node2","blskey":"37rAPpXVoxzKhz7d9gkUe52XuXryuLXoM6P6LbWDB7LSbG62Lsb33sfG7zqS8TK1MXwuCHj1FKNzVpsnafmqLG1vXN88rt38mNFs9TENzm4QHdBzsvCuoBnPH7rpYYDo9DZNJePaDvRvqJKByCabubJz3XXKbEeshzpz4Ma5QYpJqjk","blskey_pop":"Qr658mWZ2YC8JXGXwMDQTzuZCWF7NK9EwxphGmcBvCh6ybUuLxbG65nsX4JvD4SPNtkJ2w9ug1yLTj6fgmuDg41TgECXjLCij3RMsV8CwewBVgVN67wsA45DFWvqvLtu4rjNnE9JbdFTc1Z4WCPA3Xan44K1HoHAq9EVeaRYs8zoF5","client_ip":"138.197.138.255","client_port":9704,"node_ip":"138.197.138.255","node_port":9703,"services":["VALIDATOR"]},"dest":"8ECVSk179mjsjKRLWiQtssMLgp6EPhWXtaYyStWPSGAb"},"metadata":{"from":"EbP4aYNeTHL6q385GuVpRV"},"type":"0"},"txnMetadata":{"seqNo":2,"txnId":"1ac8aece2a18ced660fef8694b61aac3af08ba875ce3026a160acbc3a3af35fc"},"ver":"1"}
{"reqSignature":{},"txn":{"data":{"data":{"alias":"Node3","blskey":"3WFpdbg7C5cnLYZwFZevJqhubkFALBfCBBok15GdrKMUhUjGsk3jV6QKj6MZgEubF7oqCafxNdkm7eswgA4sdKTRc82tLGzZBd6vNqU8dupzup6uYUf32KTHTPQbuUM8Yk4QFXjEf2Usu2TJcNkdgpyeUSX42u5LqdDDpNSWUK5deC5","blskey_pop":"QwDeb2CkNSx6r8QC8vGQK3GRv7Yndn84TGNijX8YXHPiagXajyfTjoR87rXUu4G4QLk2cF8NNyqWiYMus1623dELWwx57rLCFqGh7N4ZRbGDRP4fnVcaKg1BcUxQ866Ven4gw8y4N56S5HzxXNBZtLYmhGHvDtk6PFkFwCvxYrNYjh","client_ip":"138.197.138.255","client_port":9706,"node_ip":"138.197.138.255","node_port":9705,"services":["VALIDATOR"]},"dest":"DKVxG2fXXTU8yT5N7hGEbXB3dfdAnYv1JczDUHpmDxya"},"metadata":{"from":"4cU41vWW82ArfxJxHkzXPG"},"type":"0"},"txnMetadata":{"seqNo":3,"txnId":"7e9f355dffa78ed24668f0e0e369fd8c224076571c51e2ea8be5f26479edebe4"},"ver":"1"}
Expand Down Expand Up @@ -168,4 +175,4 @@ SOVRIN_STAGING_NET='{"reqSignature":{},"txn":{"data":{"data":{"alias":"australia
{"reqSignature":{"type":"ED25519","values":[{"from":"6feBTywcmJUriqqnGc1zSJ","value":"5VB9ELm2QkWug8s29obUiSxq5tWi588wnYX5nXJEmm5ewoVR5NSTHQcg9q2nm1rcy2aesVsB77e5LLWpae7uqjkb"}]},"txn":{"data":{"data":{"alias":"singapore","services":[]},"dest":"Dh99uW8jSNRBiRQ4JEMpGmJYvzmF35E6ibnmAAf7tbk8"},"metadata":{"digest":"0fb35dbf7589f7acfa487aa1eed473299d1405ed2c656b50b15175e5487f4aa9","from":"6feBTywcmJUriqqnGc1zSJ","payloadDigest":"0359d686d0935df89d4b8fbad5b7264104f2eef898a93cc388e67188d71980e4","reqId":1558034282845794593},"protocolVersion":2,"type":"0"},"txnMetadata":{"seqNo":132,"txnTime":1558034283},"ver":"1"}
{"reqSignature":{"type":"ED25519","values":[{"from":"6feBTywcmJUriqqnGc1zSJ","value":"2wMAYGVoSt3ZtU3CzcvhzMAQ2EFhZvPwBsGKqpNmWvKVWbFeyC6yMZxHCVdtj2fqfj36FJkvPKkh3gwmvvrt6eeW"}]},"txn":{"data":{"data":{"alias":"virginia","services":[]},"dest":"EoGRm7eRADtHJRThMCrBXMUM2FpPRML19tNxDAG8YTP8"},"metadata":{"digest":"4ee79b267e7a5aa9ca96ee667f75dadfafdf1238c2841d2d5fa28accf542331c","from":"6feBTywcmJUriqqnGc1zSJ","payloadDigest":"1b4afb24a5d19cf90eb41bb9c265610a6922c6e0aa59386dc3af2016988f4dc6","reqId":1558034311268528084},"protocolVersion":2,"type":"0"},"txnMetadata":{"seqNo":133,"txnTime":1558034311},"ver":"1"}
{"reqSignature":{"type":"ED25519","values":[{"from":"6feBTywcmJUriqqnGc1zSJ","value":"3QyhWLE53fg8wsNRFJijV6QKax2deCAzhUa1g152KYJ7exk1iqv6mLsHtY5KXNiXLg1a8vxQiFj8Hp8iRb7CXrCA"}]},"txn":{"data":{"data":{"alias":"RFCU","services":[]},"dest":"2B8bkZX3SvcBq3amP7aeATsSPz82RyyCJQbEjZpLgZLh"},"metadata":{"digest":"58c132bc0b8c96fb7628e8b7af9a9086ff2b2c894091090f88eb328ee945fe28","from":"6feBTywcmJUriqqnGc1zSJ","payloadDigest":"64b6882e3cbf71154369d91f9da431d069b465116dada6ba685928cd11c7b9e3","reqId":1558034435821210238},"protocolVersion":2,"type":"0"},"txnMetadata":{"seqNo":134,"txnTime":1558034436},"ver":"1"}
'
'
8 changes: 5 additions & 3 deletions apps/agent-provisioning/AFJ/scripts/docker_start_agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ cat <<EOF >${CONFIG_FILE}
"$PROTOCOL"
],
"webhookUrl": "$WEBHOOK_HOST/wh/$AGENCY",
"adminPort": "$ADMIN_PORT",
"adminPort": $ADMIN_PORT,
"tenancy": $TENANT
}
EOF
Expand All @@ -170,6 +170,8 @@ services:
environment:
AFJ_REST_LOG_LEVEL: 1
ROOT_PATH: ${ROOT_PATH}
env_file:
- /app/agent.env
ports:
- ${INBOUND_PORT}:${INBOUND_PORT}
- ${ADMIN_PORT}:${ADMIN_PORT}
Expand All @@ -194,7 +196,7 @@ if [ $? -eq 0 ]; then
echo "container-name::::::${CONTAINER_NAME}"
echo "file-name::::::$FILE_NAME"

docker compose -f $FILE_NAME up -d
docker-compose -f $FILE_NAME up -d
if [ $? -eq 0 ]; then

n=0
Expand Down Expand Up @@ -223,7 +225,7 @@ if [ $? -eq 0 ]; then
container_logs=$(docker logs $(docker ps -q --filter "name=${AGENCY}_${CONTAINER_NAME}"))

# Extract the token from the logs using sed
token=$(echo "$container_logs" | sed -nE 's/.*API Toekn: ([^ ]+).*/\1/p')
token=$(echo "$container_logs" | sed -nE 's/.*API Token: ([^ ]+).*/\1/p')

# Print the extracted token
echo "Token: $token"
Expand Down
2 changes: 1 addition & 1 deletion apps/agent-provisioning/AFJ/scripts/start_agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ if [ $? -eq 0 ]; then

docker rm -f "${PROJECT_NAME}" || true

docker compose -f $FILE_NAME --project-name "${PROJECT_NAME}" up -d
docker-compose -f $FILE_NAME --project-name "${PROJECT_NAME}" up -d
if [ $? -eq 0 ]; then

n=0
Expand Down
29 changes: 28 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,20 @@ services:
dockerfile: Dockerfiles/Dockerfile.user
env_file:
- ./.env
utility:
depends_on:
- nats # Use depends_on instead of needs
- api-gateway
build:
context: ./ # Adjust the context path as needed
dockerfile: Dockerfiles/Dockerfile.utility
env_file:
- ./.env
connection:
depends_on:
- nats # Use depends_on instead of needs
- api-gateway
- utility
- user
build:
context: ./ # Adjust the context path as needed
Expand Down Expand Up @@ -122,6 +132,7 @@ services:
- $PWD/apps/agent-provisioning/AFJ/agent-config:/app/agent-provisioning/AFJ/agent-config
- /var/run/docker.sock:/var/run/docker.sock
- /app/agent-provisioning/AFJ/token:/app/agent-provisioning/AFJ/token
- $PWD/agent.env:/app/agent.env
agent-service:
depends_on:
- nats # Use depends_on instead of needs
Expand All @@ -143,7 +154,23 @@ services:
- /var/run/docker.sock:/var/run/docker.sock
volumes_from:
- agent-provisioning

cloud-wallet:
depends_on:
- nats
- api-gateway
- user
- connection
- issuance
- ledger
- organization
- verification
- agent-provisioning
- agent-service
build:
context: ./ # Adjust the context path as needed
dockerfile: Dockerfiles/Dockerfile.cloud-wallet
env_file:
- ./.env



Expand Down

0 comments on commit 2c2c6f2

Please sign in to comment.