LiskArchive / lisk-service

:gear: API based service provider to Lisk user interfaces
https://lisk.com
Apache License 2.0
32 stars 15 forks source link

Unable to start docker compose with Lisk Service #1808

Closed lavrd closed 10 months ago

lavrd commented 1 year ago

Actual behavior

docker compose up -d works, but core service can't start.

Expected behavior

docker compose up -d works, core service can start.

Steps to reproduce

docker compose up -d

Which version(s) does this affect? (Environment, OS, etc...)

Linux/Fedora

Docker compose file (I took your file from 0.6.5 branch, example .env, and executed make pring-config):

name: lisk-service
services:
  core:
    depends_on:
      mysql:
        condition: service_healthy
        required: true
      nats:
        condition: service_started
        required: true
      redis_persistent:
        condition: service_started
        required: true
      redis_volatile:
        condition: service_started
        required: true
    environment:
      ENABLE_APPLY_SNAPSHOT: ""
      ENABLE_FEE_ESTIMATOR_FULL: "false"
      ENABLE_FEE_ESTIMATOR_QUICK: "true"
      ENABLE_TRANSACTION_STATS: "true"
      GENESIS_HEIGHT: ""
      GEOIP_JSON: ""
      INDEX_N_BLOCKS: "0"
      INDEX_SNAPSHOT_URL: ""
      LISK_CORE_WS: ws://host.docker.internal:12400
      LISK_STATIC: https://static-data.lisk.com
      SERVICE_BROKER: nats://nats:4222
      SERVICE_CORE_MYSQL: mysql://root:password@mysql:3306/lisk
      SERVICE_CORE_REDIS: redis://redis_persistent:6379/0
      SERVICE_CORE_REDIS_VOLATILE: redis://redis_volatile:6379/0
      SNAPSHOT_ALLOW_INSECURE_HTTP: ""
      TRANSACTION_STATS_HISTORY_LENGTH_DAYS: "366"
    extra_hosts:
    - host.docker.internal:host-gateway
    image: lisk/service_core:0.6.5
    networks:
      services_network: null
    restart: always
  export:
    depends_on:
      nats:
        condition: service_started
        required: true
      redis_persistent:
        condition: service_started
        required: true
      redis_volatile:
        condition: service_started
        required: true
    environment:
      SERVICE_BROKER: nats://nats:4222
      SERVICE_EXPORT_PARTIALS: /home/lisk/lisk-service/export/data/partials
      SERVICE_EXPORT_REDIS: redis://redis_persistent:6379/3
      SERVICE_EXPORT_REDIS_VOLATILE: redis://redis_volatile:6379/3
      SERVICE_EXPORT_STATIC: /home/lisk/lisk-service/export/data/static
    image: lisk/service_export:0.6.5
    networks:
      services_network: null
    restart: always
    volumes:
    - type: volume
      source: export-data
      target: /home/lisk/lisk-service/export/data
      volume: {}
  gateway:
    depends_on:
      core:
        condition: service_started
        required: true
      nats:
        condition: service_started
        required: true
      redis_volatile:
        condition: service_started
        required: true
    environment:
      ENABLE_HTTP_API: http-status,http-version2,http-exports
      ENABLE_HTTP_CACHE_CONTROL: "false"
      ENABLE_WS_API: blockchain,rpc-v2
      ENABLE_WS_RATELIMIT: "false"
      HTTP_CACHE_CONTROL_DIRECTIVES: public,max-age=10
      SERVICE_BROKER: nats://nats:4222
      SERVICE_GATEWAY_REDIS_VOLATILE: redis://redis_volatile:6379/1
      WS_RATELIMIT_DURATION: "1"
      WS_RATELIMIT_POINTS: "5"
    healthcheck:
      test:
      - CMD-SHELL
      - curl --fail http://gateway:9901/api/v2/transactions
    image: lisk/service_gateway:0.6.5
    networks:
      services_network: null
    ports:
    - mode: ingress
      target: 9901
      published: "9901"
      protocol: tcp
    restart: always
  market:
    depends_on:
      nats:
        condition: service_started
        required: true
      redis_persistent:
        condition: service_started
        required: true
    environment:
      EXCHANGERATESAPI_IO_API_KEY: ""
      SERVICE_BROKER: nats://nats:4222
      SERVICE_MARKET_FIAT_CURRENCIES: USD
      SERVICE_MARKET_REDIS: redis://redis_persistent:6379/2
      SERVICE_MARKET_TARGET_PAIRS: LSK_BTC,LSK_USD
    image: lisk/service_market:0.6.5
    networks:
      services_network: null
    restart: always
  mysql:
    command:
    - mysqld
    - --default-authentication-plugin=mysql_native_password
    - --character-set-server=utf8mb4
    - --collation-server=utf8mb4_unicode_ci
    - --max_connections=500
    environment:
      MYSQL_ROOT_PASSWORD: password
    healthcheck:
      test:
      - CMD
      - mysqladmin
      - ping
      - -hlocalhost
      - -ppassword
      timeout: 20s
      retries: 10
    image: mysql:8
    networks:
      services_network: null
    platform: linux/amd64
    restart: always
    volumes:
    - type: volume
      source: mysql-data
      target: /var/lib/mysql
      volume: {}
    - type: bind
      source: /home/fedora/dev/github/rise/lisk-service/docker/mysql-init
      target: /docker-entrypoint-initdb.d
      bind:
        create_host_path: true
  nats:
    image: nats:2.6-alpine
    networks:
      services_network: null
    restart: always
  newsfeed:
    depends_on:
      mysql:
        condition: service_healthy
        required: true
      nats:
        condition: service_started
        required: true
    environment:
      SERVICE_BROKER: nats://nats:4222
      SERVICE_NEWSFEED_MYSQL: mysql://root:password@mysql:3306/newsfeed
      TWITTER_ACCESS_TOKEN_KEY: ""
      TWITTER_ACCESS_TOKEN_SECRET: ""
      TWITTER_CONSUMER_KEY: ""
      TWITTER_CONSUMER_SECRET: ""
    image: lisk/service_newsfeed:0.6.5
    networks:
      services_network: null
    restart: always
  redis_persistent:
    command:
    - redis-server
    - /etc/redis/redis.conf
    healthcheck:
      test:
      - CMD-SHELL
      - redis-cli ping
    image: redis:5-alpine
    networks:
      services_network: null
    restart: always
    volumes:
    - type: bind
      source: /home/fedora/dev/github/rise/lisk-service/docker/redis.persistent.conf
      target: /etc/redis/redis.conf
      read_only: true
      bind:
        create_host_path: true
    - type: volume
      source: redis-data
      target: /data
      volume: {}
  redis_volatile:
    command:
    - redis-server
    - /etc/redis/redis.conf
    healthcheck:
      test:
      - CMD-SHELL
      - redis-cli ping
    image: redis:5-alpine
    networks:
      services_network: null
    restart: always
    volumes:
    - type: bind
      source: /home/fedora/dev/github/rise/lisk-service/docker/redis.volatile.conf
      target: /etc/redis/redis.conf
      read_only: true
      bind:
        create_host_path: true
