Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e619dd4ef | |||
| 2e88de6714 | |||
| 6342cbbd89 | |||
| 34b929130d | |||
| f3b2e4b787 | |||
| 54df19f71a | |||
| ebab968766 | |||
| 7e37fba048 | |||
| adcf23c73c | |||
| c686c1a915 | |||
| 72139c9e63 | |||
| 86dff989b6 | |||
| 9705f3bc7b | |||
| 9a3a4bed6f | |||
| c0ddc4cf1c | |||
| 6e907483a2 | |||
| 1f4081c6ef | |||
| 21662b97f2 | |||
| 832386ff47 | |||
| 650002bfe8 | |||
| 333bf8f3c2 | |||
| 7784ac5607 |
@@ -1,4 +1,4 @@
|
||||
# Django Setup for Ubuntu 18.04
|
||||
# Django Setup for Raspbian Jessie
|
||||
## Install
|
||||
```bash
|
||||
vim vars
|
||||
|
||||
+28
-11
@@ -1,15 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
################################################################################s
|
||||
# Dependencies
|
||||
# Installs Dependencies automatically
|
||||
################################################################################
|
||||
|
||||
# check if root
|
||||
if [ $EUID -ne 0 ] ; then
|
||||
echo -e "This script must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# source vars
|
||||
source vars
|
||||
|
||||
# check if root
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo -e "This script must be run as root"
|
||||
exit 1
|
||||
if [[ $user == "" ]] ; then
|
||||
echo -e "User missing from vars."
|
||||
exit 1
|
||||
fi
|
||||
if [[ $projectname == "" ]] ; then
|
||||
echo -e "Project Name missing from vars."
|
||||
exit 1
|
||||
fi
|
||||
if [[ $hostname == "" ]] ; then
|
||||
echo -e "Hostname missing from vars."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tput setaf 2
|
||||
@@ -17,11 +32,13 @@ echo -e "Installing dependencies"
|
||||
tput setaf 9
|
||||
# create necessary dirs
|
||||
if [ ! -d $logdir ] ; then
|
||||
mkdir $logdir
|
||||
fi
|
||||
mkdir $logdir
|
||||
fi;
|
||||
|
||||
# install dependencies
|
||||
packages=(gcc wget nginx ufw make sqlite3 bzip2 openssl libffi-dev libssl-dev libsqlite3-dev zlib1g-dev libbz2-dev)
|
||||
packages=(gcc wget nginx ufw make sqlite3 bzip2 openssl libffi-dev libssl-dev libsqlite3-dev zlib1g-dev libbz2-dev libpq-dev);
|
||||
echo -e "\tRunning apt update";
|
||||
apt update 1> $aptlogloc 2>> $aptlogloc 3>> $aptlogloc;
|
||||
for package in ${packages[@]};
|
||||
do
|
||||
echo -e "\tInstalling $package"
|
||||
@@ -36,15 +53,15 @@ done
|
||||
ports=(22 80 443)
|
||||
for port in ${ports[@]};
|
||||
do
|
||||
echo -e "ufw allow $port/tcp" > $firelogloc
|
||||
echo -e "ufw allow $port/tcp" 1>> $firelogloc 2>> $firelogloc
|
||||
ufw allow $port/tcp 1>> $firelogloc 2>> $firelogloc
|
||||
if [ $? -ne 0 ] ; then
|
||||
echo -e "\tfirewall failed to update port $port correctly. $firelogmsg"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo -e "\tenabling ufw"
|
||||
ufw --force enable
|
||||
echo -e "\tEnabling ufw"
|
||||
ufw --force enable 1>> $firelogloc 2>> $firelogloc
|
||||
|
||||
################################################################################
|
||||
# Python
|
||||
@@ -184,9 +201,9 @@ fi
|
||||
|
||||
if [ $usegit = True ] ; then
|
||||
echo -e "\tCloning django project"
|
||||
ssh-agent bash -c 'ssh-add $gitkey 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc;
|
||||
git init 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc;
|
||||
git remote add origin $giturl 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc;
|
||||
ssh-agent bash -c 'ssh-add $gitkey 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc;
|
||||
git pull origin master 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc;'
|
||||
echo -e "\tInstalling pip requirements"
|
||||
pip install -r requirements.txt 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
################################################################################
|
||||
# Performs a QUICK uninstall #
|
||||
# - Does not uninstall dependencies #
|
||||
@@ -21,10 +23,4 @@ echo "Uninstalling gunicorn"
|
||||
tput setaf 9
|
||||
systemctl disable gunicorn 1> /dev/null 2> /dev/null
|
||||
systemctl stop gunicorn 1> /dev/null 2> /dev/null
|
||||
rm -f /etc/systemd/system/gunicorn.service
|
||||
|
||||
# remove project
|
||||
tput setaf 2
|
||||
echo "Removing Django project"
|
||||
tput setaf 9
|
||||
rm -rf /home/$user/$projectname
|
||||
rm -f /etc/systemd/system/gunicorn.service
|
||||
@@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
################################################################################
|
||||
# Performs a FULL uninstall #
|
||||
################################################################################
|
||||
|
||||
Reference in New Issue
Block a user