mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Adding lxc install script and apache2 config for lxc
This commit is contained in:
parent
60e8990a7b
commit
e8c0f20e88
46
scripts/lxc/lxc-install.sh
Normal file
46
scripts/lxc/lxc-install.sh
Normal file
@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Bash script to instal paperless in lxc containter
|
||||
|
||||
# Get apt up to date
|
||||
apt-get update
|
||||
|
||||
# Needed for plain Paperless
|
||||
apt-get -y install unpaper gnupg libpoppler-cpp-dev python3-pyocr tesseract-ocr imagemagick optipng
|
||||
|
||||
# Needed for Apache
|
||||
apt-get -y install apache2 libapache2-mod-wsgi-py3
|
||||
# paperless user
|
||||
adduser --disabled-password --gecos "" paperless
|
||||
|
||||
#Get Paperless from git (NB: currently fork)
|
||||
su -c "cd /home/paperless ; git clone https://github.com/bmsleight/paperless" paperless
|
||||
|
||||
# Install Pip Requirements
|
||||
apt-get -y install python3-pip python3-venv
|
||||
cd /home/paperless/paperless
|
||||
pip3 install -r requirements.txt
|
||||
|
||||
#Set up consume directory
|
||||
su -c "mkdir /home/paperless/consume" paperless
|
||||
|
||||
# Take paperless.conf.example and set consumuption dir
|
||||
sed -e '/PAPERLESS_CONSUMPTION_DIR=/s/=.*/=\"\/home\/paperless\/consume\/\"/' \
|
||||
/home/paperless/paperless/paperless.conf.example >/etc/paperless.conf
|
||||
|
||||
# Update /etc/paperless.conf with PAPERLESS_SECRET_KEY
|
||||
SECRET=$(strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 30 | tr -d '\n'; echo)
|
||||
sed -i "s/#PAPERLESS_SECRET_KEY.*/PAPERLESS_SECRET_KEY=$SECRET/g" /etc/paperless.conf
|
||||
|
||||
#Initialise the SQLite database
|
||||
su -c "cd /home/paperless/paperless/src/ ; ./manage.py migrate" paperless
|
||||
#Create a user for your Paperless instance
|
||||
su -c "cd /home/paperless/paperless/src/ ; ./manage.py createsuperuser" paperless
|
||||
# 167 static files copied to '/home/paperless/paperless/static'.
|
||||
su -c "cd /home/paperless/paperless/src/ ; ./manage.py collectstatic" paperless
|
||||
|
||||
# Set-up apache
|
||||
cp /home/paperless/paperless/scripts/lxc/paperless.conf /etc/apache2/sites-available/
|
||||
a2dissite 000-default.conf
|
||||
a2ensite paperless.conf
|
||||
systemctl reload apache2
|
18
scripts/lxc/paperless.conf
Normal file
18
scripts/lxc/paperless.conf
Normal file
@ -0,0 +1,18 @@
|
||||
<VirtualHost *:80>
|
||||
ServerName paperless.lan
|
||||
|
||||
Alias /static/ /home/paperless/paperless/static/
|
||||
<Directory /home/paperless/paperless/static>
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
WSGIScriptAlias / /home/paperless/paperless/src/paperless/wsgi.py
|
||||
WSGIDaemonProcess example.com user=paperless group=paperless threads=5 python-path=/home/paperless/paperless/src
|
||||
WSGIProcessGroup paperless.lan
|
||||
|
||||
<Directory /home/paperless/paperless/src/paperless>
|
||||
<Files wsgi.py>
|
||||
Require all granted
|
||||
</Files>
|
||||
</Directory>
|
||||
</VirtualHost>
|
Loading…
x
Reference in New Issue
Block a user