Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement redis queue #15

Merged
merged 14 commits into from
Sep 13, 2024
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ but likely needed for production and test deployments.
| POSTGRES_PASSWORD | PosgreSQL database password | None |
| POSTGRES_ADMIN_USER | PosgreSQL database admin user | None |
| POSTGRES_ADMIN_PASSWORD | PosgreSQL database admin password | None |
| REDIS_HOST | Redis database host user. This system will only function if this variable is defined. (Recommended for production mode) | None |
| REDIS_PASSWORD | Redis database password | None |


> **Note**: While not mandatory, it is recommended to set an agent public DID matching external hostname (e.g. if your Service Agent instance is accessable in `https://myagent.com:3000` you must set AGENT_PUBLIC_DID to `did:web:myagent.com%3A3000`), which will make possible for the agent to create its own creadential types and therefore issue credentials. Note that you'll need HTTPS in order to fully support did:web specification.
Expand Down
20 changes: 20 additions & 0 deletions examples/chatbot/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,25 @@ services:
- PORT=5000
- SERVICE_AGENT_ADMIN_BASE_URL=http://chatbot-service-agent:3000
- PNVS_SERVICE_AGENT_ADMIN_BASE_URL=http://10.82.14.12:3100

redis:
image: redis:alpine
restart: always
networks:
- chatbot
ports:
- 6379:6379
command: redis-server --maxmemory 64mb --maxmemory-policy allkeys-lru

postgres:
image: postgres:15.2
restart: always
networks:
- chatbot
ports:
- 5432:5432
environment:
- POSTGRES_PASSWORD=64270demo
- POSTGRES_USER=emailvs
networks:
chatbot:
20 changes: 20 additions & 0 deletions examples/phonenumbervs/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,25 @@ services:
environment:
- PORT=5000
- SERVICE_AGENT_ADMIN_BASE_URL=http://phonenumbervs-service-agent:3000

redis:
image: redis:alpine
restart: always
networks:
- phonenumbervs
ports:
- 6379:6379
command: redis-server --maxmemory 64mb --maxmemory-policy allkeys-lru

postgres:
image: postgres:15.2
restart: always
networks:
- phonenumbervs
ports:
- 5432:5432
environment:
- POSTGRES_PASSWORD=64270demo
- POSTGRES_USER=emailvs
networks:
phonenumbervs:
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@
"@credo-ts/question-answer": "^0.5.2",
"@hyperledger/anoncreds-nodejs": "^0.2.2",
"@hyperledger/aries-askar-nodejs": "^0.2.1",
"@nestjs/bull": "^10.2.1",
"@nestjs/common": "^10.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/platform-express": "^10.0.0",
"@nestjs/swagger": "^7.3.0",
"@types/qrcode": "^1.5.0",
"body-parser": "^1.20.0",
"bull": "^4.16.2",
"cors": "^2.8.5",
"credo-ts-didweb-anoncreds": "^0.0.1-alpha.10",
"credo-ts-media-sharing": "^0.0.1-alpha.9",
Expand Down
12 changes: 12 additions & 0 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ import { ConnectionController } from './controllers/connections/ConnectionContro
import { CredentialTypesController } from './controllers/credentials/CredentialTypeController'
import { InvitationController } from './controllers/invitation/InvitationController'
import { QrController } from './controllers/invitation/QrController'
import {
CoreMessageService,
MessageService,
MessageServiceFactory,
RedisMessageService,
} from './controllers/message'
import { MessageController } from './controllers/message/MessageController'
import { PresentationsController } from './controllers/presentations/PresentationsController'
import { VCAuthNController } from './controllers/vcauthn/VCAuthNController'
import { HandledRedisModule } from './modules/redis.module'
import { AgentService } from './services/AgentService'
import { UrlShorteningService } from './services/UrlShorteningService'
import { ServiceAgent } from './utils/ServiceAgent'
Expand All @@ -17,6 +24,7 @@ export class ServiceAgentModule {
static register(agent: ServiceAgent): DynamicModule {
return {
module: ServiceAgentModule,
imports: [HandledRedisModule.forRoot()],
controllers: [
AgentController,
ConnectionController,
Expand All @@ -34,6 +42,10 @@ export class ServiceAgentModule {
},
AgentService,
UrlShorteningService,
MessageService,
RedisMessageService,
CoreMessageService,
MessageServiceFactory,
],
exports: [AgentService],
}
Expand Down
Loading