-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Smoother workflow. Fix postgresql issues, include phppgadmin interface.
Still need to fix the python-dev package to auto-configure itself for psycopg2.
- Loading branch information
Showing
8 changed files
with
139 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,39 @@ | ||
#!/bin/bash | ||
# $1 = PROJECT_NAME | ||
# $1 = ENV_NAME | ||
# $2 = PYTHON_VERSION | ||
# $3 = DJANGO_VERSION | ||
# | ||
# need access to `$SYNC_FOLDER` | ||
source /etc/bash.bashrc | ||
|
||
read -p "Enter a folder/name for the new environment: " ENV_NAME | ||
read -p "Enter Python version you'd like to install: " PYTHON_VERSION | ||
read -p "Enter Django version you'd like to install(hit return to skip): " DJANGO_VERSION | ||
|
||
# Navigate to root web dir. | ||
cd /vagrant/$SYNC_FOLDER/ | ||
# Check if the Python Version is already installed. | ||
if [[ ! $(which python${2}) ]]; then | ||
sudo apt-get install -y python${2} | ||
if [[ ! $(which python$PYTHON_VERSION) ]]; then | ||
sudo apt-get install -y python$PYTHON_VERSION | ||
fi | ||
source /usr/local/bin/virtualenvwrapper.sh | ||
mkvirtualenv ${1} -p /usr/bin/python${2} --always-copy | ||
echo "if [ -f \"/vagrant/$SYNC_FOLDER/${1}/.env\" ] | ||
mkvirtualenv $ENV_NAME -p /usr/bin/python$PYTHON_VERSION --always-copy | ||
echo "if [ -f \"/vagrant/$SYNC_FOLDER/$ENV_NAME/.env\" ] | ||
then | ||
workon ${1} | ||
fi" >> /vagrant/$SYNC_FOLDER/${1}/.env | ||
# be SURE the env is active before installing Django or other packages. | ||
cd /vagrant/$SYNC_FOLDER/${1} | ||
if [[ ! -z ${3} ]]; then | ||
workon ${1} | ||
pip install django==${3} | ||
fi | ||
workon $ENV_NAME | ||
fi" >> /vagrant/$SYNC_FOLDER/$ENV_NAME/.env | ||
# activate project to update `$VIRTUAL_ENV` | ||
workon ${1} | ||
|
||
read -p 'Create a New Django Project: ' DJANGO_PROJECT_NAME | ||
django-admin startproject "$DJANGO_PROJECT_NAME" /vagrant/$SYNC_FOLDER/${1}/ | ||
workon $ENV_NAME | ||
# be SURE the env is active before installing Django or other packages. | ||
cd /vagrant/$SYNC_FOLDER/$ENV_NAME | ||
if [[ ! -z $DJANGO_VERSION ]]; then | ||
workon $ENV_NAME | ||
pip install django==$DJANGO_VERSION | ||
read -p 'Create a New Django Project: ' DJANGO_PROJECT_NAME | ||
django-admin startproject "$DJANGO_PROJECT_NAME" /vagrant/$SYNC_FOLDER/$ENV_NAME/ | ||
|
||
read -p "Setup a New Database For Your Project? [y/n] " prompt | ||
if [[ ${prompt,,} =~ ^(yes|y)$ ]]; then | ||
. manage_djagno_db | ||
fi | ||
read -p "Setup a New Database For Your Project? [y/n] " prompt | ||
if [[ ${prompt,,} =~ ^(yes|y)$ ]]; then | ||
. manage_djagno_db | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
source /bin/colors | ||
# INSTALL PHPPGADMIN | ||
sudo apt-get install phppgadmin | ||
# configure Apache server to tell it where to find phppgadmin. | ||
sudo echo 'Include /etc/apache2/conf.d/phppgadmin' >> /etc/apache2/apache2.conf | ||
# allow permission to access phppgadmin. | ||
sed -i 's/^allow from 127.0.0.0\/255.0.0.0 ::1\/128/# allow from 127.0.0.0\/255.0.0.0 ::1\/128/' /etc/apache2/conf.d/phppgadmin | ||
sed -i 's/^#allow from all/allow from all/' /etc/apache2/conf.d/phppgadmin | ||
sed -i 's/^# allow from all/allow from all/' /etc/apache2/conf.d/phppgadmin | ||
sudo service apache2 reload | ||
echo -e ${BYELLOW}Update password for user "postgres"${NIL} | ||
# Create a new password for user "postgres" | ||
sudo -u postgres psql -tAc "\password postgres" | ||
# enable user "postgres" to login | ||
sudo sed -i "s/\s*\$conf\['extra_login_security'\] = true;/ \$conf\['extra_login_security'\] = false;/" /etc/phppgadmin/config.inc.php | ||
sudo sed -i "s/\s*local\s*all\s*all\s*peer/local all all md5/" /etc/postgresql/9.3/main/pg_hba.conf | ||
sudo service postgresql restart | ||
# Update port 80 to port 8080 | ||
sudo sed -i "s/Listen 80/Listen 8080/" /etc/apache2/ports.conf | ||
sudo sed -i "s/:80>/:8080>/" /etc/apache2/sites-available/000-default.conf | ||
sudo /etc/init.d/apache2 restart | ||
|
||
echo -e ${BGREEN}"phpPgAdmin accessible at: http://localhost:8080/phppgadmin/"${NIL} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters