Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't use postgresql #25

Open
zhiyue opened this issue Jun 9, 2015 · 2 comments
Open

can't use postgresql #25

zhiyue opened this issue Jun 9, 2015 · 2 comments

Comments

@zhiyue
Copy link

zhiyue commented Jun 9, 2015

I use compose to run this...base on fig.production.yml but it can't use postgresql as its database.
it select sqlite as default.

my yml file:

web:
  image: deardooley/lightning-viz
  # build: .
  command: npm run migrate && npm start
  ports:
    - 3000
  links:
    - postgres
  environment:
    VIRTUAL_PORT: 80 
    VIRTUAL_HOST: lightning-viz.everforget.com 
    NODE_ENV: production
    DATABASE_URL: lightning:123456@postgres:5432/lightning
    LIGHTNING_USERNAME: zhiyue 
    LIGHTNING_PASSWORD: 123456 
    S3_KEY:
    S3_BUCKET:
    S3_SECRET:


postgres:
  image: orchardup/postgresql:9.3
  environment:
    POSTGRESQL_PASS: 123456
    POSTGRESQL_USER: lightning
    POSTGRESQL_DB: lightning
  ports:
    - 5432

log:

web_1      | 
web_1      | > [email protected] migrate /usr/src/app
web_1      | > sequelize db:migrate --config ./config/database.js && npm start
web_1      | 
web_1      | No action specified. Try "sequelize --help" for usage information.
web_1      | 
web_1      | > [email protected] start /usr/src/app
web_1      | > NODE_ENV=development nodemon --watch app --watch public/js server.js 
web_1      | 
postgres_1 | 2015-06-09 07:45:35 GMT LOG:  database system was shut down at 2015-06-09 07:45:34 GMT
postgres_1 | 2015-06-09 07:45:35 GMT LOG:  database system is ready to accept connections
postgres_1 | 2015-06-09 07:45:35 GMT LOG:  autovacuum launcher started
web_1      | 9 Jun 07:45:35 - [nodemon] v1.3.7
web_1      | 9 Jun 07:45:35 - [nodemon] to restart at any time, enter `rs`
web_1      | 9 Jun 07:45:35 - [nodemon] watching: /usr/src/app/app/**/* /usr/src/app/public/js/**/*
web_1      | 9 Jun 07:45:35 - [nodemon] starting `node server.js`
web_1      | 
web_1      | 
web_1      | 
web_1      |   ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,` 
web_1      |  ,`                                ,.
web_1      | ,`                                  ,
web_1      | ,                                   ,
web_1      | ,                      .            ,
web_1      | ,                     ,             ,
web_1      | ,                    `,             ,
web_1      | ,                    ,.             ,
web_1      | ,                   ,,              ,
web_1      | ,                  ,,,              ,
web_1      | ,                 ,,,.              ,
web_1      | ,                .,,,               ,
web_1      | ,               `,,,,               ,
web_1      | ,               ,,,,`               ,
web_1      | ,              ,,,,,                ,
web_1      | ,             ,,,,,,                ,
web_1      | ,            ,,,,,,,,,,,,,,.        ,
web_1      | ,           .,,,,,,,,,,,,,,         ,
web_1      | ,           ,,,,,,,,,,,,,,          ,
web_1      | ,          ,,,,,,,,,,,,,,           ,
web_1      | ,         ,,,,,,,,,,,,,,            ,
web_1      | ,                 ,,,,,`            ,
web_1      | ,                ,,,,,,             ,
web_1      | ,                ,,,,,              ,
web_1      | ,                ,,,,               ,
web_1      | ,               ,,,,                ,
web_1      | ,               ,,,`                ,
web_1      | ,              `,,.                 ,
web_1      | ,              ,,,                  ,
web_1      | ,              ,,                   ,
web_1      | ,             `,                    ,
web_1      | ,             ,                     ,
web_1      | ,             `                     ,
web_1      | ,            `                      ,
web_1      | ,                                   ,
web_1      | `,                                 .,
web_1      |  .,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 
web_1      | 
web_1      | 
web_1      | 
web_1      | 
web_1      | Lightning started on port: 3000
web_1      | Running database: sqlite
web_1      | 
web_1      | Installed visualizations:
web_1      | -------------------------
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/adjacency
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/circle
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/force
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/gallery
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/graph
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/graph-bundled
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/image
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/image-poly
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/line
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/line-stacked
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/line-streaming
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/map
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/matrix
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/scatter
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/scatter-3
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/scatter-line
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/scatter-streaming
web_1      | Create from folder: /usr/src/app/tmp/repos/9dab6750-6181-41fa-a379-9b7db026e9f9/volume
@mathisonian
Copy link
Member

Hey @zhiyue It looks like the server is trying to start in development mode even though you've specified it to run in production (which should default to postgres).

See this line of your log file:

web_1      | 
web_1      | > [email protected] start /usr/src/app
web_1      | > NODE_ENV=development nodemon --watch app --watch public/js server.js 
web_1      | 

I think you can change

command: npm run migrate && npm start

to

command: npm run migrate && node server.js

or

command: npm run migrate && forever server.js

if you'd like to run it with forever. We generally use npm start during the development cycle and its not necessarily the best way to start a long running process

@zhiyue
Copy link
Author

zhiyue commented Jun 16, 2015

@mathisonian Thanks for taking the time to answer my questions.I modified my docker-compose.yml like this as you suggest:

proxy:
  image: jwilder/nginx-proxy
  volumes:
    - "/var/run/docker.sock:/tmp/docker.sock"
    # - %%SSL_CERTIFICATE_PATH%%:/certs
  ports:
    - 80:80
    - 443:443
  environment:
    SSL: FALSE
web:
  image: deardooley/lightning-viz
  # build: .
  command: npm run migrate && node server.js
  ports:
    - 3000
  links:
    - postgres
  environment:
    VIRTUAL_PORT: 80
    VIRTUAL_HOST: lightning.everforget.com
    NODE_ENV: production
    DATABASE_URL: lightning:123456@postgres:5432/lightning-viz
    LIGHTNING_USERNAME: zhiyue
    LIGHTNING_PASSWORD: 123456
    S3_KEY:
    S3_BUCKET:
    S3_SECRET:
postgres:
  image: orchardup/postgresql:9.3
  environment:
    POSTGRESQL_PASS: 123456
    POSTGRESQL_USER: lightning
    POSTGRESQL_DB: lightning-viz
  ports:
    - 5432

but There are still a few mistakes.

I use this command:

sudo docker-compose up 

and a few mistakes happen,the log is:

proxy_1    | forego     | starting nginx.1 on port 5000
proxy_1    | forego     | starting dockergen.1 on port 5100
proxy_1    | dockergen.1 | 2015/06/16 08:58:57 Generated '/etc/nginx/conf.d/default.conf' from 1 containers
proxy_1    | dockergen.1 | 2015/06/16 08:58:57 Running 'nginx -s reload'
proxy_1    | dockergen.1 | 2015/06/16 08:58:57 Watching docker events
proxy_1    | dockergen.1 | 2015/06/16 08:58:58 Received event start for container 8adbb63b0a89
proxy_1    | dockergen.1 | 2015/06/16 08:58:58 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
proxy_1    | dockergen.1 | 2015/06/16 08:58:58 Received event die for container 8adbb63b0a89
proxy_1    | dockergen.1 | 2015/06/16 08:58:58 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
proxy_1    | dockergen.1 | 2015/06/16 08:58:59 Received event start for container 80dd94d06a7c
proxy_1    | dockergen.1 | 2015/06/16 08:58:59 Contents of /etc/nginx/conf.d/default.conf did not change. Skipping notification 'nginx -s reload'
proxy_1    | dockergen.1 | 2015/06/16 08:58:59 Received event start for container b2e48cdd69f5
postgres_1 | 2015-06-16 08:58:59 GMT ERROR:  role "lightning" already exists
postgres_1 | 2015-06-16 08:58:59 GMT STATEMENT:  CREATE USER lightning WITH SUPERUSER;
postgres_1 |    
postgres_1 | 2015-06-16 08:59:00 GMT ERROR:  syntax error at or near "-" at character 26
postgres_1 | 2015-06-16 08:59:00 GMT STATEMENT:  CREATE DATABASE lightning-viz OWNER lightning TEMPLATE DEFAULT;
postgres_1 |    
postgres_1 | 2015-06-16 08:59:00 GMT LOG:  database system was shut down at 2015-06-16 08:59:00 GMT
proxy_1    | dockergen.1 | 2015/06/16 08:59:00 Generated '/etc/nginx/conf.d/default.conf' from 3 containers
proxy_1    | dockergen.1 | 2015/06/16 08:59:00 Running 'nginx -s reload'
postgres_1 | 2015-06-16 08:59:00 GMT LOG:  database system is ready to accept connections
postgres_1 | 2015-06-16 08:59:00 GMT LOG:  autovacuum launcher started
web_1      | 
web_1      | > [email protected] migrate /usr/src/app
web_1      | > sequelize db:migrate --config ./config/database.js && node server.js
web_1      | 
web_1      | No action specified. Try "sequelize --help" for usage information.
web_1      | 
web_1      | 
web_1      | 
web_1      |   ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,` 
web_1      |  ,`                                ,.
web_1      | ,`                                  ,
web_1      | ,                                   ,
web_1      | ,                      .            ,
web_1      | ,                     ,             ,
web_1      | ,                    `,             ,
web_1      | ,                    ,.             ,
web_1      | ,                   ,,              ,
web_1      | ,                  ,,,              ,
web_1      | ,                 ,,,.              ,
web_1      | ,                .,,,               ,
web_1      | ,               `,,,,               ,
web_1      | ,               ,,,,`               ,
web_1      | ,              ,,,,,                ,
web_1      | ,             ,,,,,,                ,
web_1      | ,            ,,,,,,,,,,,,,,.        ,
web_1      | ,           .,,,,,,,,,,,,,,         ,
web_1      | ,           ,,,,,,,,,,,,,,          ,
web_1      | ,          ,,,,,,,,,,,,,,           ,
web_1      | ,         ,,,,,,,,,,,,,,            ,
web_1      | ,                 ,,,,,`            ,
web_1      | ,                ,,,,,,             ,
web_1      | ,                ,,,,,              ,
web_1      | ,                ,,,,               ,
web_1      | ,               ,,,,                ,
web_1      | ,               ,,,`                ,
web_1      | ,              `,,.                 ,
web_1      | ,              ,,,                  ,
web_1      | ,              ,,                   ,
web_1      | ,             `,                    ,
web_1      | ,             ,                     ,
web_1      | ,             `                     ,
web_1      | ,            `                      ,
web_1      | ,                                   ,
web_1      | `,                                 .,
web_1      |  .,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 
web_1      | 
web_1      | 
web_1      | 
web_1      | 
web_1      | Lightning started on port: 3000
web_1      | Running database: postgres
web_1      | Could not connect to the database. Is Postgres running?
web_1      | 
web_1      | /usr/src/app/server.js:41
web_1      |         throw err;
web_1      |               ^
web_1      | Error: fe_sendauth: no password supplied
web_1      | ,Error: fe_sendauth: no password supplied
web_1      | ,Error: fe_sendauth: no password supplied
web_1      | 
postgres_1 | 2015-06-16 08:59:04 GMT LOG:  could not receive data from client: Connection reset by peer
postgres_1 | 2015-06-16 08:59:04 GMT LOG:  could not receive data from client: Connection reset by peer
postgres_1 | 2015-06-16 08:59:04 GMT LOG:  could not receive data from client: Connection reset by peer
web_1      | 
web_1      | npm ERR! Linux 3.16.0-23-generic
web_1      | npm ERR! argv "node" "/usr/local/bin/npm" "run" "migrate" "&&" "node" "server.js"
web_1      | npm ERR! node v0.10.36
web_1      | npm ERR! npm  v2.5.0
web_1      | npm ERR! code ELIFECYCLE
web_1      | npm ERR! [email protected] migrate: `sequelize db:migrate --config ./config/database.js && node server.js`
web_1      | npm ERR! Exit status 8
web_1      | npm ERR! 
web_1      | npm ERR! Failed at the [email protected] migrate script 'sequelize db:migrate --config ./config/database.js && node server.js'.
web_1      | npm ERR! This is most likely a problem with the lightning-server package,
web_1      | npm ERR! not with npm itself.
web_1      | npm ERR! Tell the author that this fails on your system:
web_1      | npm ERR!     sequelize db:migrate --config ./config/database.js && node server.js
web_1      | npm ERR! You can get their info via:
web_1      | npm ERR!     npm owner ls lightning-server
web_1      | npm ERR! There is likely additional logging output above.
web_1      | 
web_1      | npm ERR! Please include the following file with any support request:
web_1      | npm ERR!     /usr/src/app/npm-debug.log
proxy_1    | dockergen.1 | 2015/06/16 08:59:04 Received event die for container b2e48cdd69f5
lightningviz_web_1 exited with code 1
Gracefully stopping... (press Ctrl+C again to force)
Stopping lightningviz_postgres_1...
Stopping lightningviz_proxy_1...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants