2.5.4 • Published 5 years ago

print-service v2.5.4

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago
CategoryValue
Repo Statusproduction
LanguageJavaScript
Repo Team Ownercards_team
build
Card API authorization test
Card API integration test
Coveragecodecov

print_service

ID Card generation service (node backed) PDF generation and printing service (node backed)

Debugging

There are various ways to debug things. Most revolving around what enviroment you are focusing on.

Local

Node uses the the Chrome devtools to inspect context, place debug statements, etc... To access the node debugger follow these steps.

  1. Run npm run debug.
  2. Open the chrome DevTools, command + option + i.
  3. Click the green, hexagonal Node.js icon in the upper left corner of the DevTools.
  4. Navigate to the "Sources" tab of the dedicated Node.js DevTools window that opened.

Non-prod

If you are trying to debug an issue in a non-prod enviroment (dev, testing, UAT, etc)

  • Check your logs in Sumo Logic. You will need to access this via Okta. This will contain basic traffic log data, not errors with stack traces. It is helpful to see the output from app startup and healthchecks. I use the follow search query often _sourceCategory=print-service*/testing and not /-/health and not *register* | json auto
  • Check your logs in Sentry. Find you project, check logs. This is where you can find errors with stack traces.

If you aren't seeing entries in Sumo or Sentry the app may have failed before logging was configured. This requires you to ssh into the instance, it is much more tedious.

We'll do it live! (e.g. getting logs directly off the instance)

Note: This is for a Fleet centric world. It isn't relavent with k8s.

  1. Run cchh arrow "*appclusternode*" | grep --line-buffered ENVIRONMENT | awk '/:/ {print $3}'. Replace ENVIRONMENT with your desired enviroment name (e.g. dev, testing, uat). This will output the private IP address of the instances for the specific enviroment.
  2. Get your phone out for Duo. Run cchh arrow ssh PRIVATE_IP. Replace PRIVATE_IP with one of the IPs output during step one. Any of them will do.
  3. Once you are SSHed into the instance run sudo su.
  4. Run fleetctl list-units, look for your service in the output. (Hint: grep is your friend).
  5. Copy the IP address from the line that matches the container you want logs from.
  6. Exit ths instance you are currently on. Run exit (to leave sudo) then run exit once more to leave the instance.
  7. Run cchh arrow ssh PRIVATE_IP_ADDRESS, replacing PRIVATE_IP_ADDRESS with the one you copied in step 5.
  8. Run sudo su
  9. Run docker ps -a | grep SERVICE_NAME_MATCHER | awk '{print $2}'. Replace SERVICE_NAME_MATCHER with a word from your service name (e.g. if i were looking for print-service i might use print).
  10. Run the follow command (on the remote box) after replace REPLACE_ME_WITH_IMAGE_NAME with the output from the previous step. This will put the container's output in your console so you can see the error causing it to crash.
  docker run \
    --volume=/chlogs:/chlogs \
    --volume=/home/core/pwd.testing.json:/tmp/secrets/pwd.json \
    --env-file /home/core/env_file.testing \
    -e THIS_ENV=testing \
    -e HOST_IP=$( ifconfig docker0 | grep 'inet ' | awk '{print $2}' ) \
    -e VESL_URL=http://$( ifconfig docker0 | grep 'inet ' | awk '{print $2}' ):8375 \
    REAPLCE_ME_WITH_IMAGE_NAME