ready for test #77

This commit is contained in:
Vague Rabbit 2021-02-05 18:47:14 -08:00
parent c6c2b14241
commit bcce1bfb41
5 changed files with 12 additions and 42 deletions

View file

@ -49,17 +49,17 @@ fi
sudo -u $UN git clone https://github.com/mirumee/saleor-dashboard.git
wait
# 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
if [ "$SAME_HOST" = "no" ]; then
sudo sed "s|{api_url}|$API_URL|
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
else
sudo sed "s|{api_url}|$API_URL|
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
fi
#########################################################################################
@ -94,7 +94,7 @@ if [ "$SAME_HOST" = "no" ]; then
# Make an empry variable
DASHBOARD_LOCATION=""
# 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
sudo sed "s|{hd}|$HD|g
s/{app_mount_uri}/$APP_MOUNT_URI/g
@ -109,7 +109,7 @@ else
# Populate the DASHBOARD_LOCATION variable
DASHBOARD_LOCATION=$(<$HD/Deploy_Saleor/resources/saleor-dashboard/dashboard-location)
# 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
# Modify the new server block again
sudo sed -i "s|{hd}|$HD|g

View file

@ -46,16 +46,6 @@ while [ -n "$1" ]; do # while loop starts
shift
;;
-api-host)
API_HOST="$2"
shift
;;
-api-port)
API_PORT="$2"
shift
;;
-dashboard-uri)
APP_MOUNT_URI="$2"
shift
@ -291,16 +281,6 @@ do
echo -n "Enter the API host domain:"
read HOST
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
if [ "$STATIC_URL" = "" ]; then
echo -n "Enter a custom Static Files URI (optional):"
@ -516,11 +496,9 @@ if [ "vOPT" = "true" ] || [ "$REPO" = "mirumee" ]; then
fi
# Create the saleor server block
sudo sed "s|{hd}|$HD|g
s/{api_host}/$API_HOST/
s/{host}/$HOST/g
s|{static}|$STATIC_URL|g
s|{media}|$MEDIA_URL|g
s/{api_port}/$API_PORT/" $HD/Deploy_Saleor/resources/saleor/server_block > /etc/nginx/sites-available/saleor
s|{media}|$MEDIA_URL|g" $HD/Deploy_Saleor/resources/saleor/server_block > /etc/nginx/sites-available/saleor
wait
else
# Create the new service file
@ -639,7 +617,7 @@ wait
# Establish the database
python3 manage.py migrate
wait
python3 manage.py populatedb --createsuperuser
python3 manage.py populatedb --createsuperuser --sampledata
wait
# Collect the static elemants
python3 manage.py collectstatic
@ -661,9 +639,9 @@ wait
# Stop the uwsgi processes
#uwsgi --stop $HD/saleortemp.pid
# 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 chmod -R 776 /var/www/$HOST
#sudo chmod -R 776 /var/www/$HOST
#########################################################################################

View file

@ -1,5 +1 @@
location ^~ /{app_mount_uri} {
alias /var/www/{host}/{app_mount_uri};
index index.html;
try_files $uri $uri/ /{app_mount_uri}/index.html;
}
location ^~ /{app_mount_uri} { alias /var/www/{host}/{app_mount_uri}; index index.html; try_files $uri $uri/ /{app_mount_uri}/index.html; }

View file

@ -27,10 +27,6 @@ server {
include {hd}/saleor/uwsgi_params;
}
location /graphql/ {
proxy_pass https://{api_host}:{api_port};
}
{dashboard-location}
{dl}
}

View file

@ -26,4 +26,4 @@ uid = {un}
# full path to python virtual env
home = {hd}/env/saleor
# full path to Django project's root directory
chdir = {hd}/saleor/saleor/core
chdir = {hd}/saleor/