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

Digital Ocean (Ubuntu 16.04) node/tools publish deployment fails #44

Closed
gpolyn opened this issue Jul 4, 2017 · 6 comments
Closed

Digital Ocean (Ubuntu 16.04) node/tools publish deployment fails #44

gpolyn opened this issue Jul 4, 2017 · 6 comments

Comments

@gpolyn
Copy link

gpolyn commented Jul 4, 2017

  1. I confirm that a toy docker-compose application can be deployed to a new Ubuntu 16.04 droplet by installing docker-compose deps and executing the steps at how-to-install-wordpress-and-phpmyadmin-with-docker-compose-on-ubuntu-14-04.

  2. Install Node LTS (6.11) on 16.04 droplet.

  3. Attempt to recover the hostname cat /etc/hostname (no ~/.ssh/config found).

  4. Following Deployment, execute node tools/publish <host> using name from 3).

Get different errors, for example, the following:

  • EACCESS related to yarn
  • Permission denied (publickey)

So, seems to turn on a remote server configuration issue, namely, ~/.ssh/config. I grant that this is somewhat a side-issue, but any comment in a reply to this issue would be appreciated.

Separately, on the same droplet as above docker-compose up hangs for a while and then reports an error:

api_1    | Finished 'build' after 2588ms
api_1    | events.js:182
api_1    |       throw er; // Unhandled 'error' event
api_1    |       ^
api_1    | 
api_1    | Error: read ECONNRESET
api_1    |     at exports._errnoException (util.js:1016:11)
api_1    |     at Pipe.onread (net.js:609:25)

Edit: Alternatively, confirm which remote server deploy scenario has succeeded, for example, AWS, which we can take as a default approach.

@koistya
Copy link
Member

koistya commented Jul 4, 2017

@gpolyn as a side note, I think it's better first to compile a docker image before pushing it to a DigitalOcean droplet or Docker repository. Otherwise, while your app is compiling, your server may become less responsive. Take a look at tools/publish.js files, which compiles a Docker image and pushes it to a web server over SSH. E.g. if your server has Docker / Docker Compose running and a production docker-compose.yml, you just run node tools/publish from your local machine or CI and it compiles and deploys your app.

@gpolyn
Copy link
Author

gpolyn commented Jul 4, 2017

@koistya I see: deployment is meant to occur from local or master machine, which is why the ssh stuff matters. So then, my path is to configure the remote server such that I can 1) ssh into it using some preferred hostname and 2) run deploy locally and expect deployment to occur. Will check out.

@koistya
Copy link
Member

koistya commented Jul 4, 2017

Regarding #1, when you provision a new VM/droplet, it usually comes with SSH access pre-configured. You would just need to tweak your local SSH client config, e.g. you can put your SSH settings in ~/.ssh/config and use just server's name/alias when you need to connect, e.g. ssh web01 as opposed to ssh user@XXX.XXX.XXX.XXX.

@koistya koistya closed this as completed Jul 4, 2017
@gpolyn
Copy link
Author

gpolyn commented Jul 7, 2017

@koistya per your guidance, I've corrected my approach, but I still fail in my effort.

  1. initialize Ubuntu 16.04 remote instance, somedroplet (Digital Ocean)
  2. ssh somedroplet from my local client
  3. somedroplet is provisioned with Docker version 17.06.0-ce, docker-compose version 1.11.2
  4. from inside the repo (commit 6d698...) on my local client I execute node tools/publish somedroplet

I include the full log farther below, but here I highlight the critical error:

ERROR: for nginx  Cannot start service nginx: oci runtime error: container_linux.go:262: starting container process caused "process_linux.go:339: container init caused \"rootfs_linux.go:57: mounting \\\"/usr/src/app/config/nginx.conf\\\" to rootfs \\\"/var/lib/docker/aufs/mnt/b034a377fa57497cc3af262028c75d6d254e691bf7657a207c1261dbe31e6872\\\" at \\\"/var/lib/docker/aufs/mnt/b034a377fa57497cc3af262028c75d6d254e691bf7657a207c1261dbe31e6872/etc/nginx/conf.d/default.conf\\\" caused \\\"not a directory\\\"\""
: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

