reactioncommerce / reaction

Mailchimp Open Commerce is an API-first, headless commerce platform built using Node.js, React, GraphQL. Deployed via Docker and Kubernetes.
https://mailchimp.com/developer/open-commerce/
GNU General Public License v3.0
12.34k stars 2.17k forks source link

Doing nothing when running docker run #1899

Closed mateomorrison closed 7 years ago

mateomorrison commented 7 years ago

I'm using Digital Ocean with Docker to install Reaction. After successfully running and creating the docker-machine create, signing in with docker-machine env reaction-host and telling my machine eval "$(docker-machine env reaction-host. I try to actually start the Reaction by typing:

docker run -d \
  -p 80:80 \
  -e ROOT_URL="URL" \
  -e REACTION_EMAIL="MAIL" \
  -e REACTION_USER="USER" \
  -e REACTION_AUTH="PASSWORD" \
  reactioncommerce/reaction:latest

(I'm hiding credentials, but I'm replacing URL, MAIL, USER, PASSWORD with correct one)

It just do nothing... Really.

How to get it fixed?

mateomorrison commented 7 years ago

@aaronjudd Any heads up?

jshimko commented 7 years ago

Going to need more info than that to make any recommendations. What do your logs show?

Also, the container exposes port 3000, so that config needs to be -p 80:3000

mateomorrison commented 7 years ago

@jshimko Where to find logs? Remember I'm hosting on DO, obviously as a VM through my computer when I docker-machine create.

So I basically successfully created the machine, then can't run the reaction script. Because like I said, when trying to docker run it just do nothing

mateomorrison commented 7 years ago

I'm just following your docs but it doesn't work. Any other way to rapidly deploy my app into DO droplet?

jshimko commented 7 years ago

docker logs -f <container ID>

https://docs.docker.com/engine/reference/commandline/logs/

mateomorrison commented 7 years ago

How to get log from the container when it's not even running? That's what I meant. When trying docker run not matter what port, url or anything. It does nothing that I have to cancel with Ctrl + C. And try docker ps -a again and it's empty.

Something I'm doing wrong? @jshimko screen shot 2017-02-26 at 1 47 42 pm

mateomorrison commented 7 years ago

screen shot 2017-02-26 at 1 51 27 pm

Thinking backwards, instead of running the full code, I try with docker run reactioncommerce/reaction and it seemed like it was starting (?). But then I signed in in other tab and ran docker ps -a and it showed empty again, like nothing happened never.

screen shot 2017-02-26 at 1 53 53 pm

jshimko commented 7 years ago

The -p flag is not optional. You need to route traffic to port 3000 on the container.

These are the minimum options required to run a container:

docker run -p 80:3000 -d reactioncommerce/reaction:latest
mateomorrison commented 7 years ago

Just used docker run -p 80:3000 -d reactioncommerce/reaction:latest and it already appears on docker ps -a. When running log this is the output:

-] External MONGO_URL not found. Starting local MongoDB...

[-] External MONGO_URL not found. Starting local MongoDB...

=> Starting app on port 3000...
18:04:07.566Z  INFO Reaction: Load default data from /private/data/
18:04:08.295Z  WARN Reaction: Skipped loading settings from reaction.json.
18:04:08.298Z  INFO Reaction: JobServer started
18:04:19.093Z  WARN Reaction: Reaction.Email.getMailUrl() - no email provider configured
18:04:19.115Z  WARN Reaction:

    ***************************************************
            IMPORTANT! EMAIL VERIFICATION LINK

             Email sending is not configured.

    Go to the following URL to verify email: kfehmsyf@localhost

    http://localhost/#/verify-email/e2U1DSUTh85SgKct4Z66kvMiBFELikD7l7CPvYr__L6
    ***************************************************

/opt/reaction/dist/bundle/programs/server/node_modules/fibers/future.js:313
                        throw(ex);
                        ^
