{"id":20695902,"url":"https://github.com/ibm-cloud/get-started-python","last_synced_at":"2025-04-04T11:15:37.534Z","repository":{"id":29018922,"uuid":"32546138","full_name":"IBM-Cloud/get-started-python","owner":"IBM-Cloud","description":"A Python application and tutorial that use Flask framework to provide a REST API to receive requests from the UI. The API then persists the data to a Cloudant database.","archived":false,"fork":false,"pushed_at":"2024-08-13T18:22:31.000Z","size":57,"stargazers_count":122,"open_issues_count":10,"forks_count":440,"subscribers_count":33,"default_branch":"main","last_synced_at":"2025-03-28T10:08:06.775Z","etag":null,"topics":["bluemix","database","flask","python","sample","tutorial"],"latest_commit_sha":null,"homepage":"https://console.ng.bluemix.net/docs/runtimes/python/getting-started.html","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IBM-Cloud.png","metadata":{"files":{"readme":"README-kubernetes.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2015-03-19T21:04:43.000Z","updated_at":"2025-03-21T19:31:26.000Z","dependencies_parsed_at":"2024-11-17T00:23:32.581Z","dependency_job_id":null,"html_url":"https://github.com/IBM-Cloud/get-started-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM-Cloud%2Fget-started-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM-Cloud%2Fget-started-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM-Cloud%2Fget-started-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM-Cloud%2Fget-started-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IBM-Cloud","download_url":"https://codeload.github.com/IBM-Cloud/get-started-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166169,"owners_count":20894654,"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":["bluemix","database","flask","python","sample","tutorial"],"created_at":"2024-11-17T00:11:47.532Z","updated_at":"2025-04-04T11:15:37.515Z","avatar_url":"https://github.com/IBM-Cloud.png","language":"JavaScript","readme":"# Deploy to IBM Cloud Kubernetes Service\n\nFollow these instructions to deploy this application to a Kubernetes cluster and connect it with a Cloudant database.\n\n## Download\n\n```bash\nhttps://github.com/IBM-Cloud/get-started-python\ncd get-started-python\n```\n\n## Build Docker Image\n\n1. Find your container registry **namespace** by running `ibmcloud cr namespaces`. If you don't have any, create one using `ibmcloud cr namespace-add \u003cname\u003e`\n\n2. Identify your **Container Registry** by running `ibmcloud cr info` (Ex: registry.ng.bluemix.net)\n\n3. Build and tag (`-t`)the docker image by running the command below replacing REGISTRY and NAMESPACE with he appropriate values.\n\n   ```sh\n   docker build . -t \u003cREGISTRY\u003e/\u003cNAMESPACE\u003e/myapp:v1.0.0\n   ```\n   Example: `docker build . -t registry.ng.bluemix.net/mynamespace/myapp:v1.0.0\n\n4. Push the docker image to your Container Registry on IBM Cloud\n\n   ```sh\n   docker push \u003cREGISTRY\u003e/\u003cNAMESPACE\u003e/myapp:v1.0.0\n   ```\n\n## Deploy\n\n#### Create a Kubernetes cluster\n\n1. [Creating a Kubernetes cluster in IBM Cloud](https://console.bluemix.net/docs/containers/container_index.html#clusters).\n2. Follow the instructions in the Access tab to set up your `kubectl` cli.\n\n#### Create a Cloudant Database \n\n1. Go to the [Catalog](https://console.bluemix.net/catalog/) and create a new [Cloudant](https://console.bluemix.net/catalog/services/cloudant-nosql-db) database instance.\n\n2. Choose `Legacy and IAM` for **Authentication**\n\n3. Create new credentials under **Service Credentials** and copy value of the **url** field.\n\n4. Create a Kubernetes secret with your Cloudant credentials (url, username and password).\n\n```bash\nkubectl create secret generic cloudant --from-literal=url=\u003cURL\u003e --from-literal=username=\u003cUSERNAME\u003e --from-literal=password=\u003cPASSWORD\u003e\n```\nExample:\n```bash\nkubectl create secret generic cloudant --from-literal=url=https://myusername:passw0rdf@username-bluemix.cloudant.com  --from-literal=username=myusername --from-literal=password=passw0rd\n```\n\n#### Create the deployment\n\n1. Replace `\u003cREGISTRY\u003e` and `\u003cNAMESPACE\u003e` with the appropriate values in `kubernetes/deployment.yaml`\n2. Create a deployment:\n  ```shell\n  kubectl create -f kubernetes/deployment.yaml\n  ```\n- **Paid Cluster**: Expose the service using an External IP and Loadbalancer\n  ```\n  kubectl expose deployment get-started-python --type LoadBalancer --port 8000 --target-port 8000\n  ```\n\n- **Free Cluster**: Use the Worker IP and NodePort\n  ```bash\n  kubectl expose deployment get-started-python --type NodePort --port 8000 --target-port 8000\n  ```\n\n### Access the application\n\nVerify **STATUS** of pod is `RUNNING`\n\n```shell\nkubectl get pods -l app=get-started-python\n```\n\n**Standard (Paid) Cluster:**\n\n1. Identify your LoadBalancer Ingress IP using `kubectl get service get-started-python`\n2. Access your application at t `http://\u003cEXTERNAL-IP\u003e:8000/`\n\n**Free Cluster:**\n\n1. Identify your Worker Public IP using `ibmcloud cs workers YOUR_CLUSTER_NAME`\n2. Identify the Node Port using `kubectl describe service get-started-python`\n3. Access your application at `http://\u003cWORKER-PUBLIC-IP\u003e:\u003cNODE-PORT\u003e/`\n\n\n## Clean Up\n```bash\nkubectl delete deployment,service -l app=get-started-python\nkubectl delete secret cloudant\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibm-cloud%2Fget-started-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibm-cloud%2Fget-started-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibm-cloud%2Fget-started-python/lists"}