Compare commits
22 Commits
ubuntu-dev
...
raspbian
| 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
|
## Install
|
||||||
```bash
|
```bash
|
||||||
vim vars
|
vim vars
|
||||||
|
|||||||
39
install.sh
39
install.sh
@@ -1,15 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
################################################################################s
|
################################################################################s
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# Installs Dependencies automatically
|
# 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
|
||||||
source vars
|
source vars
|
||||||
|
|
||||||
# check if root
|
if [[ $user == "" ]] ; then
|
||||||
if [[ $EUID -ne 0 ]]; then
|
echo -e "User missing from vars."
|
||||||
echo -e "This script must be run as root"
|
exit 1
|
||||||
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
|
fi
|
||||||
|
|
||||||
tput setaf 2
|
tput setaf 2
|
||||||
@@ -17,11 +32,13 @@ echo -e "Installing dependencies"
|
|||||||
tput setaf 9
|
tput setaf 9
|
||||||
# create necessary dirs
|
# create necessary dirs
|
||||||
if [ ! -d $logdir ] ; then
|
if [ ! -d $logdir ] ; then
|
||||||
mkdir $logdir
|
mkdir $logdir
|
||||||
fi
|
fi;
|
||||||
|
|
||||||
# install dependencies
|
# 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[@]};
|
for package in ${packages[@]};
|
||||||
do
|
do
|
||||||
echo -e "\tInstalling $package"
|
echo -e "\tInstalling $package"
|
||||||
@@ -36,15 +53,15 @@ done
|
|||||||
ports=(22 80 443)
|
ports=(22 80 443)
|
||||||
for port in ${ports[@]};
|
for port in ${ports[@]};
|
||||||
do
|
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
|
ufw allow $port/tcp 1>> $firelogloc 2>> $firelogloc
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo -e "\tfirewall failed to update port $port correctly. $firelogmsg"
|
echo -e "\tfirewall failed to update port $port correctly. $firelogmsg"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo -e "\tenabling ufw"
|
echo -e "\tEnabling ufw"
|
||||||
ufw --force enable
|
ufw --force enable 1>> $firelogloc 2>> $firelogloc
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Python
|
# Python
|
||||||
@@ -184,9 +201,9 @@ fi
|
|||||||
|
|
||||||
if [ $usegit = True ] ; then
|
if [ $usegit = True ] ; then
|
||||||
echo -e "\tCloning django project"
|
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 init 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc;
|
||||||
git remote add origin $giturl 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;'
|
git pull origin master 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc;'
|
||||||
echo -e "\tInstalling pip requirements"
|
echo -e "\tInstalling pip requirements"
|
||||||
pip install -r requirements.txt 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc
|
pip install -r requirements.txt 1>> $gitlogloc 2>> $gitlogloc 3>> $gitlogloc
|
||||||
|
|||||||
8
reset.sh
8
reset.sh
@@ -1,3 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Performs a QUICK uninstall #
|
# Performs a QUICK uninstall #
|
||||||
# - Does not uninstall dependencies #
|
# - Does not uninstall dependencies #
|
||||||
@@ -22,9 +24,3 @@ tput setaf 9
|
|||||||
systemctl disable gunicorn 1> /dev/null 2> /dev/null
|
systemctl disable gunicorn 1> /dev/null 2> /dev/null
|
||||||
systemctl stop gunicorn 1> /dev/null 2> /dev/null
|
systemctl stop gunicorn 1> /dev/null 2> /dev/null
|
||||||
rm -f /etc/systemd/system/gunicorn.service
|
rm -f /etc/systemd/system/gunicorn.service
|
||||||
|
|
||||||
# remove project
|
|
||||||
tput setaf 2
|
|
||||||
echo "Removing Django project"
|
|
||||||
tput setaf 9
|
|
||||||
rm -rf /home/$user/$projectname
|
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Performs a FULL uninstall #
|
# Performs a FULL uninstall #
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|||||||
Reference in New Issue
Block a user