如何在openShift上部署angular2 + app

时间:2017-12-15 20:48:25

标签: node.js angular openshift

我在Windows PC上创建了一个角度应用程序。现在我想在Red Hat OpenShift上部署这个应用程序。 我试图在互联网上搜索一些指南,但实际上找不到有用的资料。任何人习惯部署它,请帮我一把。

版本

OpenShift Master:v3.6.173.0.49

Kubernetes大师: V1.6.1 + 5115d708d7

经过多次尝试后,我无法在Openshift上部署我的应用程序。

但我可以部署this example node application



{
    "name": "",
    "version": "0.0.0",
    "license": "MIT",
    "main": "server.js",
    "scripts": {
        "ng": "ng",
        "build": "ng build",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e",
        "start": "node Server.js",
        "postinstall": "ng build --aot -prod --base-href http://angular-reaction-page.paas-poc.am.lilly.com/"
    },
    "private": true,
    "dependencies": {
        "@angular/common": "^5.0.1",
        "@angular/compiler": "^5.0.1",
        "@angular/core": "^5.0.1",
        "@angular/forms": "^5.0.1",
        "@angular/http": "^5.0.1",
        "@angular/platform-browser": "^5.0.1",
        "@angular/platform-browser-dynamic": "^5.0.1",
        "@angular/router": "^5.0.1",
        "bootstrap": "^3.3.7",
        "core-js": "^2.5.1",
        "jquery": "^3.2.1",
        "rxjs": "^5.5.2",
        "svg-pan-zoom": "^3.5.3",
        "zone.js": "^0.8.18",
        "@angular/cli": "^1.5.3",
        "express": "^4.13.4"
    },
    "devDependencies": {
        "@angular/compiler-cli": "^5.0.1",
        "@types/jasmine": "2.5.38",
        "@types/node": "^6.0.90",
        "codelyzer": "~2.0.0",
        "jasmine-core": "~2.5.2",
        "jasmine-spec-reporter": "~3.2.0",
        "karma": "~1.4.1",
        "karma-chrome-launcher": "~2.0.0",
        "karma-cli": "~1.0.1",
        "karma-coverage-istanbul-reporter": "^0.2.0",
        "karma-jasmine": "~1.1.0",
        "karma-jasmine-html-reporter": "^0.2.2",
        "node-sass": "^4.6.0",
        "protractor": "^5.2.0",
        "ts-node": "~2.0.0",
        "tslint": "~4.5.0",
        "typescript": "^2.6.1"
    }
}




Cloning "https://github.com/username/project-name.git" ...
Commit: 0964f21953324a4fc3334e2556f01650c4348d66 (adding package-lock.json)
Author: User Name - Network <email>
Date:   Thu Dec 14 15:17:04 2017 -0500
Installing application source ...
Building your Node application from source
npm ERR! Linux 3.10.0-693.5.2.el7.x86_64
npm ERR! argv "/opt/rh/rh-nodejs6/root/usr/bin/node" "/opt/rh/rh
nodejs6/root/usr/bin/npm" "install"
npm ERR! node v6.11.3
npm ERR! npm  v3.10.9
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! syscall connect
npm ERR! Error: connect ECONNREFUSED 151.101.184.162:443
npm ERR!     at Object.exports._errnoException (util.js:1020:11)
npm ERR!     at exports._exceptionWithHostPort (util.js:1043:20)
npm ERR!     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)
npm ERR!  { Error: connect ECONNREFUSED 151.101.184.162:443
npm ERR!     at Object.exports._errnoException (util.js:1020:11)
npm ERR!     at exports._exceptionWithHostPort (util.js:1043:20)
npm ERR!     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)
npm ERR!   code: 'ECONNREFUSED',
npm ERR!   errno: 'ECONNREFUSED',
npm ERR!   syscall: 'connect',
npm ERR!   address: '151.101.184.162',
npm ERR!   port: 443,
npm ERR!   parent: '' }
npm ERR! 
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly.  See: 'npm help config'
npm ERR! Please include the following file with any support request:
npm ERR!     /opt/app-root/src/npm-debug.log

1 个答案:

答案 0 :(得分:0)

您可以使用以下命令在openshift中安装angular2应用

在运行此命令之前,您需要先在Angular应用程序文件夹中

npx nodeshift --strictSSL=false --dockerImage=bucharestgold/centos7-s2i-web-app --imageTag=10.x --build.env OUTPUT_DIR=dist/your-angular-app-name --expose

它使用〜/ .kube / config文件中的openshift凭据

注意:npx和nodeshift是NPM模块

Nodeshift-用于在openshift中部署Node.js项目