Fixes on deployment
This commit is contained in:
parent
93974ef989
commit
bea5cb7e7e
|
@ -50,10 +50,9 @@ pip3 install -r http://git.io/orchestra-requirements.txt
|
||||||
orchestra-admin startproject panel
|
orchestra-admin startproject panel
|
||||||
python3 panel/manage.py migrate
|
python3 panel/manage.py migrate
|
||||||
python3 panel/manage.py runserver
|
python3 panel/manage.py runserver
|
||||||
# Browse to http://127.0.0.1:8000/admin/
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Now you can see the web interface on http://localhost:8000/admin
|
Now you can see the web interface on http://localhost:8000/admin/
|
||||||
|
|
||||||
|
|
||||||
Checkout the steps for other deployments: [development](INSTALLDEV.md), [production](INSTALL.md)
|
Checkout the steps for other deployments: [development](INSTALLDEV.md), [production](INSTALL.md)
|
||||||
|
|
|
@ -60,6 +60,10 @@ check_root () {
|
||||||
export -f check_root
|
export -f check_root
|
||||||
|
|
||||||
|
|
||||||
|
verlt () {
|
||||||
|
[ "$1" = "$2" ] && return 1 || verlte $1 $2
|
||||||
|
}
|
||||||
|
|
||||||
get_orchestra_dir () {
|
get_orchestra_dir () {
|
||||||
if ! $(echo "import orchestra" | $PYTHON_BIN 2> /dev/null); then
|
if ! $(echo "import orchestra" | $PYTHON_BIN 2> /dev/null); then
|
||||||
echo -e "\norchestra not installed.\n" >&2
|
echo -e "\norchestra not installed.\n" >&2
|
||||||
|
@ -109,6 +113,13 @@ function install_requirements () {
|
||||||
check_root || true
|
check_root || true
|
||||||
ORCHESTRA_PATH=$(get_orchestra_dir) || true
|
ORCHESTRA_PATH=$(get_orchestra_dir) || true
|
||||||
|
|
||||||
|
# Make sure locales are in place before installing postgres
|
||||||
|
if [[ $({ perl --help > /dev/null; } 2>&1|grep 'locale failed') ]]; then
|
||||||
|
run sed -i "s/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/" /etc/locale.gen
|
||||||
|
run locale-gen
|
||||||
|
update-locale LANG=en_US.UTF-8
|
||||||
|
fi
|
||||||
|
|
||||||
# lxml: libxml2-dev, libxslt1-dev, zlib1g-dev
|
# lxml: libxml2-dev, libxslt1-dev, zlib1g-dev
|
||||||
APT="bind9utils \
|
APT="bind9utils \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
|
@ -123,45 +134,12 @@ function install_requirements () {
|
||||||
wget \
|
wget \
|
||||||
xvfb \
|
xvfb \
|
||||||
zlib1g-dev"
|
zlib1g-dev"
|
||||||
|
|
||||||
# cracklib and lxml are excluded on the requirements.txt because they need unconvinient system dependencies
|
|
||||||
PIP="$(wget http://git.io/orchestra-requirements.txt -O - | tr '\n' ' ') \
|
|
||||||
cracklib \
|
|
||||||
lxml==3.3.5"
|
|
||||||
|
|
||||||
if $testing; then
|
if $testing; then
|
||||||
APT="${APT} \
|
APT="${APT} \
|
||||||
git \
|
git \
|
||||||
iceweasel \
|
iceweasel \
|
||||||
dnsutils"
|
dnsutils"
|
||||||
|
|
||||||
PIP="${PIP} \
|
|
||||||
selenium \
|
|
||||||
xvfbwrapper \
|
|
||||||
freezegun \
|
|
||||||
coverage \
|
|
||||||
flake8 \
|
|
||||||
django-debug-toolbar==1.3.0 \
|
|
||||||
django-nose==1.4 \
|
|
||||||
sqlparse \
|
|
||||||
pyinotify \
|
|
||||||
PyMySQL"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Install a more recent version of wkhtmltopdf (0.12.2) (PDF page number support)
|
|
||||||
if [[ $(dpkg --list | grep wkhtmltox | awk {'print $3'}) != "0.12.2.1" ]]; then
|
|
||||||
wkhtmltox=$(mktemp)
|
|
||||||
wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-jessie-amd64.deb -O ${wkhtmltox}
|
|
||||||
dpkg -i ${wkhtmltox} || { echo "Installing missing dependencies for wkhtmltox..." && apt-get -f -y install; }
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make sure locales are in place before installing postgres
|
|
||||||
if [[ $({ perl --help > /dev/null; } 2>&1|grep 'locale failed') ]]; then
|
|
||||||
run sed -i "s/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/" /etc/locale.gen
|
|
||||||
run locale-gen
|
|
||||||
update-locale LANG=en_US.UTF-8
|
|
||||||
fi
|
|
||||||
|
|
||||||
run apt-get update
|
run apt-get update
|
||||||
run apt-get install -y $APT
|
run apt-get install -y $APT
|
||||||
|
|
||||||
|
@ -174,7 +152,35 @@ function install_requirements () {
|
||||||
update-ca-certificates
|
update-ca-certificates
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# cracklib and lxml are excluded on the requirements.txt because they need unconvinient system dependencies
|
||||||
|
PIP="$(wget http://git.io/orchestra-requirements.txt -O - | tr '\n' ' ') \
|
||||||
|
cracklib \
|
||||||
|
lxml==3.3.5"
|
||||||
|
if $testing; then
|
||||||
|
PIP="${PIP} \
|
||||||
|
selenium \
|
||||||
|
xvfbwrapper \
|
||||||
|
freezegun \
|
||||||
|
coverage \
|
||||||
|
flake8 \
|
||||||
|
django-debug-toolbar==1.3.0 \
|
||||||
|
django-nose==1.4 \
|
||||||
|
sqlparse \
|
||||||
|
pyinotify \
|
||||||
|
PyMySQL"
|
||||||
|
fi
|
||||||
|
|
||||||
run pip3 install $PIP
|
run pip3 install $PIP
|
||||||
|
|
||||||
|
# Install a more recent version of wkhtmltopdf (0.12.2) (PDF page number support)
|
||||||
|
wkhtmltox_version=$(dpkg --list | grep wkhtmltox | awk {'print $3'})
|
||||||
|
if [[ ! $wkhtmltox_version || verlt $wkhtmltox_version 0.12.2.1 ]]; then
|
||||||
|
wkhtmltox=$(mktemp)
|
||||||
|
wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-jessie-amd64.deb -O ${wkhtmltox}
|
||||||
|
dpkg -i ${wkhtmltox} || { echo "Installing missing dependencies for wkhtmltox..." && apt-get -f -y install; }
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
export -f install_requirements
|
export -f install_requirements
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ function test_orchestra () {
|
||||||
echo
|
echo
|
||||||
echo ${bold}
|
echo ${bold}
|
||||||
echo "> Checking if Orchestra is serving on https://${ip_addr}/admin/ ..."
|
echo "> Checking if Orchestra is serving on https://${ip_addr}/admin/ ..."
|
||||||
if [[ $noinput == '--noinput' ]]; then
|
if [[ $noinput ]]; then
|
||||||
echo " - username: $user"
|
echo " - username: $user"
|
||||||
echo " - password: orchestra${normal}"
|
echo " - password: orchestra${normal}"
|
||||||
fi
|
fi
|
||||||
|
@ -90,7 +90,7 @@ function setup_database () {
|
||||||
/etc/postgresql/${pg_version}/main/postgresql.conf
|
/etc/postgresql/${pg_version}/main/postgresql.conf
|
||||||
fi
|
fi
|
||||||
run sudo service postgresql start
|
run sudo service postgresql start
|
||||||
if [[ $noinput == '--noinput' ]]; then
|
if [[ $noinput ]]; then
|
||||||
db_password=$(ps aux | sha256sum | base64 | head -c 10)
|
db_password=$(ps aux | sha256sum | base64 | head -c 10)
|
||||||
run sudo python3 -W ignore manage.py setuppostgres --noinput --db_password $db_password
|
run sudo python3 -W ignore manage.py setuppostgres --noinput --db_password $db_password
|
||||||
else
|
else
|
||||||
|
@ -190,7 +190,7 @@ function main () {
|
||||||
unset OPTIND
|
unset OPTIND
|
||||||
unset opt
|
unset opt
|
||||||
|
|
||||||
if [[ $noinput == '' ]]; then
|
if [[ ! $noinput ]]; then
|
||||||
if [[ $(whoami) == 'root' ]]; then
|
if [[ $(whoami) == 'root' ]]; then
|
||||||
echo -e "\nErr. Interactive script should run as a regular user\n" >&2
|
echo -e "\nErr. Interactive script should run as a regular user\n" >&2
|
||||||
exit 2
|
exit 2
|
||||||
|
@ -213,10 +213,10 @@ function main () {
|
||||||
exit 5
|
exit 5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $noinput == '' && $bproject_name == false ]]; then
|
if [[ ! $noinput && $bproject_name == false ]]; then
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Enter a project name [panel]: " project_name
|
read -p "Enter a project name [panel]: " project_name
|
||||||
if [[ "$project_name" == "" ]]; then
|
if [[ ! "$project_name" ]]; then
|
||||||
project_name="panel"
|
project_name="panel"
|
||||||
break
|
break
|
||||||
elif [[ ! $(echo "$project_name" | grep '^[_a-zA-Z]\w*$') ]]; then
|
elif [[ ! $(echo "$project_name" | grep '^[_a-zA-Z]\w*$') ]]; then
|
||||||
|
@ -233,7 +233,7 @@ function main () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
task=cronbeat
|
task=cronbeat
|
||||||
if [[ $noinput == '' ]]; then
|
if [[ ! $noinput ]]; then
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Do you want to use celery or cronbeat (orchestra.contrib.tasks) for task execution [cronbeat]? " task
|
read -p "Do you want to use celery or cronbeat (orchestra.contrib.tasks) for task execution [cronbeat]? " task
|
||||||
case $task in
|
case $task in
|
||||||
|
@ -253,7 +253,7 @@ function main () {
|
||||||
cd $project_name
|
cd $project_name
|
||||||
setup_database $dev "$noinput"
|
setup_database $dev "$noinput"
|
||||||
|
|
||||||
if [[ $noinput == '--noinput' ]]; then
|
if [[ $noinput ]]; then
|
||||||
create_orchestra_superuser $user $user@localhost orchestra
|
create_orchestra_superuser $user $user@localhost orchestra
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -276,8 +276,8 @@ function main () {
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
if [[ $ip_addr == '' ]]; then
|
if [[ ! $ip_addr ]]; then
|
||||||
ip_addr='127.0.0.1'
|
ip_addr=127.0.0.1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Configure settings file into debug mode
|
# Configure settings file into debug mode
|
||||||
|
|
Loading…
Reference in New Issue