|
| 1 | +--- |
| 2 | +title: Week 2 |
| 3 | +author: Muhammad Salman |
| 4 | +author_url: https://github.com/SalmanDeveloperz |
| 5 | +tags: [gsoc25, microservices, infrastructure, devops] |
| 6 | + |
| 7 | +--- |
| 8 | +<!-- |
| 9 | +SPDX-License-Identifier: CC-BY-SA-4.0 |
| 10 | +
|
| 11 | +SPDX-FileCopyright Text: 2025 Muhammad Salman <chsalmanramzan422@gmail.com> |
| 12 | +--> |
| 13 | + |
| 14 | +# Week 2 |
| 15 | + |
| 16 | +*(June 10, 2025 - June 16, 2025)* |
| 17 | + |
| 18 | +## Continued Troubleshooting and Progress |
| 19 | + |
| 20 | +This week, I focused heavily on solving the issues from Week 1 and making solid progress in setting up the FOSSology microservices using Docker, Minikube and Kubernetes. It was a challenging week, filled with lots of debugging, learning and small victories that kept me motivated. |
| 21 | + |
| 22 | +## Switching to bookworm-slim Base Image |
| 23 | + |
| 24 | +Following [Shaheem](https://github.com/shaheemazmalmmd)'s suggestion, I tried replacing the base image from <code>buster-slim</code> to <code> bookworm-slim </code>. I updated relevant dockerfiles like **Dockerfile.pkg** and started rebuilding everything. |
| 25 | + |
| 26 | +Unfortunately, this caused multiple compatibility issues. The builds were failing due to some outdated dependencies not working well with <code>Bookworm</code>. After spending a lot of time debugging, I rolled back to <code>buster-slim </code> to keep things stable and moving. |
| 27 | + |
| 28 | +## Fixing Docker Build Issues |
| 29 | + |
| 30 | +Some <code>.deb</code> files were missing, which broke the build process. |
| 31 | + |
| 32 | +I updated the <code>debian/changelog</code> and adjusted the **Dockerfile.pkg** build context. |
| 33 | + |
| 34 | +I also handled merge conflicts while rebasing Omar’s changes, mainly in **04-db-statefulset.yaml**. |
| 35 | + |
| 36 | +## Fixed the Web UI Issue |
| 37 | + |
| 38 | +At first, the web UI was showing the default Debian Apache2 page instead of the FOSSology interface. Here how it looks: |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +After digging through the Dockerfile, I found some path issues. I fixed the file paths and rebuilt the image. After that, the correct FOSSology interface started showing up. |
| 43 | + |
| 44 | +## All Docker Images Built & Tested Successfully |
| 45 | + |
| 46 | +I was able to build and test all the following Base images: |
| 47 | + |
| 48 | +- <code>**packages**</code> |
| 49 | + |
| 50 | +- <code>**scheduler**</code> |
| 51 | + |
| 52 | +- <code>**web**</code> |
| 53 | + |
| 54 | +- <code>**ununpack**</code> |
| 55 | + |
| 56 | +- <code>**wget_agent**</code> |
| 57 | + |
| 58 | +- <code>**nomos**</code> |
| 59 | + |
| 60 | +- <code>**copyright**</code> |
| 61 | + |
| 62 | +- <code>**ojo**</code> |
| 63 | + |
| 64 | +I loaded them into Minikube and run : <code>kubectl apply -f k8s/</code> |
| 65 | + |
| 66 | +I tested each container individually using <code> kubectl get pods </code> and manual validation, except **web** and **db** pods, everything worked smoothly. |
| 67 | + |
| 68 | +Then I run: <code>minikube service web</code> and this time the UI opened in the default browser showing Database connection issue. |
| 69 | + |
| 70 | +## Database Connection Issue |
| 71 | + |
| 72 | +Even though everything else is working fine, I still couldn’t get the FOSSology UI to connect to the database. Here’s what’s happening: |
| 73 | + |
| 74 | + The <code>db-0</code> pod is stucked in <code>Init:0/1</code>. |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + Visiting http://192.168.49.2:30745/ shows the **FOSSology Logo** displayed in browser tab but also showing: |
| 79 | + |
| 80 | + **"Could not connect to Fossology database"** |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | +## Meeting 2 |
| 85 | + |
| 86 | +*(June 11, 2025)* |
| 87 | + |
| 88 | +My mentor [Avinal](https://github.com/avinal) was out of the country and unavailable, so no meeting took place. |
| 89 | + |
| 90 | +## Meeting 2 |
| 91 | + |
| 92 | +*(June 12, 2025)* |
| 93 | + |
| 94 | +I joined the weekly community meeting. I shared my progress like fixing the web UI (Debian homescreen issue) and building all Docker images, but I also laid out the database connection issue that’s been a thorn in my side. They suggested the **PostgreSQL** problem might be a startup or installation and recommended trying <code>/etc/init.d/postgres start</code>, which later didn’t work in the pod environment. |
| 95 | + |
| 96 | +## Meeting 3 |
| 97 | + |
| 98 | +*(June 14, 2025)* |
| 99 | + |
| 100 | +I had a very helpful 1-on-1 call with [Shaheem](https://github.com/shaheemazmalmmd), where we tried to troubleshoot the database issue together. |
| 101 | + |
| 102 | +Here’s what we tried:- |
| 103 | + |
| 104 | +**Running PostgreSQL locally:** <code>psql -h localhost -p 5432 -U fossy</code> |
| 105 | + |
| 106 | +This worked perfectly. The PostgreSQL server was running and responding locally via the command line. |
| 107 | + |
| 108 | +**Confirmed DB Connection:** |
| 109 | +From inside the container environment, PostgreSQL was also running and showing as connected. |
| 110 | + |
| 111 | +**Still Broken on Browser URL:** |
| 112 | +Despite local success, the URL http://192.168.49.2:30745/ still gave the database connection error. |
| 113 | + |
| 114 | +**Pods & Build Issues:** |
| 115 | +We realized that while the DB works locally, it fails inside **Kubernetes pods** due to something in the init container or service configuration. This was likely related to the startup order or network setup. |
| 116 | + |
| 117 | + |
| 118 | +## What I Tried to Fix the DB Issue |
| 119 | + |
| 120 | +I tried multiple fixes on my own to solve this: |
| 121 | + |
| 122 | + - Recreated the PersistentVolumeClaim (PVC) for the database |
| 123 | + |
| 124 | + - Updated **00-configmap.yaml** and **01-db-secret.yaml** with proper values |
| 125 | + |
| 126 | + - Added a readiness probe: |
| 127 | + <code>exec: [ "pg_isready", "-U", "postgres" ]</code> |
| 128 | + |
| 129 | + - Increased the init script delay to **180 seconds** to give PostgreSQL time to boot |
| 130 | + |
| 131 | + - Added detailed logging (<code>ps aux</code>, <code>netstat</code> etc...) to trace what’s running during startup |
| 132 | + |
| 133 | + - Tried starting PostgreSQL manually using: <code>/etc/init.d/postgres start</code> |
| 134 | + |
| 135 | +But this didn’t work inside the pod environment. |
| 136 | + |
| 137 | +## Planning Next Week |
| 138 | + |
| 139 | +For Week 3, I’m ready to tackle these goals: |
| 140 | + |
| 141 | +- Crack the database connection issue by diving deeper into the db-0 pod’s init container and getting PostgreSQL to start properly. |
| 142 | + |
| 143 | +- Keep an eye on pod logs and try out new configurations to hunt for a fix. |
| 144 | + |
| 145 | +- Test the scheduler to make sure it’s good to go once the database is up and running. |
| 146 | + |
| 147 | +- Reach out to my mentors and community for more guidance and ideas. |
0 commit comments