https://github.com/pyvec/naucse-hooks
Hooks for naucse.python.cz
https://github.com/pyvec/naucse-hooks
Last synced: about 1 year ago
JSON representation
Hooks for naucse.python.cz
- Host: GitHub
- URL: https://github.com/pyvec/naucse-hooks
- Owner: pyvec
- License: mit
- Created: 2018-02-18T18:04:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-02-16T04:55:59.000Z (over 3 years ago)
- Last Synced: 2025-04-24T05:15:19.427Z (about 1 year ago)
- Language: Python
- Size: 92.8 KB
- Stars: 3
- Watchers: 3
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Deployment trigger for naucse.python.cz
You can send a POST request to ``/trigger``, which will trigger a rebuild of naucse. The request
has to contain keys `repository` and `branch`. This repository and branch has to be used somewhere
in naucse, otherwise no deployment will be triggered.
## How to install:
pip install -r requirements.txt
## How to run:
export FLASK_APP=naucse_hooks.py
flask run
## How to run in debug:
export FLASK_DEBUG=1
export FLASK_APP=naucse_hooks.py
flask run
## How to configure:
+ Create a file `local_settings.cfg`. It uses Pythonic syntax, see `settings.cfg` for reference.
+ List of available settings for hooks:
- **NAUCSE_GIT_URL** - http(s) link to base naucse git
- **NAUCSE_BRANCH** - branch used to render naucse
- **GITHUB_TOKEN** - token used to trigger CI workflows in naucse repository
- **SENTRY_DSN** - a DSN for Sentry, to use Raven to catch errors (optional)
## How to deploy using mod_wsgi:
The app has to be able to write to file ``naucse_hooks.log`` and to the folder ``.sessions``.
(<> means something you have to replace with your value)
+ Create a file called `wsgi.py` in the root folder:
import sys
sys.path.insert(0, '')
from naucse_hooks import app as application
* Add this to Apache config
ServerName
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{REQUEST_URI}
ServerName
ErrorLog /logs/error.log
CustomLog /logs/access.log combined
Options -Indexes
>
Order allow,deny
Allow from all
DocumentRoot
LoadModule wsgi_module /usr/local/lib/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so
WSGIDaemonProcess naucse_hooks processes=1 threads=2 display-name=%{GROUP} python-home= home=
WSGIProcessGroup naucse_hooks
WSGIApplicationGroup %{GROUP}
WSGIScriptAlias / /wsgi.py
WSGIScriptReloading On
SSLCertificateFile /etc/letsencrypt/live//fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live//privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf