python package basics
This commit is contained in:
parent
ebadcb9704
commit
e904bb6c28
143
.gitignore
vendored
Normal file
143
.gitignore
vendored
Normal file
|
@ -0,0 +1,143 @@
|
|||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
_build/
|
||||
*.swp
|
||||
playground/
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
.idea/.gitignore
|
||||
.idea/inspectionProfiles/profiles_settings.xml
|
||||
.idea/mailadm.iml
|
||||
.idea/modules.xml
|
||||
.idea/vcs.xml
|
||||
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
pip-wheel-metadata/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
docker-data/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
.mailadm.lock
|
||||
mailadm.db
|
43
README.md
Normal file
43
README.md
Normal file
|
@ -0,0 +1,43 @@
|
|||
# pyinfra-nginx
|
||||
|
||||
This is a pyinfra module to manage an nginx web server.
|
||||
|
||||
## Install
|
||||
|
||||
Just install this python package with
|
||||
`pip install git+https://git.0x90.space/0x90/pyinfra-nginx/`
|
||||
(preferably to your virtual environment).
|
||||
|
||||
## Usage
|
||||
|
||||
You can use this module
|
||||
from your pyinfra deploy.py file
|
||||
like this:
|
||||
|
||||
```
|
||||
from pyinfra_nginx import deploy_nginx, nginx_deployer
|
||||
|
||||
|
||||
deploy_nginx() # install nginx via apt if it doesn't exist
|
||||
|
||||
with nginx_deployer() as n:
|
||||
n.add_nginx_domain(domain="example.org", webroot="/var/www/html/")
|
||||
```
|
||||
|
||||
This will install nginx via apt
|
||||
(only Debian-like systems are supported right now)
|
||||
and deploy an example nginx config
|
||||
which exposes static files
|
||||
under the `/var/www/html` directory.
|
||||
|
||||
### Options
|
||||
|
||||
`add_nginx_domain()` supports 3 template configs for configuring your site:
|
||||
|
||||
- `webroot` for serving a static page,
|
||||
- `proxy_port` for passing traffic to a separate application listening on some port,
|
||||
- and `redirect` for redirecting to a different website with a 301 HTTP status code.
|
||||
- You can use `config_path` if your site is so special it needs a custom config.
|
||||
|
||||
These 4 options are mutually exclusive.
|
||||
|
|
@ -3,5 +3,8 @@ requires = ["setuptools>=45"]
|
|||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "pyinfra-mailcow"
|
||||
name = "pyinfra-nginx"
|
||||
version = "0.1"
|
||||
dependencies = [
|
||||
"pyinfra-acmetool @ git+https://github.com/deltachat/pyinfra-acmetool/",
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue