Skip to content
Permalink
Browse files

Fixes to Docker and better docs/debugging

Summary:
Fixes to docker ignore and readme
Add ebextensions that allow us to more easily use docker

Test Plan: manual

Reviewers: juan, jackie, halla, spang

Reviewed By: spang

Differential Revision: https://phab.nylas.com/D3554
  • Loading branch information...
emorikawa committed Jan 3, 2017
1 parent 06cf4fc commit 16c765df705947b7c66cf86411c468784e657be7
Showing with 56 additions and 10 deletions.
  1. +26 −5 .dockerignore
  2. +9 −0 .ebextensions/enable_docker_cli_on_ssh.config
  3. +21 −5 packages/cloud-api/README.md
@@ -1,6 +1,27 @@
n1_cloud_dist

.git
.gitignore
README.md
Procfile*
*node_modules*
docs
.arcconfig
.arclint
arclib

*.swp
*~
.DS_Store
node_modules
**/node_modules
dump.rdb
*npm-debug.log
storage/
lerna-debug.log
newrelic_agent.log

# Vim temp files
*.swp
*.swo

# Elastic Beanstalk Files
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml
/packages/local-sync/spec-saved-state.json
@@ -0,0 +1,9 @@
# This lets you log in via `eb ssh` and access the docker daemon.
# If we don't add the ec2-user to the docker group, then calls to docker
# (like `docker ps`) will fail with `Cannot connect to the Docker daemon`
#
# See: https://blog.cloudinvaders.com/connect-to-docker-daemon-on-aws-beanstalk-ec2-instance/
commands:
0_add_docker_group_to_ec2_user:
command: gpasswd -a ec2-user docker
test: groups ec2-user | grep -qv docker
@@ -52,6 +52,13 @@ and Metdata for Nylas N1 desktop clients.
1. Make read-only: `chmod 400 ~/.ssh/k2-keypair.pem`
1. `ssh -i ~/.ssh/k2-keypair.pem ec2-user@some-ec2-box-we-own.amazonaws.com`

## New to Docker:

1. Read [Understanding Docker](https://docs.docker.com/engine/understanding-docker/)

1. Install [Docker](https://www.docker.com/products/overview) on your
machine.

# Developing the Cloud Components Locally:
From the root /K2 directory:

@@ -92,18 +99,27 @@ hard-coded Amazon shell scripts.
Our Dockerfile exposes port 5100, and Elastic Beanstalk automatically maps
whatever single port is exposed to port 80 and serves it.

# Logs:

Don't use `eb logs`. It will download a static 100 lines of the
`eb-activity.log`, which only contains setup logs (no application logs).

1. `eb ssh`

1. `docker logs --follow $(docker ps --format "{{.ID}}" --filter status=running)` - This will tail and follow the application logs out of Docker. Use this to see what the app is doing.

1. `tail -f /var/log/eb-activity.log` - This shows you logs from when the
container builds. See this to see the output of `npm install` and other
setup.

# Diagnosing Deploys

Use `eb ssh` to login to the EC2 instance.

The deploys is copied to `/var/app/current`. Note that this is not the
running code. It's the starting place for `docker build` to run from. The
actual running code is within the docker container.

You can access logs with `eb logs`. NOTE: `eb logs` does NOT do a live
tail and only shows the latest copy of `/var/log/eb-activity.log`.

The best way to look at logs is to ssh into the box, then go to `/var/log/`

There are 2 common log files to look at:

1. `/var/log/eb-activity.log`. This will show you the progress of our npm

0 comments on commit 16c765d

Please sign in to comment.
You can’t perform that action at this time.