Goal: deploy reactjs (front) and python (back) project on Azure VM Linux (Ubuntu 18.04)
I have a project folder where I have two subdirectories: one named front and one names back.
To launch it on my local computer (linux 18.04) I do the following steps:
To start the back
cd back
flask run
To start the front
cd front
npm start
Then go to http://localhost:3000/ (redirected automatically there after launching npm start)
I need to deploy now my project using Azure. So I have access to an Azure VM that has Ubuntu 18.04 on it which I can access using SSH from my local computer.
How am I supposed to deploy this project on the VM? Do I need to simply do the same as on my local machine (flask run and npm start)?
PS: It is the first time I deploy a project.
You can use Azure App Services to achieve your needs (choose Windows platform when creating it).
Advantage:
Easy to deploy, azure web app has many mature tools to monitor programs, record logs, etc.
The cost is low compared to VM.
If you use Premium App Service plan, webapp will be backed up regularly. (Excluding data in the database, only for files under wwwroot)
Related Post:
How to deploy a Flask+React application to Azure Web Service
Related
I have a nodeJS API which uses child_process to run a python file.
I know heroku has a way to add another buildpack with a script.
Is there a way with Microsoft Azure (web app / app services) to use NodeAPI and Python files in an App service.
PS : Python file is not an API, it is just a script that runs from node.
Thank you
When you hosted a Web App in Azure, you already have all runtime environments by default.
Web App Runtime on Azure Portal:
Python Runtime on Kudu Explorer:
NodeJS and PHP on Kudu Explorer:
Check the other stack versions in Console and if it not sufficient, update them.
Note:
When creating the webapp, it is recommended to choose windows platform which supports virtual application because when you find that you cannot use the runtime you required, you can try to install runtime extensions for other programs.
Also, it is possible under Linux but requires command line to operate.
From within VSCode, using the Azure web service extension, I can deploy a Hello-World flask app successfully to my Azure web app (linux, python 3.6 stack).
When I try to deploy my real flask app (with dependencies listed in a requirements.txt) file, and I specify "pip install --upgrade -r requirements.txt" as the web app "startup command" in the Azure portal, browsing the web app page gives an "Application Error".
The log for my web app shows the startup code failing when trying to build "psutil" due to the error unable to execute 'gcc': No such file or directory.
When the above failed, I also tried using "wheels" as part of my deployment as described here (https://blogs.msdn.microsoft.com/azureossds/2015/06/29/install-native-python-modules-on-azure-web-apps-api-apps/), but that didn't seem to change anything (same 'missing gcc' error).
Is this the correct way to deploy a flask app with python library dependencies from VSCode? I would expect that the deployment process would automatically process the requirements.txt (without having to specify the startup command) and I would expect it to be able to install the python libraries without error.
Due to you were using Azure WebApp for Linux based on Docker Container, the MSDN blog Install Python Modules on Azure App Services for Azure WebApp for Windows is not useful for your issue.
So for your issue of missing gcc error, per my experience, the solution to fix it is to configure a custom Linux container which had been pre-installed the gcc tool-chains and then to deploy your app into it from VS Code.
As references, please try to follow the documents below.
Configure a custom Linux container for Azure App Service . To install the gcc toolchains in a custom docker image via change the Docker file like install openssh as the section Enable SSH said.
Deploy to Azure using Docker from VS Code with Azure App Service extension.
I'm using Azure Python SDK to deploy a Linux Vm in the Cloud. This Vm has a public IP and ssh enabled. I need to have this Vm running a custom script immediately after it boots . This script would install pip, python, docker etc and start a docker container.
How could I pass this script when deploying the vm ? / How could I instruct the vm to run this script after it has started ?
Cheers,
Steve
According to your scenario, you could use Azure Custom Script Extension.
The Custom Script Extension downloads and executes scripts on Azure
virtual machines. This extension is useful for post deployment
configuration, software installation, or any other configuration /
management task. Scripts can be downloaded from Azure storage or other
accessible internet location, or provided to the extension run time.
If you want to use python to do this, please refer to this python sdk documentation.
Please refer to the similar question.
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.
I'm a bit confused with Openshift... so far i've created an app and added python and postgresql, i've downloaded odoo-master from sourceforge, and what i've done is clone the git, then what do i have to do?, should i just copy the folder odoo-master into the folder that git created, then run "git add ."->"git commit -m"odoo added" "->"git push" ?
Another questions that i have are:
When i add a new folder in the app folder how do i tell openshift to run the files that are inside that folder?
What does OpenShift Origin is?(be clear for a newbie)
What can i do with OpenShift Cartridge?
Is cartridge a client tool?, what are the client tools and what are they for?
If the question is unclear please ask me, my native language is not english and my technical language is not too great.
I can answer some of the questions.
Openshift origin
This is the primary place for Openshift source code. You will get all the features quickly in origin. After a lot of formal QA, the source is moved to enterprise and online. But in the end, the features you see in Openshift Origin should end in Online and Entreprise, as that's the same codebase. You can run the origin in your local system like a docker image in Virtual machine.
OpenShift-Specific Terminology
Application
This is your typical web application that will run on OpenShift. At this time, OpenShift is focused on hosting web applications. In your case it is Odoo (Openerp).
Gear
A gear is a server container with a set of resources that allows you to run their applications. Your gears run on OpenShift in the cloud. There are currently three gear types on OpenShift Online: small, medium, and large. Each size provides 1 GB of disk space by default. The large gear has 2 GB of RAM, the medium gear has 1 GB of RAM, and the small and small.highcpu gears have 512 MB of RAM.
Cartridge
To get a gear to do anything, you need to add a cartridge. Cartridges are the plug-ins that house the framework or components that can be used to create and run an application.
Basically Openshift splitted their runtime environments through different cartridges. Cartridges can be web frameworks, databases, monitoring services, or connectors to external backends. In the case of odoo, you need python and postgresql cartridges.
Python is a Standalone cartridge, postgresql is a Embedded cartridge.
You can control your cloud environment through the OpenShift Client tools, known as rhc or Web console.
With rhc, it easy to create and deploy applications, manage domains, control access to your OpenShift applications, and give you complete control of your cloud environment. Consider this as a ssh client for your openshift server.
You need to install Odoo dependencies from the openshift temp data directory in order to run Odoo (I have not tried Odoo in Openshift yet).