0

Я развертывание приложения узла к AWS Е.Б., вот мой Dockerfilesupervisord отдали nodejs вошел НЕУСТРАНИМОГО состояние

FROM ubuntu:14.04 

RUN rm /bin/sh && ln -s /bin/bash /bin/sh 

# Install base packages 
ENV DEBIAN_FRONTEND noninteractive 
RUN apt-get update && apt-get install -y \ 
    zsh \ 
    vim \ 
    git \ 
    curl \ 
    build-essential \ 
    nodejs \ 
    npm \ 
    supervisor 

RUN update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10 

RUN mkdir -p /var/run/sshd /var/log/supervisor 

COPY build/supervisord.conf /etc/supervisor/conf.d/supervisord.conf 

RUN mkdir -p /app 
ADD api/ /app 

RUN cd /app && npm install 

WORKDIR /app 

EXPOSE 8090 

CMD ["/usr/bin/supervisord"] 

Вот мой supervisord.conf

[supervisord] 
nodaemon=true 

[program:nodejs] 
directory=/app 
command=node server.js web 
autorestart = true 
stdout_logfile=/var/log/%(program_name)s.log 
stderr_logfile=/var/log/%(program_name)s.log 

Вот мой stdouterr.log

/usr/lib/python2.7/dist-packages/supervisor/options.py:295: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security. 
'Supervisord is running as root and it is searching ' 
2016-04-08 16:48:37,892 CRIT Supervisor running as root (no user in config file) 
2016-04-08 16:48:37,892 WARN Included extra file "/etc/supervisor/conf.d/supervisord.conf" during parsing 
2016-04-08 16:48:37,909 INFO RPC interface 'supervisor' initialized 
2016-04-08 16:48:37,909 CRIT Server 'unix_http_server' running without any HTTP authentication checking 
2016-04-08 16:48:37,910 INFO supervisord started with pid 1 
2016-04-08 16:48:38,912 INFO spawned: 'nodejs' with pid 11 
2016-04-08 16:48:39,332 INFO exited: nodejs (exit status 8; not expected) 
2016-04-08 16:48:40,334 INFO spawned: 'nodejs' with pid 13 
2016-04-08 16:48:40,732 INFO exited: nodejs (exit status 8; not expected) 
2016-04-08 16:48:42,736 INFO spawned: 'nodejs' with pid 15 
2016-04-08 16:48:43,414 INFO exited: nodejs (exit status 8; not expected) 
2016-04-08 16:48:46,419 INFO spawned: 'nodejs' with pid 17 
2016-04-08 16:48:47,288 INFO exited: nodejs (exit status 8; not expected) 
2016-04-08 16:48:48,289 INFO gave up: nodejs entered FATAL state, too many start retries too quickly 

Любые советы полезны на данном этапе.

+0

Является ли ваше приложение узел сбой? Вместо этого попробуйте приложение с минимальным узлом. Также попробуйте распечатать с узла на stdout, чтобы отладить, что происходит внутри. –

+0

Вы были правы, @AssafLavie мое приложение-узел рушилось, потому что мои версии узла и npm, где не установлены правильные. – gmaniac

ответ

0

Как @AssafLavie в комментариях упоминалось, что приложение узла терпит крах. Причина, по которой он рушился, состоял в том, что я должен был установить версии node и npm указанным версиям в файле package.json.

Dockerfile My теперь выглядит

FROM ubuntu:14.04 

RUN rm /bin/sh && ln -s /bin/bash /bin/sh 

# Install base packages 
ENV DEBIAN_FRONTEND noninteractive 
RUN apt-get update && apt-get install -y \ 
    zsh \ 
    vim \ 
    git \ 
    curl \ 
    build-essential \ 
    nodejs \ 
    npm \ 
    supervisor 

RUN update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10 

# Added the following 5 lines 

RUN npm install -g n 

RUN n 5.0.0 

RUN rm /usr/bin/node 
RUN ln -s /usr/local/bin/node /usr/bin/node 

RUN npm install [email protected] -g 

# End of the added lines to specify node and npm versions 

RUN mkdir -p /var/run/sshd /var/log/supervisor 

COPY build/supervisord.conf /etc/supervisor/conf.d/supervisord.conf 

RUN mkdir -p /app 
ADD api/ /app 

RUN cd /app && npm install 

WORKDIR /app 

EXPOSE 8090 

CMD ["/usr/bin/supervisord"]