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