Web Application Setup - Application Prerequisits
• webapp
Create Application User & Directory Structure
-
Create application user:
www-appname... sudo adduser www-appname --disabled-login \ --disabled-password \ --ingroup www-data \ --home /var/lib/www/appname \ --shell /bin/false -
Create application directory:
... sudo mkdir -p /var/www/appname -
Set ownership of this directory:
... sudo chown appname:www-data /var/www/appnameAlso add admin user access:
# not sure what the [d:efalut] option does, but alone, that doesn't grant access ... sudo setfacl -R -m d:u:adminuser:rwx /var/www/appname # this grants access ... sudo setfacl -R -m u:adminuser:rwx /var/www/appname -
Create the rest of the basic directory structure:
appname ├── config ├── data ├── logs ├── packages ├── static -
Install poetry
We are going to be using poetry to manage our python app dependencies, so we need to install it. The key here is that we installed the python3.7 package - so we want to install it there:
... curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python3.7Once installed we need to tweek the poetry environment by adding
$HOME/.poetry/binto your path.Open
~/.poetry/bin/poetryin an editor, and change the execution line at the top of the file from this:#!/usr/bin/env pythonto this:
#!/usr/bin/env python3.7Lastly, we want to set up poetry to not automaticall create virtual environments:
... poetry config settings.virtualenvs.create false