CyCoreSystems / docker-meteor

Dockerfile and script for running Meteor on Docker
MIT License
120 stars 73 forks source link

Unable to locate server directory.. #20

Closed krlicmuhamed closed 7 years ago

krlicmuhamed commented 8 years ago

Hello, I've been trying to deploy my meteor app lately, but keep getting stuck on this error.

root@imasoft:~# ls ~/src/imasoft.ba/web
client  package.json  public  server
root@imasoft:~#   docker run --rm \
>   -e ROOT_URL=http://imasoft.ba \
>   -v /home/root/src/imasoft.ba/web:/var/www \
>   -e MONGO_URL=mongodb://localhost:27017/imadb \
>   -e MONGO_OPLOG_URL=mongodb://localhost.com:27017/local \
>   ulexus/meteor
Unable to locate server directory in ; hold on: we're likely to fail
Failed to locate main.js in ; cannot start application.
root@imasoft:~#

What does -v /home/root/src/imasoft.ba/web:/var/www \ mean? I selected the directory that has my meteor source.

I also tried using my repository to get this running but I get this error:

root@imasoft:~# cat /root/.ssh/id_rsa.pub
ssh-rsa .... prints out my ssh key

root@imasoft:~# docker run --rm \
>   -e ROOT_URL=http://imasoft.ba \
>   -e DEPLOY_KEY=/root/.ssh/id_rsa.pub\
>   -e REPO=git@bitbucket.org:imasoftod/web.git \
>   -e BRANCH=release \
>   -e MONGO_URL=mongodb://localhost:27017/mydatabase \
>   -e MONGO_OPLOG_URL=mongodb://localhost:27017/local \
>   ulexus/meteor
cp: cannot stat '/root/.ssh/id_rsa.pub': No such file or directory

root@imasoft:~#

Thanks.

Ulexus commented 8 years ago

Standard warning: don't run arbitrary stuff as root

In the first example, you are most likely pointing to the wrong directory. Root's home directory is usually /root, not /home/root, and this is further evidenced by referencing your SSH key in /root/.ssh in the second example.

Next, keep in mind that /var/www is for a Meteor build/bundle, not for the Meteor source. If you want to link in the meteor source, you will want to link it to the container's /src/app directory.

In the second example, the DEPLOY_KEY is referencing a file inside the container. Therefore, if you wish to reference /root/.ssh/id_rsa.pub, you would need to bind-mount that file into place with -v /root/.ssh/id_rsa.pub:/root/.ssh/id_rsa.pub. However, even that will not work, because you need your private key, not your public key.

Next, your MONGO_URL is almost certainly incorrect. That URL needs to be referenced as from inside the container. localhost inside the container is not the same as localhost outside the container. If you are running mongodb on the host, you will need to reference your host's IP here, not localhost. If mongodb is running inside another container, you will need to use the --link option to link it in.

avishaan commented 7 years ago

I had the same error as @l0oky but adding the bind-mount via -v /root/...:/root/... worked for me keeping in mind that you need to use absolute paths else you will get a warning