^
This commit is contained in:
parent
5e65c10f92
commit
9ddad3c290
9 changed files with 239 additions and 70 deletions
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
echo ""
|
echo ""
|
||||||
echo "Creating production deployment packages for Saleor Dashboard..."
|
echo "Creating production deployment packages for Saleor Dashboard..."
|
||||||
|
@ -10,21 +9,23 @@ echo ""
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
# Collect input from the user to assign required installation parameters
|
# Collect input from the user to assign required installation parameters
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
echo "Please provide details for your Saleor API instillation..."
|
echo "Please provide details for your Saleor Dashboard installation..."
|
||||||
echo ""
|
echo ""
|
||||||
# Get the Dashboard & GraphQL host domain
|
# Get the Dashboard & GraphQL host domain
|
||||||
while [ "$HOST" = "" ]
|
while [ "$SAME_HOST" = "" ]
|
||||||
do
|
do
|
||||||
echo -n "Enter the Dashboard & GraphQL host domain:"
|
echo -n "Are you hosting the Dashboard on the same host domain as the API (yes|no)?"
|
||||||
read HOST
|
read SAME_HOST
|
||||||
done
|
done
|
||||||
# Get the API host IP or domain
|
# Get the API host IP or domain
|
||||||
while [ "$API_HOST" = "" ]
|
if [ "SAME_HOST" = "no" ]; then
|
||||||
do
|
while [ "$APP_HOST" = "" ]
|
||||||
echo ""
|
do
|
||||||
echo -n "Enter the API host IP or domain:"
|
echo ""
|
||||||
read API_HOST
|
echo -n "Enter the Dashboard host domain:"
|
||||||
done
|
read APP_HOST
|
||||||
|
done
|
||||||
|
fi
|
||||||
# Get the APP Mount (Dashboard) URI
|
# Get the APP Mount (Dashboard) URI
|
||||||
while [ "$APP_MOUNT_URI" = "" ]
|
while [ "$APP_MOUNT_URI" = "" ]
|
||||||
do
|
do
|
||||||
|
@ -32,14 +33,6 @@ do
|
||||||
echo -n "Enter the APP Mount (Dashboard) URI:"
|
echo -n "Enter the APP Mount (Dashboard) URI:"
|
||||||
read APP_MOUNT_URI
|
read APP_MOUNT_URI
|
||||||
done
|
done
|
||||||
# Get an optional custom API port
|
|
||||||
echo -n "Enter the API port (optional):"
|
|
||||||
read API_PORT
|
|
||||||
#
|
|
||||||
if [[ "$API_PORT" = "" ]]; then
|
|
||||||
API_PORT="8000"
|
|
||||||
fi
|
|
||||||
#
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,12 +41,19 @@ fi
|
||||||
# Setup the environment variables for Saleor API
|
# Setup the environment variables for Saleor API
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
# Build the API URL
|
# Build the API URL
|
||||||
APIURL="http://$API_HOST:$API_PORT/$APIURI/"
|
API_URL="http://$API_HOST:$API_PORT/$APIURI/"
|
||||||
# Write the production .env file from template.env
|
# Write the production .env file from template.env
|
||||||
sudo sed "s|{apiuri}|$APIURL|
|
if [ "SAME_HOST" = "no" ]; then
|
||||||
s|{mounturi}|$APP_MOUNT_URI|
|
sudo sed "s|{api_url}|$API_URL|
|
||||||
s|{url}|$HOST|" $HD/Deploy_Saleor/resources/saleor-dashboard/template.env > $HD/saleor-dashboard/.env
|
s|{app_mount_uri}|$APP_MOUNT_URI|
|
||||||
wait
|
s|{app_host}|$APP_HOST|" $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
|
||||||
|
wait
|
||||||
|
fi
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,11 +83,41 @@ wait
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
# Tell the user what's happening
|
# Setup the nginx block and move the static build files
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
echo "I think we're done here."
|
echo "Moving static files for the Dashboard..."
|
||||||
echo "Test the installation."
|
echo ""
|
||||||
echo "Run python3 manage.py createsuperuser from $HD/saleor"
|
if [ "$SAME_HOST" = "no" ]; then
|
||||||
|
# Move static files for the Dashboard
|
||||||
|
sudo mv $HD/saleor-dashboard/build/* /var/www/$APP_HOST/
|
||||||
|
# Make an empry variable
|
||||||
|
DASHBOARD_LOCATION=""
|
||||||
|
# Clean the saleor server block
|
||||||
|
sudo sed -i "s|{dashboard-location}|$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
|
||||||
|
s/{host}/$APP_HOST/g" $HD/Deploy_Saleor/resources/saleor-dashboard/server_block > /etc/nginx/sites-available/saleor-dashboard
|
||||||
|
wait
|
||||||
|
echo "Enabling server block and Restarting nginx..."
|
||||||
|
sudo ln -s /etc/nginx/sites-available/saleor-dashboard /etc/nginx/sites-enabled/
|
||||||
|
sudo systemctl restart nginx
|
||||||
|
else
|
||||||
|
# Move static files for the Dashboard
|
||||||
|
sudo mv $HD/saleor-dashboard/build/* /var/www/$HOST/
|
||||||
|
# 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
|
||||||
|
wait
|
||||||
|
# Modify the new server block again
|
||||||
|
sudo sed -i "s|{hd}|$HD|g
|
||||||
|
s/{app_mount_uri}/$APP_MOUNT_URI/g
|
||||||
|
s/{host}/$HOST/g" $HD/Deploy_Saleor/resources/saleor-dashboard/server
|
||||||
|
wait
|
||||||
|
echo "Enabling server block and Restarting nginx..."
|
||||||
|
sudo ln -s /etc/nginx/sites-available/saleor /etc/nginx/sites-enabled/
|
||||||
|
sudo systemctl restart nginx
|
||||||
|
fi
|
||||||
#########################################################################################
|
#########################################################################################
|
136
deploy-saleor.sh
136
deploy-saleor.sh
|
@ -41,20 +41,45 @@ while [ -n "$1" ]; do # while loop starts
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-host)
|
-host)
|
||||||
|
HOST="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
-api-host)
|
||||||
API_HOST="$2"
|
API_HOST="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-uri)
|
-api-port)
|
||||||
|
API_PORT="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
-dashboard-uri)
|
||||||
APP_MOUNT_URI="$2"
|
APP_MOUNT_URI="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
-url)
|
-static-url)
|
||||||
STATIC_URL="$2"
|
STATIC_URL="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
-media-url)
|
||||||
|
MEDIA_URL="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
-admin-email)
|
||||||
|
ADMIN_EMAIL="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
-admin-pw)
|
||||||
|
ADMIN_PASS="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
-dbhost)
|
-dbhost)
|
||||||
PGDBHOST="$2"
|
PGDBHOST="$2"
|
||||||
shift
|
shift
|
||||||
|
@ -65,6 +90,31 @@ while [ -n "$1" ]; do # while loop starts
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
-graphql-port)
|
||||||
|
GQL_PORT="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
-graphql-uri)
|
||||||
|
APIURI="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
-email)
|
||||||
|
EMAIL="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
-email-pw)
|
||||||
|
EMAIL_PW="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
-email-host)
|
||||||
|
EMAIL_HOST="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
-repo)
|
-repo)
|
||||||
REPO="$2"
|
REPO="$2"
|
||||||
shift
|
shift
|
||||||
|
@ -247,16 +297,22 @@ done
|
||||||
# Get an optional custom API port
|
# Get an optional custom API port
|
||||||
echo -n "Enter the API port (optional):"
|
echo -n "Enter the API port (optional):"
|
||||||
read API_PORT
|
read API_PORT
|
||||||
# Get the APP Mount (Dashboard) URI
|
|
||||||
while [ "$APP_MOUNT_URI" = "" ]
|
|
||||||
do
|
|
||||||
echo ""
|
|
||||||
echo -n "Enter the Dashboard URI:"
|
|
||||||
read APP_MOUNT_URI
|
|
||||||
done
|
|
||||||
# Get an optional custom Static URL
|
# Get an optional custom Static URL
|
||||||
echo -n "Enter a custom Static Files URI (optional):"
|
if [ $STATIC_URL = "" ]; then
|
||||||
read STATIC_URL
|
echo -n "Enter a custom Static Files URI (optional):"
|
||||||
|
read STATIC_URL
|
||||||
|
STATIC_URL="/$STATIC_URL/"
|
||||||
|
else
|
||||||
|
STATIC_URL="/$STATIC_URL/"
|
||||||
|
fi
|
||||||
|
# Get an optional custom media URL
|
||||||
|
if [ $MEDIA_URL = "" ]; then
|
||||||
|
echo -n "Enter a custom Media Files URI (optional):"
|
||||||
|
read MEDIA_URL
|
||||||
|
MEDIA_URL="/$MEDIA_URL/"
|
||||||
|
else
|
||||||
|
MEDIA_URL="/$MEDIA_URL/"
|
||||||
|
fi
|
||||||
# Get the Admin's email address
|
# Get the Admin's email address
|
||||||
while [ "$ADMIN_EMAIL" = "" ]
|
while [ "$ADMIN_EMAIL" = "" ]
|
||||||
do
|
do
|
||||||
|
@ -400,7 +456,7 @@ fi
|
||||||
###### This following section is for future use and will be modified to allow an alternative repo clone ######
|
###### This following section is for future use and will be modified to allow an alternative repo clone ######
|
||||||
# Was the -v (version) option used or Mirumee repo specified?
|
# Was the -v (version) option used or Mirumee repo specified?
|
||||||
if [ "vOPT" = "true" ] || [ "$REPO" = "mirumee" ]; then
|
if [ "vOPT" = "true" ] || [ "$REPO" = "mirumee" ]; then
|
||||||
# Create the new service file
|
# Create the saleor service file
|
||||||
sudo sed "s/{un}/$UN/
|
sudo sed "s/{un}/$UN/
|
||||||
s|{hd}|$HD|" $HD/Deploy_Saleor/resources/saleor/template.service > /etc/systemd/system/saleor.service
|
s|{hd}|$HD|" $HD/Deploy_Saleor/resources/saleor/template.service > /etc/systemd/system/saleor.service
|
||||||
wait
|
wait
|
||||||
|
@ -409,11 +465,13 @@ if [ "vOPT" = "true" ] || [ "$REPO" = "mirumee" ]; then
|
||||||
# Remove the old service file
|
# Remove the old service file
|
||||||
sudo rm /etc/nginx/sites-available/saleor
|
sudo rm /etc/nginx/sites-available/saleor
|
||||||
fi
|
fi
|
||||||
# Create the new 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/{api_host}/$API_HOST/
|
||||||
s/{host}/$HOST/g
|
s/{host}/$HOST/g
|
||||||
s/{apiport}/$API_PORT/" $HD/Deploy_Saleor/resources/saleor/server_block > /etc/nginx/sites-available/saleor
|
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
|
||||||
wait
|
wait
|
||||||
else
|
else
|
||||||
# Create the new service file
|
# Create the new service file
|
||||||
|
@ -429,9 +487,17 @@ else
|
||||||
sudo sed "s|{hd}|$HD|g
|
sudo sed "s|{hd}|$HD|g
|
||||||
s/{api_host}/$API_HOST/
|
s/{api_host}/$API_HOST/
|
||||||
s/{host}/$HOST/g
|
s/{host}/$HOST/g
|
||||||
s/{apiport}/$API_PORT/" $HD/Deploy_Saleor/resources/saleor/server_block > /etc/nginx/sites-available/saleor
|
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
|
||||||
wait
|
wait
|
||||||
fi
|
fi
|
||||||
|
# Create the host directory in /var/www/
|
||||||
|
sudo mkdir /var/www/$HOST
|
||||||
|
wait
|
||||||
|
# Create the media directory
|
||||||
|
sudo mkdir /var/www/${HOST}${MEDIA_URL}
|
||||||
|
# Static directory will be moved into /var/www/$HOST/ after collectstatic is performed
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
@ -459,8 +525,9 @@ sudo sed "s|{dburl}|$DB_URL|
|
||||||
s|{emailurl}|$EMAIL_URL|
|
s|{emailurl}|$EMAIL_URL|
|
||||||
s/{chosts}/$C_HOSTS/
|
s/{chosts}/$C_HOSTS/
|
||||||
s/{ahosts}/$A_HOSTS/
|
s/{ahosts}/$A_HOSTS/
|
||||||
s|{static}|$STATIC_URL|
|
s/{host}/$HOST/g
|
||||||
s|{media}|$MEDIA_URL|
|
s|{static}|$STATIC_URL|g
|
||||||
|
s|{media}|$MEDIA_URL|g
|
||||||
s/{adminemail}/$ADMIN_EMAIL/
|
s/{adminemail}/$ADMIN_EMAIL/
|
||||||
s/{gqlorigins}/$QL_ORIGINS/" $HD/Deploy_Saleor/resources/saleor/template.env > $HD/saleor/.env
|
s/{gqlorigins}/$QL_ORIGINS/" $HD/Deploy_Saleor/resources/saleor/template.env > $HD/saleor/.env
|
||||||
wait
|
wait
|
||||||
|
@ -545,8 +612,19 @@ wait
|
||||||
# Build the emails
|
# Build the emails
|
||||||
npm run build-emails
|
npm run build-emails
|
||||||
wait
|
wait
|
||||||
|
# Run the uwsgi socket and create it for the first time
|
||||||
|
uwsgi --ini $HD/saleor/saleor/wsgi/uwsgi.ini --pidfile $HD/saleortemp.pid
|
||||||
|
wait
|
||||||
|
sleep 5
|
||||||
|
# Stop the uwsgi processes
|
||||||
|
uwsgi --stop $HD/saleortemp.pid
|
||||||
# Exit the virtual environment here? _#_
|
# Exit the virtual environment here? _#_
|
||||||
deactivate
|
deactivate
|
||||||
|
# Move static files to /var/www/$HOST
|
||||||
|
sudo mv $HD/saleor/saleor$STATIC_URL /var/www/${HOST}${STATIC_URL}
|
||||||
|
sudo chown -R www-data:www-data /var/www/$HOST
|
||||||
|
sudo chmod -R 776 /var/www/$HOST
|
||||||
|
sudo chown -R $UN:www-data $HD/saleor
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
@ -554,16 +632,12 @@ deactivate
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
# Enable the Saleor service
|
# Enable the Saleor service
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
# Update with defaults
|
# Enable
|
||||||
sudo systemctl enable saleor.service
|
sudo systemctl enable saleor.service
|
||||||
#########################################################################################
|
# Reload the daemon
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
systemctl start emperor.uwsgi.service
|
# Start the service
|
||||||
|
sudo systemctl start saleor.service
|
||||||
#########################################################################################
|
|
||||||
echo "Enabling server block and Restarting nginx..."
|
|
||||||
sudo ln -s /etc/nginx/sites-available/saleor /etc/nginx/sites-enabled/
|
|
||||||
sudo systemctl restart nginx
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
@ -577,8 +651,18 @@ echo ""
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
# Call the dashboard deployment script
|
# Call the dashboard deployment script
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
source ./deploy-dashboard.sh
|
source $HD/Deploy_Saleor/deploy-dashboard.sh
|
||||||
|
#########################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#########################################################################################
|
||||||
|
# Tell the user what's happening
|
||||||
|
#########################################################################################
|
||||||
|
echo "I think we're done here."
|
||||||
|
echo "Test the installation."
|
||||||
#########################################################################################
|
#########################################################################################
|
5
resources/saleor-dashboard/dashboard-location
Normal file
5
resources/saleor-dashboard/dashboard-location
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
location ^~ /{app_mount_uri} {
|
||||||
|
alias /var/www/{host}/{app_mount_uri};
|
||||||
|
index index.html;
|
||||||
|
try_files $uri $uri/ /{app_mount_uri}/index.html;
|
||||||
|
}
|
15
resources/saleor-dashboard/server_block
Normal file
15
resources/saleor-dashboard/server_block
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# configuration of the server
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name {host} www.{host};
|
||||||
|
charset utf-8;
|
||||||
|
root /var/www/{host}
|
||||||
|
# max upload size
|
||||||
|
client_max_body_size 75M;
|
||||||
|
|
||||||
|
location ^~ /{app_mount_uri} {
|
||||||
|
alias /var/www/{host}/{app_mount_uri};
|
||||||
|
index index.html;
|
||||||
|
try_files $uri $uri/ /{app_mount_uri}/index.html;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,3 @@
|
||||||
API_URI="{apiuri}"
|
API_URI="{api_url}"
|
||||||
APP_MOUNT_URI="/{dashuri}/"
|
APP_MOUNT_URI="/{app_mount_uri}/"
|
||||||
STATIC_URL="{url}"
|
STATIC_URL="http://{app_host}/"
|
|
@ -2,20 +2,25 @@
|
||||||
upstream django {
|
upstream django {
|
||||||
server unix://{hd}/saleor/saleor.sock;
|
server unix://{hd}/saleor/saleor.sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
# configuration of the server
|
# configuration of the server
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name {host} www.{host};
|
server_name {host} www.{host};
|
||||||
charset utf-8;
|
charset utf-8;
|
||||||
|
|
||||||
# max upload size
|
# max upload size
|
||||||
client_max_body_size 75M;
|
client_max_body_size 75M;
|
||||||
|
|
||||||
# Django media and static files
|
# Django media and static files
|
||||||
location /media {
|
location {media} {
|
||||||
alias {hd}}/saleor/media;
|
alias /var/www/{host}{media};
|
||||||
}
|
}
|
||||||
location /static {
|
|
||||||
alias {hd}/saleor/static;
|
location {static} {
|
||||||
|
alias /var/www/{host}{static};
|
||||||
}
|
}
|
||||||
|
|
||||||
# Send all non-media requests to the Django server.
|
# Send all non-media requests to the Django server.
|
||||||
location / {
|
location / {
|
||||||
uwsgi_pass django;
|
uwsgi_pass django;
|
||||||
|
@ -23,12 +28,9 @@ server {
|
||||||
}
|
}
|
||||||
|
|
||||||
location /graphql/ {
|
location /graphql/ {
|
||||||
proxy_pass https://{apihost}:{apiport};
|
proxy_pass https://{api_host}:{api_port};
|
||||||
}
|
}
|
||||||
|
|
||||||
location /dashboard/ {
|
{dashboard-location}
|
||||||
path {hd}/saleor-dashboard/build/;
|
|
||||||
index index.html;
|
|
||||||
try_files $uri $uri/ /dashboard/index.html;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -14,8 +14,9 @@ EMAIL_URL="{emailurl}"
|
||||||
#SENDGRID_USERNAME="{sguser}"
|
#SENDGRID_USERNAME="{sguser}"
|
||||||
#SENDGRID_PASSWORD="{sgpass}"
|
#SENDGRID_PASSWORD="{sgpass}"
|
||||||
#DEFAULT_FROM_EMAIL="{dfemail}"
|
#DEFAULT_FROM_EMAIL="{dfemail}"
|
||||||
|
STATIC_ROOT="/var/www/{host}{static}"
|
||||||
STATIC_URL="{static}"
|
STATIC_URL="{static}"
|
||||||
|
MEDIA_ROOT="/var/www/{host}{media}"
|
||||||
MEDIA_URL="{media}"
|
MEDIA_URL="{media}"
|
||||||
|
|
||||||
#MAX_CHECKOUT_LINE_QUANTITY="{mclq}"
|
#MAX_CHECKOUT_LINE_QUANTITY="{mclq}"
|
||||||
|
|
|
@ -4,6 +4,6 @@ After=network.target
|
||||||
[Service]
|
[Service]
|
||||||
User={un}
|
User={un}
|
||||||
Restart=always
|
Restart=always
|
||||||
ExecStart={hd}/env/saleor/bin/uwsgi --emperor {hd}/env/saleor/vassals --uid www-data --gid www-data
|
ExecStart={hd}/env/saleor/bin/uwsgi --master --emperor {hd}/env/saleor/vassals --uid www-data --gid www-data
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
32
resources/saleor/template.uwsgi
Normal file
32
resources/saleor/template.uwsgi
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
[uwsgi]
|
||||||
|
die-on-term = true
|
||||||
|
enable-threads = true
|
||||||
|
http = :$(PORT)
|
||||||
|
|
||||||
|
# full path to Django project's root directory
|
||||||
|
chdir = {hd}/saleor/
|
||||||
|
# Django's wsgi file
|
||||||
|
module = saleor.wsgi:application
|
||||||
|
# full path to python virtual env
|
||||||
|
home = {hd}/env/saleor
|
||||||
|
# enable uwsgi master process
|
||||||
|
master = true
|
||||||
|
# maximum number of worker processes
|
||||||
|
processes = 4
|
||||||
|
# the socket (use the full path to be safe
|
||||||
|
socket = {hd}/saleor/saleor.sock
|
||||||
|
# socket permissions
|
||||||
|
chmod-socket = 666
|
||||||
|
# clear environment on exit
|
||||||
|
vacuum = true
|
||||||
|
# daemonize uwsgi and write messages into given log
|
||||||
|
daemonize = {hd}/uwsgi-emperor.log
|
||||||
|
|
||||||
|
log-format = UWSGI uwsgi "%(method) %(uri) %(proto)" %(status) %(size) %(msecs)ms [PID:%(pid):Worker-%(wid)] [RSS:%(rssM)MB]
|
||||||
|
max-requests = 100
|
||||||
|
memory-report = true
|
||||||
|
static-map = /static=/app/static
|
||||||
|
mimefile = /etc/mime.types
|
||||||
|
ignore-sigpipe = true
|
||||||
|
ignore-write-errors = true
|
||||||
|
disable-write-exception = true
|
Loading…
Reference in a new issue