|
1 | 1 | ---
|
2 | 2 | id: troubleshooting
|
3 |
| -title: Operation |
| 3 | +title: Troubleshooting |
4 | 4 | slug: /developer-resources/troubleshooting
|
5 | 5 | sidebar_position: 5
|
6 | 6 | ---
|
7 | 7 |
|
8 | 8 | ## Introduction
|
9 | 9 |
|
10 |
| -Coming soon. |
| 10 | +This page provides basic troubleshooting steps for the applications. |
| 11 | + |
| 12 | +## Docker |
| 13 | + |
| 14 | +When running the application using docker it may seem difficult at first to troubleshoot failures. This section covers some basic troubleshooting strategies. |
| 15 | + |
| 16 | +### Status Validation |
| 17 | + |
| 18 | +You can get a summary of all the running docker containers using the `docker ps` command. |
| 19 | + |
| 20 | +It will provide this information under these headings: |
| 21 | + |
| 22 | +1. **CONTAINER ID**: Container IDs |
| 23 | +1. **IMAGE**: Image names on which the containers are based |
| 24 | +1. **COMMAND**: The command that created the containers |
| 25 | +1. **CREATED**: The time of containers |
| 26 | +1. **STATUS**: Whether or not the containers are healthy |
| 27 | +1. **PORTS**: The exposed ports they use |
| 28 | +1. **NAMES**: The names of the running containers |
| 29 | + |
| 30 | +Here is an example: |
| 31 | + |
| 32 | +``` |
| 33 | +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES |
| 34 | +3a6743b03029 docker-app "docker-entrypoint.s…" 42 minutes ago Up 41 minutes 0.0.0.0:4321->4321/tcp docker-app-1 |
| 35 | +f86a9f480819 talawa-api-dev "/bin/bash /init-dat…" 42 minutes ago Up 42 minutes 0.0.0.0:4000->4000/tcp talawa-api-dev |
| 36 | +83ae5ff56a3f redis:8.0 "docker-entrypoint.s…" 42 minutes ago Up 42 minutes 0.0.0.0:6379->6379/tcp talawa-api-redis |
| 37 | +44c8a0f38b04 minio/minio "/usr/bin/docker-ent…" 42 minutes ago Up 42 minutes 0.0.0.0:9000->9001/tcp talawa-api-minio-1 |
| 38 | +3a9deccdb68e caddy/caddy:2.9 "caddy run --config …" 42 minutes ago Up 42 minutes 0.0.0.0:9080->9080/tcp caddy-service |
| 39 | +132dacf0aff4 mongo "/bin/bash /init-mon…" 42 minutes ago Up 42 minutes 0.0.0.0:27017->27017/tcp mongo |
| 40 | +``` |
| 41 | + |
| 42 | +You can get information on each of the headings by using filters like this: |
| 43 | + |
| 44 | +1. CONTAINER ID: `docker ps --format '{{.ID}}'` |
| 45 | +1. IMAGE: `docker ps --format '{{.Names}}'` |
| 46 | +1. COMMAND: `docker ps --format '{{.Command}}'` |
| 47 | +1. CREATED: `docker ps --format '{{.RunningFor}}'` |
| 48 | +1. STATUS: `docker ps --format '{{.Status}}'` |
| 49 | +1. PORTS: `docker ps --format '{{.Ports}}'` |
| 50 | +1. NAMES: `docker ps --format '{{.Names}}'` |
| 51 | + |
| 52 | +### Accessing The Container CLI |
| 53 | + |
| 54 | +You can access the CLI of each container using the docker interactive TTY mode flags `-it`. |
| 55 | + |
| 56 | +Here is an example accessing the `/bin/bash` CLI of the `talawa-api-dev` container: |
| 57 | + |
| 58 | +```bash |
| 59 | +$ docker exec -it talawa-api-dev /bin/bash |
| 60 | +root@f86a9f480819:/usr/src/app# ls |
| 61 | +CODEOWNERS Caddyfile Dockerfile.prod |
| 62 | +CODE_OF_CONDUCT.md DOCUMENTATION.md INSTALLATION.md |
| 63 | +CONTRIBUTING.md Dockerfile.dev ISSUE_GUIDELINES.md |
| 64 | +root@f86a9f480819:/usr/src/app# exit |
| 65 | +$ |
| 66 | +``` |
| 67 | + |
| 68 | +Here is an example accessing the `/bin/mongosh` CLI of the `mongo` container: |
| 69 | + |
| 70 | +```bash |
| 71 | +$ docker exec -it mongo /bin/mongosh |
| 72 | +... |
| 73 | +... |
| 74 | +... |
| 75 | +rs0 [direct: primary] test> show databases |
| 76 | +admin 80.00 KiB |
| 77 | +config 356.00 KiB |
| 78 | +local 1.92 MiB |
| 79 | +talawa-api 2.49 MiB |
| 80 | +rs0 [direct: primary] test> exit |
| 81 | +$ |
| 82 | +``` |
| 83 | + |
| 84 | +### Viewing Container Logs |
| 85 | + |
| 86 | +You can view the container logs in real time by using the `docker logs -f` command. The output will update dynamically as you run the app. |
| 87 | + |
| 88 | +In this case we see the logs of the `mongo` container. The `-n 10` flag makes the output start with the most recent 10 rows of logs which makes the output less verbose. |
| 89 | + |
| 90 | +```bash |
| 91 | +$ docker logs -f mongo -n 10 |
| 92 | +``` |
| 93 | + |
| 94 | +``` |
| 95 | +mongosh","version":"6.12.0|2.3.8"},"platform":"Node.js v20.18.1, LE","os":{"name":"linux","architecture":"x64","version":"3.10.0-327.22.2.el7.x86_64","type":"Linux"},"env":{"container":{"runtime":"docker"}}}}} |
| 96 | +{"t":{"$date":"2025-02-22T01:14:08.038+00:00"},"s":"I", "c":"NETWORK", "id":51800, "ctx":"conn2194","msg":"client metadata","attr":{"remote":"127.0.0.1:36844","client":"conn2194","negotiatedCompressors":[],"doc":{"application":{"name":"mongosh 2.3.8"},"driver":{"name":"nodejs|mongosh","version":"6.12.0|2.3.8"},"platform":"Node.js v20.18.1, LE","os":{"name":"linux","architecture":"x64","version":"3.10.0-327.22.2.el7.x86_64","type":"Linux"},"env":{"container":{"runtime":"docker"}}}}} |
| 97 | +{"t":{"$date":"2025-02-22T01:14:08.040+00:00"},"s":"I", "c":"NETWORK", "id":6788700, "ctx":"conn2193","msg":"Received first command on ingress connection since session start or auth handshake","attr":{"elapsedMillis":2}} |
| 98 | +{"t":{"$date":"2025-02-22T01:14:08.040+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:36848","uuid":{"uuid":{"$uuid":"1ef5fcbd-4913-45fe-bc66-7bc3600a941a"}},"connectionId":2195,"connectionCount":24}} |
| 99 | +{"t":{"$date":"2025-02-22T01:14:08.043+00:00"},"s":"I", "c":"NETWORK", "id":22943, "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:36854","uuid":{"uuid":{"$uuid":"48522796-7b00-46df-a5d1-3e2a9ec7edd8"}},"connectionId":2196,"connectionCount":25}} |
| 100 | +``` |
0 commit comments