Я пытаюсь развернуть свое приложение, состоящее из нескольких микросервисов, каждое из которых находится в разных контейнерах докера.Один из них (основной сервис, как показано ниже) зависает в pm2: client Вызывает сообщение метода демона Calling daemon method pm2:getMonitorData on rpc socket:/root/.pm2/rpc.sock
и продолжает печатать то же сообщение.Я попытался прочитать исходный код pm2, прочитать документацию и поискать везде в Интернете, но не смог найти решение.Вот журнал отладки.
main-service_1 | 2018-12-07T18:03:49.482Z axon:sock attempting reconnect
main-service_1 | 2018-12-07T18:03:49.482Z axon:sock closing
main-service_1 | 2018-12-07T18:03:49.482Z axon:sock closing 0 connections
main-service_1 | 2018-12-07T18:03:49.482Z pm2:client Daemon not launched
main-service_1 | 2018-12-07T18:03:49.482Z axon:sock connect attempt null:/root/.pm2/rpc.sock
main-service_1 | 2018-12-07T18:03:49: PM2 log: Launching in no daemon mode
main-service_1 | 2018-12-07T18:03:49.596Z axon:sock bind null:/root/.pm2/pub.sock
main-service_1 | 2018-12-07T18:03:49.597Z axon:sock bind null:/root/.pm2/rpc.sock
main-service_1 | 2018-12-07T18:03:49.602Z interactor:client Interaction file does not exists
main-service_1 | 2018-12-07T18:03:49.602Z interactor:client Secret key is not defined in configuration { version_management: { active: true },
main-service_1 | public_key: undefined,
main-service_1 | secret_key: undefined,
main-service_1 | machine_name: '572eeba2cd52',
main-service_1 | pm2_version: '3.2.2',
main-service_1 | reverse_interact: true,
main-service_1 | info_node: 'https://root.keymetrics.io',
main-service_1 | agent_transport_websocket: 'false',
main-service_1 | agent_transport_axon: 'true' }
main-service_1 | 2018-12-07T18:03:49.604Z pm2:client Launching RPC client on socket file /root/.pm2/rpc.sock
main-service_1 | 2018-12-07T18:03:49.604Z axon:sock connect attempt null:/root/.pm2/rpc.sock
main-service_1 | 2018-12-07T18:03:49.604Z axon:sock attempting reconnect
main-service_1 | 2018-12-07T18:03:49.604Z axon:sock closing
main-service_1 | 2018-12-07T18:03:49.604Z axon:sock closing 0 connections
main-service_1 | 2018-12-07T18:03:49.604Z interactor:client Interactor Daemon not launched
main-service_1 | 2018-12-07T18:03:49.604Z axon:sock connect attempt null:/root/.pm2/interactor.sock
main-service_1 | 2018-12-07T18:03:49.604Z axon:sock attempting reconnect
main-service_1 | 2018-12-07T18:03:49.604Z axon:sock closing
main-service_1 | 2018-12-07T18:03:49.604Z axon:sock closing 0 connections
main-service_1 | 2018-12-07T18:03:49.605Z interactor:client Interactor Daemon not launched
main-service_1 | 2018-12-07T18:03:49.605Z axon:sock connect attempt null:/root/.pm2/interactor.sock
main-service_1 | 2018-12-07T18:03:49.605Z axon:sock error ENOENT
main-service_1 | 2018-12-07T18:03:49.605Z axon:sock ignored ENOENT
main-service_1 | 2018-12-07T18:03:49.605Z axon:sock error ENOENT
main-service_1 | 2018-12-07T18:03:49.605Z axon:sock ignored ENOENT
main-service_1 | 2018-12-07T18:03:49.605Z axon:sock error ENOENT
main-service_1 | 2018-12-07T18:03:49.605Z axon:sock ignored ENOENT
main-service_1 | 2018-12-07T18:03:49.606Z axon:sock accept /root/.pm2/rpc.sock
main-service_1 | 2018-12-07T18:03:49.607Z axon:sock add socket 0
main-service_1 | 2018-12-07T18:03:49.608Z axon:sock connect
main-service_1 | 2018-12-07T18:03:49.608Z axon:sock add socket 0
main-service_1 | 2018-12-07T18:03:49.608Z axon:queue flush 0 messages
main-service_1 | 2018-12-07T18:03:49.608Z pm2:client RPC Connected to Daemon
main-service_1 | 2018-12-07T18:03:49.614Z axon:sock connect attempt null:/root/.pm2/pub.sock
main-service_1 | 2018-12-07T18:03:49.614Z axon:sock accept /root/.pm2/pub.sock
main-service_1 | 2018-12-07T18:03:49.614Z axon:sock add socket 0
main-service_1 | 2018-12-07T18:03:49.614Z axon:sock connect
main-service_1 | 2018-12-07T18:03:49.614Z axon:sock add socket 0
main-service_1 | 2018-12-07T18:03:49.615Z axon:sub subscribe to "log:*"
main-service_1 | 2018-12-07T18:03:49.615Z pm2:cli Resolved filepath /ecosystem.config.js
main-service_1 | 2018-12-07T18:03:49.639Z pm2:client Calling daemon method pm2:getMonitorData on rpc socket:/root/.pm2/rpc.sock
main-service_1 | 2018-12-07T18:03:49.662Z pm2:client Calling daemon method pm2:prepare on rpc socket:/root/.pm2/rpc.sock
main-service_1 | 2018-12-07T18:03:49: PM2 log: App [API:0] starting in -fork mode-
main-service_1 | 2018-12-07T18:03:49.665Z pm2:fork_mode stds: {"out":"/root/.pm2/logs/API-out-0.log","err":"/root/.pm2/logs/API-error-0.log"}
main-service_1 | 2018-12-07T18:03:49: PM2 log: App [API:0] online
main-service_1 | 2018-12-07T18:03:49.677Z pm2:god Error vizion::analyze() for given folder: /
main-service_1 | 2018-12-07T18:03:49.678Z pm2:god Error vizion::analyze() for given folder: /
main-service_1 | 2018-12-07T18:03:55.680Z pm2:client Calling daemon method pm2:getMonitorData on rpc socket:/root/.pm2/rpc.sock
main-service_1 | 2018-12-07T18:03:57.689Z pm2:client Calling daemon method pm2:getMonitorData on rpc socket:/root/.pm2/rpc.sock
main-service_1 | 2018-12-07T18:03:59.693Z pm2:client Calling daemon method pm2:getMonitorData on rpc socket:/root/.pm2/rpc.sock
main-service_1 | 2018-12-07T18:04:01.697Z pm2:client Calling daemon method pm2:getMonitorData on rpc socket:/root/.pm2/rpc.sock
Вот мой Dockerfile для mainService
FROM keymetrics/pm2:latest-jessie
COPY ./ ./
ENV MONGO_URL=http://localhost:3007/slickpoll_polls
ENV DEBUG=*
EXPOSE 3002
RUN npm install
RUN npm install -D ts-node
RUN npm install -D typescript
RUN pm2 install typescript
CMD [ "pm2-runtime", "start", "ecosystem.config.js" ]
А вот мой ecosystem.config.js
module.exports = {
apps : [{
name: 'API',
script: 'app.ts',
// Options reference: https://pm2.io/doc/en/runtime/reference/ecosystem-file/
instances: 1,
autorestart: true,
env: {
NODE_ENV: 'development'
},
env_production: {
NODE_ENV: 'production'
}
}]
};
А вотis docker-compose.yml
version: '3'
services:
users-database:
build: ./usersDatabase
volumes:
- ~/dbs/usersDatabase:/data/db
ports:
- 27017:3006
networks:
- usersdb
polls-database:
build: ./pollsDatabase
volumes:
- ~/dbs/pollsDatabase:/data/db
ports:
- 27017:3007
networks:
- pollsdb
users-service:
build: ./usersService
ports:
- 3004:3004
networks:
- users
- usersdb
depends_on:
- users-database
poll-service:
build: ./pollService
ports:
- 3003:3003
depends_on:
- polls-database
networks:
- pollsdb
- api
main-service:
build: ./mainService
ports:
- 3002:3002
networks:
- pollsdb
- users
- api
depends_on:
- users-database
- users-service
- polls-database
networks:
users:
driver: overlay
internal: true
usersdb:
driver: overlay
internal: true
pollsdb:
driver: overlay
internal: true
api:
Я потратил почти весь день на исправление этого, но не смог добиться успеха.У меня больше нет надежды решить это больше.Я надеюсь, что вы можете найти решение.