{"id":20452885,"url":"https://github.com/marwenbhriz/hzbook","last_synced_at":"2026-04-09T15:54:49.709Z","repository":{"id":192987135,"uuid":"687854267","full_name":"marwenbhriz/hzbook","owner":"marwenbhriz","description":"This is simple CRUD project using django and mongodb. The main point is django and mongodb connection. ","archived":false,"fork":false,"pushed_at":"2024-06-04T14:17:33.000Z","size":31556,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-03-05T09:48:31.823Z","etag":null,"topics":["aks","azure","azure-devops","django","k8s","mongodb"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marwenbhriz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-06T06:33:07.000Z","updated_at":"2024-06-04T14:17:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"82b41912-9e1d-46d8-8f20-730f3fa7a016","html_url":"https://github.com/marwenbhriz/hzbook","commit_stats":null,"previous_names":["marwenbhriz/hzbook"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marwenbhriz/hzbook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwenbhriz%2Fhzbook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwenbhriz%2Fhzbook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwenbhriz%2Fhzbook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwenbhriz%2Fhzbook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marwenbhriz","download_url":"https://codeload.github.com/marwenbhriz/hzbook/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marwenbhriz%2Fhzbook/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266221327,"owners_count":23894966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aks","azure","azure-devops","django","k8s","mongodb"],"created_at":"2024-11-15T11:10:41.622Z","updated_at":"2025-12-30T20:06:41.027Z","avatar_url":"https://github.com/marwenbhriz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HZBooK Simple Django App For Managing Books\n\n\u003e Note: To Test this app need to access to UI and trying to post new book and check from mongo UI this book saved `hzbook`.\n\n## Contents Guide\n+ [Prerequisites](#Prerequisites)\n    + [Shell Environment and Editor](#Shell)\n    + [Installing Kubernetes](#Kubernetes)\n    + [Installing Azure CLI](#Azure)\n+ [Hzbook](#Hzbook)\n    + [Terraform](#Terraform)\n    + [Azure Devops](#azure-devops)\n    + [Database](#Database)\n    + [HZBooKapp](#HZBooKapp)\n\n## Prerequisites\n\nHZBooK will require the tooling listed below. Ensure that all of those tools have been installed.\n\n## Kubernetes\n\nKubectl client [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/). \n\nAlternatively, you may also go with [Docker Desktop](https://www.docker.com/products/docker-desktop) which is available for Mac and Windows. Docker Desktop provides an option to start a fully functional Kubernetes environment.\n\n## Shell\n\nYou can check your shell by running the command `echo $0`.\n\n## Azure CLI\n\n```sh\n// install azure cli\nbrew update \u0026\u0026 brew install azure-cli\n\n// login to azure account\naz login\n```\n\n## Terraform\n\n### Requirements\n\n* configured Azure CLI\n\n### Set up azure resources\n\nCreate resources in the following order and execute commands below:\n\n1. Resource Group\n2. Registry\n3. AKS\n\n```sh\ncd terraform/\u003cfolder\u003e\n\nterraform init\n\nterraform apply\n```\n\n## Azure Devops\n\n### CI pipeline aks Azure Pipeline\n\n#### Prerequisites\n\n* Github access to repositories (saved as service connection in `Project Settings`)\n* Docker Registry [Service Connection](./azure-devops/req-service-connections.md)\n* [Environment](./azure-devops/req-environments.md) to kubernetes cluster\n* [Variable groups](./azure-devops/req-variable-groups.md): `deploy-variables`, `docker-variables`\n\n### Create a new CI Pipeline\n\nUnder `Pipelines` \u003e `Pipelines` create a new one by following these steps:\n\n* Connect: `Github`\n* Select a repository:\n  * If you cannot find your repository, select `connection` under \"You may also select a specific connection\".\n  * Use an existing connection: _\u003cgithub_service_connection\u003e_\n* Review: `Run` \u003e `Save`\n\n## Database\n\n### Initializing\n\n```sh\n# 1. Change to the directory\ncd ./db/mongodb/\n\n# 2. Configure hostvm nodes via daemonset and startup-script\nkubectl apply -f hostvm-node-configurer-ds.yaml\n\n# 4. Create mongodb service and statefulsets\nkubectl apply -f mongo-rs.yaml\n\n# 5. Initialize mongo replicaset\nkubectl exec -it mongod-0 -c mongod-container -- mongo\n\nrs.initiate({_id: \"MainRepSet\", version: 1, members: [\n  { _id: 0, host : \"mongod-0.mongodb-service.default.svc.cluster.local:27017\" },\n]});\nrs.status(); # wait until become PRIMARY\n\n# 6. Create admin user in mongodb\ndb.getSiblingDB(\"admin\").createUser({\n  user : \"admin\",\n  pwd  : \"password\",\n  roles: [ { role: \"root\", db: \"admin\" } ]\n});\n\n# 7. change to the directory\ncd ./db/mongoexpress/k8s/\n\n# 8. Create mongo express secret\nkubectl apply -f secret/mongoexpress-secret.yml\n\n# 9. Create mongo express deployment\nkubectl apply -f deployments/mongoexpress-deployment.yml\n\n# 10. Create mongo express service\nkubectl apply -f services/mongoexpress-svc.yml\n```\n\n### MongoExpress Access\n\naccess to mongo express UI http://4.241.137.148:8081/ and use db creds to access to hzbook database.\n\n\n## HZBooKapp\n\n### Build adn push\n\n```sh\n./do.sh build_push_az $ACR_NAME $Tag\n```\n\n### Deploy\n\n```sh\n./do.sh deploy_az $APP_ENV\n\n// PS C:\\Users\\mbenh\u003e kubectl get po\nNAME                            READY   STATUS    RESTARTS   AGE\nhostvm-configurer-whsfv         1/1     Running   0          39h\nhzbook-6f57cb4bc6-d85fl         1/1     Running   0          93m\nmongod-0                        1/1     Running   0          36h\nmongoexpress-5d4444d585-nfbwt   1/1     Running   0          35h\n```\n\nor we can deploy buy trigger our azure devops pipeline; by merging to master branch.\n\n### Access to UI\n\naccess to mongo express UI http://4.241.5.63:8000/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarwenbhriz%2Fhzbook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarwenbhriz%2Fhzbook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarwenbhriz%2Fhzbook/lists"}