jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.53k stars 4.02k forks source link

Unable to start application with docker-compose on a new project due to invalid app.yml #12143

Closed frankliu81 closed 4 years ago

frankliu81 commented 4 years ago
Overview of the issue

I tried to run the docker image following the instructions here on a newly created jhipster nodejs project https://www.jhipster.tech/docker-compose/

16:25 ~/src/energy-manager (integration) $ docker-compose -f src/main/docker/app.yml up ERROR: The Compose file './src/main/docker/app.yml' is invalid because: services.energymanager-app.environment contains an invalid type, it should be an object, or an array services.energymanager-app.ports is invalid: Invalid port "{'8081:8081': None}", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol] services.energymanager-app.ports contains an invalid type, it should be a string, or a number

Here is my energy-manager/src/main/docker/app.yml version: '2' services: energymanager-app: build: ../../.. container_name: energymanager-app environment: ports:

Motivation for or Use Case

The docker compose command should work out of the box

Reproduce the error
Related issues
Suggest a Fix
JHipster Version(s)

"generator-jhipster": "6.8.0", "generator-jhipster-nodejs": "1.0.2",

JHipster configuration

16:42 ~/src/energy-manager (integration) $ jhipster info INFO! Using JHipster version installed locally in current project's node_modules INFO! No custom sharedOptions found within blueprint: generator-jhipster-nodejs at /Users/frankliu/src/energy-manager/node_modules/generator-jhipster-nodejs INFO! Executing jhipster:info INFO! Options: from-cli: true Welcome to the JHipster Information Sub-Generator

JHipster Version(s)
energymanager@0.0.1-SNAPSHOT /Users/frankliu/src/energy-manager
├── generator-jhipster@6.8.0 
└─┬ generator-jhipster-nodejs@1.0.2
  └── generator-jhipster@6.8.0  deduped
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "authenticationType": "jwt",
    "cacheProvider": "no",
    "clientFramework": "react",
    "serverPort": "8081",
    "serviceDiscoveryType": false,
    "skipUserManagement": false,
    "baseName": "energymanager",
    "buildTool": "maven",
    "databaseType": "sql",
    "devDatabaseType": "sqlite",
    "enableHibernateCache": false,
    "enableSwaggerCodegen": false,
    "enableTranslation": false,
    "jhiPrefix": "jhi",
    "languages": ["en", "fr"],
    "messageBroker": false,
    "nativeLanguage": "en",
    "prodDatabaseType": "mssql",
    "searchEngine": false,
    "skipClient": false,
    "testFrameworks": [],
    "websocket": false,
    "applicationType": "monolith",
    "clientPackageManager": "npm",
    "useSass": true,
    "clientTheme": "united",
    "clientThemeVariant": "primary",
    "jhipsterVersion": "6.8.0",
    "creationTimestamp": 1592028360162,
    "skipServer": false,
    "packageFolder": "com/jhipster/node",
    "packageName": "com.jhipster.node",
    "jwtSecretKey": "bXktc2VjcmV0LXRva2VuLXRvLWNoYW5nZS1pbi1wcm9kdWN0aW9uLWFuZC10by1rZWVwLWluLWEtc2VjdXJlLXBsYWNl",
    "embeddableLaunchScript": false,
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [
      {
        "name": "generator-jhipster-nodejs",
        "version": "1.0.2"
      }
    ],
    "blueprints": [
      {
        "name": "generator-jhipster-nodejs",
        "version": "1.0.2"
      }
    ]
  },
  "entities": [
  ]
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

Environment and Tools

git version 2.20.1 (Apple Git-117)

node: v12.16.2

npm: 6.14.4

yarn: 1.22.4

Docker version 19.03.8, build afacb8b

docker-compose version 1.25.5, build 8a1c60f6

Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
frankliu81 commented 4 years ago

This was fixed by removing the environment line and the extra colon at the end of the port from ports: