Fixes on deployment

This commit is contained in:
Marc Aymerich 2015-10-02 12:31:58 +00:00
parent 45094714a8
commit 6b1b083c2e
1 changed files with 11 additions and 14 deletions

View File

@ -10,7 +10,6 @@ function main () {
echo " ${bold}\$ ${@}${normal}"
${@}
}
surun_ () {
echo " ${bold}\$ su $user -c \"${@}\"${normal}"
su $user -c "${@}"
@ -32,7 +31,6 @@ function main () {
}
noinput='--noinput'
alias run=surun_
alias sudorun=run_
user=$2
elif [[ $# -eq 1 ]]; then
if [[ $1 != '--noinput' ]]; then
@ -47,7 +45,6 @@ function main () {
exit 1
}
alias run=run_
alias sudorun="run_ sudo"
# Test sudo privileges
sudo true
fi
@ -90,35 +87,35 @@ function main () {
done
fi
sudorun pip3 install django-orchestra==dev \
run sudo pip3 install django-orchestra==dev \
--allow-external django-orchestra \
--allow-unverified django-orchestra
sudorun orchestra-admin install_requirements
run sudo orchestra-admin install_requirements
run cd $(eval echo ~$USER)
run orchestra-admin startproject $project_name
run cd $project_name
sudorun service postgresql start
sudorun python3 -W ignore manage.py setuppostgres $noinput
run sudo service postgresql start
run sudo python3 -W ignore manage.py setuppostgres $noinput
run python3 -W ignore manage.py migrate
if [[ "$task" == "celery" ]]; then
sudorun apt-get install rabbitmq-server
sudorun python3 -W ignore manage.py setupcelery --username $USER
run sudo apt-get install rabbitmq-server
run sudo python3 -W ignore manage.py setupcelery --username $USER
else
run python3 -W ignore manage.py setupcronbeat
run python3 -W ignore manage.py syncperiodictasks
fi
sudorun python3 -W ignore manage.py setuplog --noinput
run sudo python3 -W ignore manage.py setuplog --noinput
run python3 -W ignore manage.py collectstatic --noinput
sudorun apt-get install nginx-full uwsgi uwsgi-plugin-python3
sudorun python3 -W ignore manage.py setupnginx --user $user $noinput
sudorun python3 -W ignore manage.py restartservices
sudorun python3 -W ignore manage.py startservices
run sudo apt-get install nginx-full uwsgi uwsgi-plugin-python3
run sudo python3 -W ignore manage.py setupnginx --user $user $noinput
run sudo python3 -W ignore manage.py restartservices
run sudo python3 -W ignore manage.py startservices
run python3 -W ignore manage.py check --deploy
ip_addr=$(ip addr show eth0 | grep 'inet ' | sed -r "s/.*inet ([^\s]*).*/\1/" | cut -d'/' -f1)