Python Flask as a Cloud Foundry app vs as a container - python

I'm new to IBM Cloud and cloud platforms in general and wanted to start my Flask app on IBM Cloud, I just started with this Getting started with Python but I'm very confused with how it will work.
Is Cloud Foundry working the same way as containers work?
How the platform handle the dependencies in order to Flask use them in both deployment ways?

Your question is (almost) too broad. I can give you some basic answers, but everything else should be separate questions when you run into specific problems. You are referring to the Getting Started with Python and Cloud Foundry on IBM Cloud (this is the IBM Cloud docs, not the GitHub repo).
When working with Cloud Foundry (CF), the CF environment and buildpack takes care of the dependencies. For Python, they are specified in the file requirements.txt and there is the file manifest.yml to configure the app, its name, memory usage, domain and more. When you push the app (either cf push or ibmcloud cf push) the two files are taken into account and everything else is done automatically. That's the appeal of Cloud Foundry.
With containers, you would write a Dockerfile, then build the container image, push the image to a container registry, deploy the container to Kubernetes. When you build the container, your script would need to take care of resolving the dependencies (based on requirements.txt) and include the necessary modules into the image.
I recommend reading the Deploy an Application Cloud Foundry doc as a starter to give some more background. There is also a simple IBM Cloud solution tutorial that walks you through the steps of deploying a Flask app with a Db2 database. That same site with IBM Cloud solution tutorials also has an overview of tutorials by deployment option (Cloud Foundry, Kubernetes, Cloud Functions, etc.).

Related

Test applications for Google Cloud and Azure locally

Is there any way to test applications for Google Cloud or Azure locally in a computer, similar to the Localstack Docker image for AWS?
Thank you!
To test you application locally you can use Google App Engine Local Devolopment server to simulate your app running on app engine externally.
Demo python application via app engine
As you mentioned docker you may want to test your images locally you can also do this by following these instructions.
You can see this post. Here are some useful links, you will find
https://www.testcontainers.org/modules/gcloud/

How to deploy opencv application into google cloud VM

I want to deploy my OpenCV application into google cloud. This application is written in python and I need to deploy it into Google Cloud server. It could be run on any os(MAC, Windows, Linux, etc.)
How can I solve this problem?
There are many options to deploy an application on Google Cloud.
If you developed your application using Python 3.7 or 3.8 you could explore the use of App Engine Standard or Cloud Functions, but in order to have more flexibility and if you used any other versions of Python take a look at Cloud Run or App Engine Flexible.
If you are not interested in the serverless aspect of Cloud Computing you could simply deploy your application in a Compute Engine Instance.

Build a docker image for google bigquery

I have a huge amount of data (hundreds of Gigas) on Google BigQuery and for easy of use (many post query treatements) I'm working with the bigquery python package. The problem is that I have to run again all my queries whenever I shut my laptop down, this is very expensive as my dataset is about one Tera. I think of Google Compute Engine but this is a poor solution as I will still paying for my machines if I don't stop them. My last solution is to mount a docker image on our own sandbox, this is cheaper and can do exactly what I'm looking for. So I would like to know if someone has ever mounted a docker image for BigQuery ? Thanks for helping!
We mount all of our python/bigquery projects into docker containers and push them to google cloud registry.
Automated scheduling, dependancy graphing, and logging can be handled with Google Cloud Composer (Airflow). Its pretty simple to get set up, and Airflow has a Kubernetes Pod Operator, That allows you to specify a python file to run in your docker image on GCR. You can use this workflow to make sure all of your queries and python scripts are run on GCP without having to worry about Google Compute Engine, or any devops type of things.
https://cloud.google.com/composer/docs/how-to/using/using-kubernetes-pod-operator
https://cloud.google.com/composer/

Deployment on Google App Engine - Django, Vagrant, Ansible

I want to deploy Django project on google app engine
Following are the current situations.
I have a code on GITHUB
Djnago project has setup using Vagrant, Ansible, VirtualBox
I am completely new for cloud base deployments.
Need help to achieve this.
I checked google docs but there are couple of options for django related deployment, I am not sure which to pick for vagrant and ansible.
Your question is a bit too generic as it stands - making it here rather than comment for clarity.
If you're talking about deploying to GAE (Google App Engine) then most likely you cannot re-use your Ansible scripts as you've been writing for vagrant. As it may be possible to use Ansible to deploy on GAE, most people I know are using standard google procedure to deploy their app.
If you plan to use GCE (Google Compute Engine, a layer down in the infrastructure), you would be able to use your existing Ansible provisioning scripts (maybe with slight modification), follow along the Ansible documentation

Deploy django application on Microsoft Azure or Amazon Elastic Besanstalk

I'm deploying a django (python) application. I wondered what is the best way to deploy it. With microsoft azure or Amazon Elastic Beanstalk ?
The application just needs to view data from a database. What are (dis)advantages of azure or elastic beanstalk?
I'm using OSX 10.9.5 and Python 3.4.3
As Gaurav Mantri said, you need to provide more details - atleast the OS you are using. Some more surfing could lead you here :
What's the recommended way to deploy a Django app on IIS?
For web apps, Azure has Azure App Service. Deployment can be done through a variety of ways, including FTP, git, or from Visual Studio. Since you're using Mac, I would recommend deploying via git.
To do so, first create a web app in the Azure portal, and then follow the steps here:
https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/
The advantages of Azure App Service, is that you can easily scale your app to many machines, and everything is taken care for you. Note that depending on how you've configured your database, you would have to deploy that separately.
Also, if you want to test Azure App Service, you can easily create a small sample Django application, using the Azure gallery. See the screen shot below.
Azure Web Apps provide a volume of ways for deployment your web applications. We can leverage tools/IDEs including FTP tools , Visual Studio and WebMatrix on Windows for remoting and modifying your web site code, and leverage repository for continuous deployment including local GIT, GITHUB, Visual Studio Online, Dropbox, Bitbucket.
It depends which way you prefer to.
As # theadriangreen mentioned, Azure Web Apps provide Django template for a quick start, you can simply create a Django application and pull the code to local leveraging the methods above.
Beside Continuous deployment using GIT in Azure App Service, you also can refer to Creating web apps with Django in Azure for more information.

Categories

Resources