ready for test #77
This commit is contained in:
parent
c6c2b14241
commit
bcce1bfb41
5 changed files with 12 additions and 42 deletions
|
@ -49,17 +49,17 @@ fi
|
||||||
sudo -u $UN git clone https://github.com/mirumee/saleor-dashboard.git
|
sudo -u $UN git clone https://github.com/mirumee/saleor-dashboard.git
|
||||||
wait
|
wait
|
||||||
# Build the API URL
|
# Build the API URL
|
||||||
API_URL="http://$API_HOST:$API_PORT/$APIURI/"
|
API_URL="http://$HOST/$APIURI/"
|
||||||
# Write the production .env file from template.env
|
# Write the production .env file from template.env
|
||||||
if [ "$SAME_HOST" = "no" ]; then
|
if [ "$SAME_HOST" = "no" ]; then
|
||||||
sudo sed "s|{api_url}|$API_URL|
|
sudo sed "s|{api_url}|$API_URL|
|
||||||
s|{app_mount_uri}|$APP_MOUNT_URI|
|
s|{app_mount_uri}|$APP_MOUNT_URI|
|
||||||
s|{app_host}|$APP_HOST|" $HD/Deploy_Saleor/resources/saleor-dashboard/template.env > $HD/saleor-dashboard/.env
|
s|{app_host}|$APP_HOST/$APP_MOUNT_URI|" $HD/Deploy_Saleor/resources/saleor-dashboard/template.env > $HD/saleor-dashboard/.env
|
||||||
wait
|
wait
|
||||||
else
|
else
|
||||||
sudo sed "s|{api_url}|$API_URL|
|
sudo sed "s|{api_url}|$API_URL|
|
||||||
s|{app_mount_uri}|$APP_MOUNT_URI|
|
s|{app_mount_uri}|$APP_MOUNT_URI|
|
||||||
s|{app_host}|$HOST|" $HD/Deploy_Saleor/resources/saleor-dashboard/template.env > $HD/saleor-dashboard/.env
|
s|{app_host}|$HOST/$APP_MOUNT_URI|" $HD/Deploy_Saleor/resources/saleor-dashboard/template.env > $HD/saleor-dashboard/.env
|
||||||
wait
|
wait
|
||||||
fi
|
fi
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
@ -94,7 +94,7 @@ if [ "$SAME_HOST" = "no" ]; then
|
||||||
# Make an empry variable
|
# Make an empry variable
|
||||||
DASHBOARD_LOCATION=""
|
DASHBOARD_LOCATION=""
|
||||||
# Clean the saleor server block
|
# Clean the saleor server block
|
||||||
sudo sed -i "s|{dashboard-location}|$DASHBOARD_LOCATION|" /etc/nginx/sites-available/saleor
|
sudo sed -i "s#{dl}#$DASHBOARD_LOCATION#" /etc/nginx/sites-available/saleor
|
||||||
# Create the saleor-dashboard server block
|
# Create the saleor-dashboard server block
|
||||||
sudo sed "s|{hd}|$HD|g
|
sudo sed "s|{hd}|$HD|g
|
||||||
s/{app_mount_uri}/$APP_MOUNT_URI/g
|
s/{app_mount_uri}/$APP_MOUNT_URI/g
|
||||||
|
@ -109,7 +109,7 @@ else
|
||||||
# Populate the DASHBOARD_LOCATION variable
|
# Populate the DASHBOARD_LOCATION variable
|
||||||
DASHBOARD_LOCATION=$(<$HD/Deploy_Saleor/resources/saleor-dashboard/dashboard-location)
|
DASHBOARD_LOCATION=$(<$HD/Deploy_Saleor/resources/saleor-dashboard/dashboard-location)
|
||||||
# Modify the new server block
|
# Modify the new server block
|
||||||
sudo sed -i "s#{dashboard-location}#$DASHBOARD_LOCATION#" /etc/nginx/sites-available/saleor
|
sudo sed -i "s#{dl}#$DASHBOARD_LOCATION#" /etc/nginx/sites-available/saleor
|
||||||
wait
|
wait
|
||||||
# Modify the new server block again
|
# Modify the new server block again
|
||||||
sudo sed -i "s|{hd}|$HD|g
|
sudo sed -i "s|{hd}|$HD|g
|
||||||
|
|
|
@ -46,16 +46,6 @@ while [ -n "$1" ]; do # while loop starts
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-api-host)
|
|
||||||
API_HOST="$2"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
|
|
||||||
-api-port)
|
|
||||||
API_PORT="$2"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
|
|
||||||
-dashboard-uri)
|
-dashboard-uri)
|
||||||
APP_MOUNT_URI="$2"
|
APP_MOUNT_URI="$2"
|
||||||
shift
|
shift
|
||||||
|
@ -291,16 +281,6 @@ do
|
||||||
echo -n "Enter the API host domain:"
|
echo -n "Enter the API host domain:"
|
||||||
read HOST
|
read HOST
|
||||||
done
|
done
|
||||||
# Get the API host IP
|
|
||||||
while [ "$API_HOST" = "" ]
|
|
||||||
do
|
|
||||||
echo ""
|
|
||||||
echo -n "Enter the API host IP:"
|
|
||||||
read API_HOST
|
|
||||||
done
|
|
||||||
# Get an optional custom API port
|
|
||||||
echo -n "Enter the API port (optional):"
|
|
||||||
read API_PORT
|
|
||||||
# Get an optional custom Static URL
|
# Get an optional custom Static URL
|
||||||
if [ "$STATIC_URL" = "" ]; then
|
if [ "$STATIC_URL" = "" ]; then
|
||||||
echo -n "Enter a custom Static Files URI (optional):"
|
echo -n "Enter a custom Static Files URI (optional):"
|
||||||
|
@ -516,11 +496,9 @@ if [ "vOPT" = "true" ] || [ "$REPO" = "mirumee" ]; then
|
||||||
fi
|
fi
|
||||||
# Create the saleor server block
|
# Create the saleor server block
|
||||||
sudo sed "s|{hd}|$HD|g
|
sudo sed "s|{hd}|$HD|g
|
||||||
s/{api_host}/$API_HOST/
|
|
||||||
s/{host}/$HOST/g
|
s/{host}/$HOST/g
|
||||||
s|{static}|$STATIC_URL|g
|
s|{static}|$STATIC_URL|g
|
||||||
s|{media}|$MEDIA_URL|g
|
s|{media}|$MEDIA_URL|g" $HD/Deploy_Saleor/resources/saleor/server_block > /etc/nginx/sites-available/saleor
|
||||||
s/{api_port}/$API_PORT/" $HD/Deploy_Saleor/resources/saleor/server_block > /etc/nginx/sites-available/saleor
|
|
||||||
wait
|
wait
|
||||||
else
|
else
|
||||||
# Create the new service file
|
# Create the new service file
|
||||||
|
@ -639,7 +617,7 @@ wait
|
||||||
# Establish the database
|
# Establish the database
|
||||||
python3 manage.py migrate
|
python3 manage.py migrate
|
||||||
wait
|
wait
|
||||||
python3 manage.py populatedb --createsuperuser
|
python3 manage.py populatedb --createsuperuser --sampledata
|
||||||
wait
|
wait
|
||||||
# Collect the static elemants
|
# Collect the static elemants
|
||||||
python3 manage.py collectstatic
|
python3 manage.py collectstatic
|
||||||
|
@ -661,9 +639,9 @@ wait
|
||||||
# Stop the uwsgi processes
|
# Stop the uwsgi processes
|
||||||
#uwsgi --stop $HD/saleortemp.pid
|
#uwsgi --stop $HD/saleortemp.pid
|
||||||
# Move static files to /var/www/$HOST
|
# Move static files to /var/www/$HOST
|
||||||
sudo mv $HD/saleor/saleor$STATIC_URL /var/www/${HOST}${STATIC_URL}
|
sudo mv $HD/saleor/static /var/www/${HOST}${STATIC_URL}
|
||||||
sudo chown -R www-data:www-data /var/www/$HOST
|
sudo chown -R www-data:www-data /var/www/$HOST
|
||||||
sudo chmod -R 776 /var/www/$HOST
|
#sudo chmod -R 776 /var/www/$HOST
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1 @@
|
||||||
location ^~ /{app_mount_uri} {
|
location ^~ /{app_mount_uri} { alias /var/www/{host}/{app_mount_uri}; index index.html; try_files $uri $uri/ /{app_mount_uri}/index.html; }
|
||||||
alias /var/www/{host}/{app_mount_uri};
|
|
||||||
index index.html;
|
|
||||||
try_files $uri $uri/ /{app_mount_uri}/index.html;
|
|
||||||
}
|
|
|
@ -27,10 +27,6 @@ server {
|
||||||
include {hd}/saleor/uwsgi_params;
|
include {hd}/saleor/uwsgi_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /graphql/ {
|
{dl}
|
||||||
proxy_pass https://{api_host}:{api_port};
|
|
||||||
}
|
|
||||||
|
|
||||||
{dashboard-location}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -26,4 +26,4 @@ uid = {un}
|
||||||
# full path to python virtual env
|
# full path to python virtual env
|
||||||
home = {hd}/env/saleor
|
home = {hd}/env/saleor
|
||||||
# full path to Django project's root directory
|
# full path to Django project's root directory
|
||||||
chdir = {hd}/saleor/saleor/core
|
chdir = {hd}/saleor/
|
Loading…
Reference in a new issue