MongoError: connection 2 to 127.0.0.1:27017 closed
    at Object.Future.wait (/opt/reaction/dist/bundle/programs/server/node_modules/fibers/future.js:449:15)
    at [object Object]._.extend._nextObject (packages/mongo/mongo_driver.js:1024:47)
    at [object Object]._.extend.forEach (packages/mongo/mongo_driver.js:1058:22)
    at [object Object]._.extend.map (packages/mongo/mongo_driver.js:1068:10)
    at [object Object]._.extend.fetch (packages/mongo/mongo_driver.js:1092:17)
    at [object Object].Cursor.(anonymous function) [as fetch] (packages/mongo/mongo_driver.js:907:44)
    at Object._.extend._updateUserRoles (packages/alanning_roles.js:718:52)
    at Object._.extend.setUserRoles (packages/alanning_roles.js:250:11)
    at Object.module.export.exports.default.createDefaultAdminUser (server/api/core/core.js:312:11)
    at Object.module.export.exports.default.init (server/api/core/core.js:32:10)
    at module.export.exports.default (server/startup/init.js:8:12)
    at module.export.exports.default (server/startup/index.js:18:3)
    at server/main.js:6:3
    at Function.time (/opt/reaction/dist/bundle/programs/server/profile.js:301:28)
    at /opt/reaction/dist/bundle/programs/server/boot.js:304:13
    at /opt/reaction/dist/bundle/programs/server/boot.js:345:5
    at Function.run (/opt/reaction/dist/bundle/programs/server/profile.js:480:12)
    at /opt/reaction/dist/bundle/programs/server/boot.js:343:11
    - - - - -
    at Function.MongoError.create (/opt/reaction/dist/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/error.js:29:11)
    at Socket.<anonymous> (/opt/reaction/dist/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connection.js:198:22)
    at Socket.g (events.js:260:16)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at TCP._onclose (net.js:487:12)

Are we close?

jshimko commented 7 years ago

I don't know what that Mongo error is. I've never seen it before. And I don't get that error when I run the same command. I'd try starting over one more time.

mateomorrison commented 7 years ago

@jshimko I will follow exactly what you did in here

But:

jshimko commented 7 years ago

I'm not sure what else to suggest. Running the latest build consistently works fine for me. I'm also not sure what you mean by "docker run does nothing". What is it that you're expecting to see that isn't happening? The only thing you should see is the image download and start. You have to specifically run the docker logs command to get any additional output once it's running.

Also, did you see the comments under that gist that addresses the header size issue when using nginx? If you want to use jwilder/nginx-proxy with Reaction, you're definitely going to need to make those changes to the nginx config.

I'd start by getting Reaction working without nginx first though so you can solve one problem at a time.

mateomorrison commented 7 years ago

docker run actually does nothing. When running it doesn't charge, or load. Just hangs in there. Let's forget about jwilder/nginx-proxy. Maybe if I run the code this way:

docker run -d -p 80:80 -e ROOT_URL="URL" reactioncommerce/reaction:latest

Maybe it works? Meaning no tabs, no spaces. I will hack the way around and tell you in a bit.

jshimko commented 7 years ago

Again, I just want to point out that it's 80:3000, not 80:80. If you don't route traffic from the external host port to the correct container port, it is guaranteed not to work.

jshimko commented 7 years ago

So, I can't reproduce any of your reported issues. I'm fairly certain this is an implementation problem and not an issue with Reaction code, so I'm going to close this issue. If you are able to identify a problem with Reaction or provide reproduction steps that reliably fail, please feel free to reopen it and post your details.

IsraelLaguan commented 6 years ago

In my case, @mateomorrison i used first docker container list , then it showed in COMMAND column that /bash/cat was running. So I added at the end of my Dockerfile CMD /bash/sh and next time it worked. Maybe your COMMAND is different, but hope it gives you a hint.

GabrielMaestre commented 4 months ago

For future cases: Remember to open/close two double quotes, that's why some people run the command and don't return the result and with each enter their console will look like this

docker run --something="... (forget to close)

CTRL + C