Question

In: Computer Science

Linux project deployment Script Create a script “setup.sh” to automate the deployment of a flask application....

Linux project deployment Script

Create a script “setup.sh” to automate the deployment of a flask application. The script must install all software dependencies such as:

  1. Python3

  2. Pip3

  3. Git

Use github to clone this repository.

Install the dependencies given in requirements.txt

Start the server by executing the following command “gunicorn wsgi:app”

requirements.txt

Click==7.0

Flask==1.0.2

Flask-Cors==3.0.7

Flask-JWT==0.3.2

Flask-SQLAlchemy==2.3.2

gunicorn==19.9.0

itsdangerous==1.1.0

Jinja2>=2.10.1

MarkupSafe==1.1.1

PyJWT==1.4.2

six==1.12.0

SQLAlchemy==1.3.1

werkzeug>=0.15.3

Solutions

Expert Solution

#!/usr/bin/env bash

#declare the constants
orgName="example"
reponame="example"

reqs ="Click==7.0
Flask==1.0.2
Flask-Cors==3.0.7
Flask-JWT==0.3.2
Flask-SQLAlchemy==2.3.2
gunicorn==19.9.0
itsdangerous==1.1.0
Jinja2>=2.10.1
MarkupSafe==1.1.1
PyJWT==1.4.2
six==1.12.0
SQLAlchemy==1.3.1
werkzeug>=0.15.3"

# update source list for packages and versions that can be installed
sudo apt-get update 

#install python
sudo apt-get install -y python3.6 python3-pip python3.6-dev 

#install GitHub
sudo apt-get install git-all

#clone repository using ssh -- need to setup ssh key for account
git clone [email protected]:$orgName/$reponame.git
echo "Cloning: [email protected]:$orgName/$reponame.git"

#change dir to newly cloned repo
cd $reponame

#create the requirement.txt file
echo "$reqs" > requirements.txt

#install all dependencies using requirements.txt
pip3 install -r requirements.txt 

#Start the server by executing the following command
gunicorn wsgi:app

I added all the commands as per the requirements in the question, for cloning the repository SSH keys must be setup first for authentication. If you have any further question, feel free to comment on the answer. I will be happy to help.


Related Solutions

write a script in ruby to automate user account creation in Linux using a CSV file....
write a script in ruby to automate user account creation in Linux using a CSV file. Username is a combination of first initial last initial of the first name and last name in the last name followed by the first initial last initial(Ex. Sam Smith = smithsm). If two or more employees had the same first and last name appends a number to the end of the username. After accounts are created write the first and last names along with...
UNIX/LINUX SCRIPT: Create a named directory and verify that the directory is there by listing all...
UNIX/LINUX SCRIPT: Create a named directory and verify that the directory is there by listing all its contents. Write a shell script to validate password strength. Here are a few assumptions for the password string.   Length – a minimum of 8 characters. • Contain alphabets , numbers , and @ # $ % & * symbols. • Include both the small and capital case letters. give a prompt of Y or N to try another password and displays an error...
LINUX In Linux command line write a shell script ex1.sh that uses IF THEN to Prompt...
LINUX In Linux command line write a shell script ex1.sh that uses IF THEN to Prompt the user to "Enter a number between 1 and 10". (Hint: Use the 'echo' and 'read' commands in the script. See the slide about the 'read' command) If the number is less than 5, print "The number is less than 5" (Hint: You will read input into a variable; e.g. read NUM. In the IF statement, enclose $NUM in quotes; e.g. "$NUM". Also, remember...
Create a C# console application (do not create a .NET CORE project) and name the project....
Create a C# console application (do not create a .NET CORE project) and name the project. Generate two random integers, each between 1 and 50, that you will be adding together to test the user's ability to perform the addition operator. Display the numbers in the console, such as:             7 + 22 = ? Once the user provides their answer, check to see if it is correct and if not, tell them sorry, please try again. If their answer...
Create a C# console application (do not create a .NET CORE project) and name the project...
Create a C# console application (do not create a .NET CORE project) and name the project TuitionIncrease. The college charges a full-time student $12,000 in tuition per semester. It has been announced that there will be a tuition increase by 5% each year for the next 7 years. Your application should display the projected semester tuition amount for the next 7 years in the console window in the following format:             The tuition after year 1 will be $12,600. Note:...
Create a C# console application (do not create a .NET CORE project) and name the project...
Create a C# console application (do not create a .NET CORE project) and name the project TimeToBurn. Running on a particular treadmill, you burn 3.9 calories per minute. Ask the user how many calories they wish to burn in this workout session (this is their goal). Once they tell you, output on the console after each minute, how many calories they have burned (e.g. After 1 minute, you have burned 3.9 calories). Keep outputting the total amount of calories they...
application that uses linux operating system amd justify the linux operating system. provide a suitable application...
application that uses linux operating system amd justify the linux operating system. provide a suitable application that uses linux os and justify the usage of linux os in the considered application.
Linux Script Convert String (Part 1) Write a simple shell script that takes a permission string...
Linux Script Convert String (Part 1) Write a simple shell script that takes a permission string expressed as -rwxrwxrwx and prints out whether or not theobject is a directory, file or link. The string is read in from standard input. Convert String (Part 2) Modify the script so its able to print out the octal permission which the string represents along with the file type. This is in addition to part 1. Convert String (Part 3) For the script in...
Create a project plan on the game or application you are creating. The project plan should...
Create a project plan on the game or application you are creating. The project plan should include the following: A description of the game or application The IDE or game engine your plan to use to create the game or app and information on how you are going to develop the game or app If you choose to create a game, how are you going to approach the game design and game development process or if you choose an application...
LINUX/UNIX Create a script named favcolor.sh. Take 2 parameters, 1. Username, 2. Favorite color. Print any...
LINUX/UNIX Create a script named favcolor.sh. Take 2 parameters, 1. Username, 2. Favorite color. Print any sentence on console using these 2 parameters.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT