2.5.4 • Published 5 years ago
print-service v2.5.4
Category | Value |
---|---|
Repo Status | production |
Language | JavaScript |
Repo Team Owner | cards_team |
build | |
---|---|
Card API authorization test | |
Card API integration test | |
Coverage |
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.
- Run
npm run debug
. - Open the chrome DevTools,
command + option + i
. - Click the green, hexagonal Node.js icon in the upper left corner of the DevTools.
- 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.
- Run
cchh arrow "*appclusternode*" | grep --line-buffered ENVIRONMENT | awk '/:/ {print $3}'
. ReplaceENVIRONMENT
with your desired enviroment name (e.g. dev, testing, uat). This will output the private IP address of the instances for the specific enviroment. - Get your phone out for Duo. Run
cchh arrow ssh PRIVATE_IP
. ReplacePRIVATE_IP
with one of the IPs output during step one. Any of them will do. - Once you are SSHed into the instance run
sudo su
. - Run
fleetctl list-units
, look for your service in the output. (Hint:grep
is your friend). - Copy the IP address from the line that matches the container you want logs from.
- Exit ths instance you are currently on. Run
exit
(to leavesudo
) then runexit
once more to leave the instance. - Run
cchh arrow ssh PRIVATE_IP_ADDRESS
, replacingPRIVATE_IP_ADDRESS
with the one you copied in step 5. - Run
sudo su
- Run
docker ps -a | grep SERVICE_NAME_MATCHER | awk '{print $2}'
. ReplaceSERVICE_NAME_MATCHER
with a word from your service name (e.g. if i were looking forprint-service
i might useprint
). - 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