Seems like we are to have prepared the volume mounts on the remote server side (somedroplet), but is that correct? For example, in an earlier attempt, I encountered an error associated with the api compose step, which I remedied by adding the dir /usr/src/app on somedroplet. What am I missing?

yarn install v0.24.6
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.91s.
yarn run v0.24.6
$ node tools/build.js 
Starting 'build'...
src/DataLoaders.js -> build/DataLoaders.js
src/app.js -> build/app.js
src/db.js -> build/db.js
src/passport.js -> build/passport.js
src/redis.js -> build/redis.js
src/email.js -> build/email.js
src/server.js -> build/server.js
src/schema/Comment.js -> build/schema/Comment.js
src/schema/README.md -> build/schema/README.md
src/schema/CommentType.js -> build/schema/CommentType.js
src/schema/EmailType.js -> build/schema/EmailType.js
src/schema/Story.js -> build/schema/Story.js
src/schema/Node.js -> build/schema/Node.js
src/schema/UserType.js -> build/schema/UserType.js
src/schema/StoryType.js -> build/schema/StoryType.js
src/schema/User.js -> build/schema/User.js
src/schema/ValidationError.js -> build/schema/ValidationError.js
src/schema/index.js -> build/schema/index.js
src/routes/account.js -> build/routes/account.js
src/emails/welcome/subject.hbs -> build/emails/welcome/subject.js
src/emails/welcome/html.hbs -> build/emails/welcome/html.js
Finished 'build' after 3765ms
Done in 7.94s.
Sending build context to Docker daemon  858.6kB
Step 1/5 : FROM node:8.1.2-alpine
 ---> 74b5cf4a0274
Step 2/5 : WORKDIR /usr/src/app
 ---> 3e668d4e1138
Removing intermediate container 0ed8e7a6cbb4
Step 3/5 : COPY . .
 ---> eedaf7523757
Removing intermediate container 419d390e415f
Step 4/5 : RUN yarn install --production --no-progress
 ---> Running in eb442d923074
yarn install v0.24.6
[1/4] Resolving packages...
[2/4] Fetching packages...
warning fsevents@1.1.2: The platform "linux" is incompatible with this module.
info "fsevents@1.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 20.45s.
 ---> 3a3900434e0a
Removing intermediate container eb442d923074
Step 5/5 : CMD node build/server.js
 ---> Running in f3086f6de944
 ---> ade9e7550cac
Removing intermediate container f3086f6de944
Successfully built ade9e7550cac
Successfully tagged api:latest
Loaded image: api:latest
Creating volume "app_redis" with default driver
Creating volume "app_db" with default driver
Creating volume "app_yarn" with default driver
Creating app_redis_1
Creating app_db_1
Creating app_api_1
Creating app_nginx_1

ERROR: for nginx  Cannot start service nginx: oci runtime error: container_linux.go:262: starting container process caused "process_linux.go:339: container init caused \"rootfs_linux.go:57: mounting \\\"/usr/src/app/config/nginx.conf\\\" to rootfs \\\"/var/lib/docker/aufs/mnt/b034a377fa57497cc3af262028c75d6d254e691bf7657a207c1261dbe31e6872\\\" at \\\"/var/lib/docker/aufs/mnt/b034a377fa57497cc3af262028c75d6d254e691bf7657a207c1261dbe31e6872/etc/nginx/conf.d/default.conf\\\" caused \\\"not a directory\\\"\""
: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
Encountered errors while bringing up the project.

@koistya
Copy link
Member

koistya commented Jul 10, 2017

@gpolyn the configuration files, e.g. /user/src/app/config/nginx.conf, referenced in the production docker-compose.yml file are missing on the server. Take a look here https://gist.github.com/koistya/08d3654862f654e756674491593e6fe2

@afrankel-sfdo
Copy link

@koistya this info was helpful, but running into repository web not found: does not exist or no pull access when using the gist example files placed on the server (slightly modified for the correct domain).

Any thoughts?

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

3 participants