Automate Flask app deployment using Fabric python library easily
Required python version
$ python --version
Python 3.5.5Used Anaconda to virtual environment tool to separate app from others
Note: I believe that you have already installed anaconda in your server
Commands
First IMPORTANT thing to do is Generating SSH key and add it to the Github Account
Here is the link AND Add your ssh key to Authorised Access keys list in the server, so that It wont ask for the password
Clone the repo
$ git clone https://github.com/<user>/<repo_name>.git
OR
$ git clone git@github.com:<USER>/<REPO_NAME>.gitCreate virtual environment (Install Anaconda before running this command)
$ conda env create -f flask_auto_deploy.ymlOr
Create new virtual env using conda create -n env_name python=3.5
Activate the virtual env
$ source activate env_nameInstall requirements.txt
$ pip install -r requirements.txtOnce All this done, now you should be able to see some available commands with fab
To see the list of command
$ fab --listTo check the service status. example
$ fab service nginx status