networks:
  services_network:
    name: lisk-service_services_network
volumes:
  export-data:
    name: lisk-service_export-data
  mysql-data:
    name: lisk-service_mysql-data
  redis-data:
    name: lisk-service_redis-data

Logs:

lisk-service-core-1  | 2023-08-20T12:26:43.294 INFO [BROKER] Moleculer v0.14.28 is starting...
lisk-service-core-1  | 2023-08-20T12:26:43.296 INFO [BROKER] Namespace: <not defined>
lisk-service-core-1  | 2023-08-20T12:26:43.296 INFO [BROKER] Node ID: d3a9e5799e6c-1
lisk-service-core-1  | 2023-08-20T12:26:43.297 INFO [REGISTRY] Strategy: RoundRobinStrategy
lisk-service-core-1  | 2023-08-20T12:26:43.297 INFO [REGISTRY] Discoverer: LocalDiscoverer
lisk-service-core-1  | 2023-08-20T12:26:43.298 INFO [BROKER] Serializer: JSONSerializer
lisk-service-core-1  | 2023-08-20T12:26:43.298 INFO [BROKER] Validator: FastestValidator
lisk-service-core-1  | 2023-08-20T12:26:43.300 INFO [BROKER] Registered 13 middleware(s).
lisk-service-core-1  | 2023-08-20T12:26:43.301 INFO [TRANSPORTER] NATS lib version:,1.4.12
lisk-service-core-1  | 2023-08-20T12:26:43.301 INFO [BROKER] Transporter: NatsTransporter
lisk-service-core-1  | 2023-08-20T12:26:43.434 INFO [app] Found a node, initiating Lisk Core...
lisk-service-core-1  | 2023-08-20T12:26:43.479 INFO [queue] Initialized queue defaultQueue
lisk-service-core-1  | 2023-08-20T12:26:43.486 INFO [mysql] Attempting to connect mysql://*******:*******@mysql:3306/lisk...
lisk-service-core-1  | 2023-08-20T12:26:43.597 INFO [mysql] Creating schema for accounts
lisk-service-core-1  | 2023-08-20T12:26:43.625 INFO [mysql] Creating schema for votes_aggregate
lisk-service-core-1  | 2023-08-20T12:26:43.627 INFO [mysql] Creating schema for votes
lisk-service-core-1  | 2023-08-20T12:26:43.629 INFO [mysql] Creating schema for transactions
lisk-service-core-1  | 2023-08-20T12:26:43.633 INFO [mysql] Creating schema for multisignature
lisk-service-core-1  | 2023-08-20T12:26:43.634 INFO [mysql] Creating schema for blocks
lisk-service-core-1  | 2023-08-20T12:26:43.635 INFO [app] Checking for node sync status
lisk-service-core-1  | 2023-08-20T12:26:43.738 INFO [app] Node synchronization is complete
lisk-service-core-1  | node:internal/modules/cjs/loader:933
lisk-service-core-1  |   const err = new Error(message);
lisk-service-core-1  |               ^
lisk-service-core-1  | 
lisk-service-core-1  | 
lisk-service-core-1  | Error: Cannot find module './undefined'
lisk-service-core-1  | Require stack:
lisk-service-core-1  | - /home/lisk/lisk-service/core/shared/core/compat/index.js
lisk-service-core-1  | - /home/lisk/lisk-service/core/shared/core/blocks.js
lisk-service-core-1  | - /home/lisk/lisk-service/core/shared/core/index.js
lisk-service-core-1  | - /home/lisk/lisk-service/core/methods/api_v2/controllers/accounts.js
lisk-service-core-1  | - /home/lisk/lisk-service/core/methods/api_v2/accounts.js
lisk-service-core-1  | - /home/lisk/lisk-service/core/node_modules/require-all/index.js
lisk-service-core-1  | - /home/lisk/lisk-service/core/node_modules/lisk-service-framework/src/requireAllJs.js
lisk-service-core-1  | - /home/lisk/lisk-service/core/node_modules/lisk-service-framework/src/microservice.js
lisk-service-core-1  | - /home/lisk/lisk-service/core/node_modules/lisk-service-framework/index.js
lisk-service-core-1  | - /home/lisk/lisk-service/core/app.js
lisk-service-core-1  |     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
lisk-service-core-1  |     at Function.Module._load (node:internal/modules/cjs/loader:778:27)
lisk-service-core-1  |     at Module.require (node:internal/modules/cjs/loader:1005:19)
lisk-service-core-1  |     at require (node:internal/modules/cjs/helpers:102:18)
lisk-service-core-1  |     at Object.<anonymous> (/home/lisk/lisk-service/core/shared/core/compat/index.js:36:5)
lisk-service-core-1  |     at Module._compile (node:internal/modules/cjs/loader:1105:14)
lisk-service-core-1  |     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
lisk-service-core-1  |     at Module.load (node:internal/modules/cjs/loader:981:32)
lisk-service-core-1  |     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
lisk-service-core-1  |     at Module.require (node:internal/modules/cjs/loader:1005:19)
lisk-service-core-1  |     at require (node:internal/modules/cjs/helpers:102:18)
lisk-service-core-1  |     at Object.<anonymous> (/home/lisk/lisk-service/core/shared/core/blocks.js:21:17)
lisk-service-core-1  |     at Module._compile (node:internal/modules/cjs/loader:1105:14)
lisk-service-core-1  |     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
lisk-service-core-1  |     at Module.load (node:internal/modules/cjs/loader:981:32)
lisk-service-core-1  |     at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
lisk-service-core-1  |   code: 'MODULE_NOT_FOUND',
lisk-service-core-1  |   requireStack: [
lisk-service-core-1  |     '/home/lisk/lisk-service/core/shared/core/compat/index.js',
lisk-service-core-1  |     '/home/lisk/lisk-service/core/shared/core/blocks.js',
lisk-service-core-1  |     '/home/lisk/lisk-service/core/shared/core/index.js',
lisk-service-core-1  |     '/home/lisk/lisk-service/core/methods/api_v2/controllers/accounts.js',
lisk-service-core-1  |     '/home/lisk/lisk-service/core/methods/api_v2/accounts.js',
lisk-service-core-1  |     '/home/lisk/lisk-service/core/node_modules/require-all/index.js',
lisk-service-core-1  |     '/home/lisk/lisk-service/core/node_modules/lisk-service-framework/src/requireAllJs.js',
lisk-service-core-1  |     '/home/lisk/lisk-service/core/node_modules/lisk-service-framework/src/microservice.js',
lisk-service-core-1  |     '/home/lisk/lisk-service/core/node_modules/lisk-service-framework/index.js',
lisk-service-core-1  |     '/home/lisk/lisk-service/core/app.js'
lisk-service-core-1  |   ]
lisk-service-core-1  | }
vardan10 commented 1 year ago

Issue is not reproducible on Fedora release 38 with the mentioned docker compose file.

If you are still facing this issue you can try the following:

  1. Make sure you are using Mysql, Redis, env initialisation scripts from here.
  2. Build images again by updating Dockerfile to ignore package.lock while installing dependancies. You can change this line to npm i.

Docker version: Docker version 24.0.6, build ed223bc

ManuGowda commented 10 months ago

@lavrd could you please check and confirm if you are still facing this issue?

sameersubudhi commented 10 months ago

Closing the issue, since there's no updates from the issue reporter and is not reproducible at our end. Additionally, the issue becomes irrelevant tomorrow after the mainnet migration.