Initial commit
This commit is contained in:
commit
eafd1d9ae6
13
.blank.service
Normal file
13
.blank.service
Normal file
@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Gunicorn instance to serve paste
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=UNAME
|
||||
Group=UGROUP
|
||||
WorkingDirectory=WORKINGDIR
|
||||
Environment="PATH=ENVIRONMENT/bin"
|
||||
ExecStart=ENVIRONMENT/bin/gunicorn --workers 3 --bind unix:paste.sock -m 007 wsgi
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
13
blank.service
Normal file
13
blank.service
Normal file
@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Gunicorn instance to serve paste
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=UNAME
|
||||
Group=UGROUP
|
||||
WorkingDirectory=WORKINGDIR
|
||||
Environment="PATH=ENVIRONMENT/bin"
|
||||
ExecStart=ENVIRONMENT/bin/gunicorn --workers 3 --bind unix:paste.sock -m 007 wsgi
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
42
intsall.sh
Normal file
42
intsall.sh
Normal file
@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
#if [[ $EUID -ne 0 ]]; then
|
||||
# echo "This script must be run as root"
|
||||
# exit 1
|
||||
#fi
|
||||
CURRENTDIR=`pwd`
|
||||
ENVDIR=$CURRENTDIR"/env"
|
||||
WORKINGDIR=$CURRENTDIR"/paste"
|
||||
USERNAME=paste
|
||||
NGINXGROUP=nginx
|
||||
REPO="https://git.vps.benjamyn-testing.com/benjamyn/paste.git"
|
||||
PROTOCOL='https://'
|
||||
URL=testing.int.local
|
||||
|
||||
echo "Getting the repo from $REPO"
|
||||
git clone $REPO
|
||||
|
||||
echo "Making changes :)"
|
||||
echo "Editing URL"
|
||||
sed -i s+PREURL+$URL+g paste/paste.py paste/templates/post.html paste.conf
|
||||
sed -i s+PREPROTO+$PROTOCOL+g paste/paste.py paste/templates/post.html
|
||||
echo "Done :)"
|
||||
|
||||
echo "Creating the service file"
|
||||
|
||||
sed -i s+UNAME+$USERNAME+g blank.service
|
||||
sed -i s+UGROUP+$NGINXGROUP+g blank.service
|
||||
sed -i s+WORKINGDIR+"$WORKINGDIR"+g blank.service paste.conf
|
||||
sed -i s+ENVIRONMENT+"$ENVDIR"+g blank.service
|
||||
|
||||
echo "Setting up the virtualenv"
|
||||
virtualenv env
|
||||
$ENVDIR/bin/pip install flask gunicorn
|
||||
|
||||
echo "Installing the service"
|
||||
cp blank.service /etc/systemd/system/paste.service
|
||||
|
||||
echo "Setting permissions on the files"
|
||||
chmod -R $USERNAME:$NGINXGROUP $CURRENTDIR
|
||||
|
||||
echo "Installing nginx config to /etc/nginx/conf.d"
|
||||
cp paste.conf /etc/nginx/conf.d/paste.conf
|
||||
11
paste.conf
Normal file
11
paste.conf
Normal file
@ -0,0 +1,11 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name PREURL;
|
||||
location / {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://unix:/home/ben/scripts/paste/paste/paste.sock;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user