Skip to content

Latest commit

 

History

History
128 lines (95 loc) · 2.75 KB

README.md

File metadata and controls

128 lines (95 loc) · 2.75 KB

pritunl-slack-app

Pritunl Slack App Slash Commands

Pritunl Slack Slash Commands Screenshot

Pritunl Slack Slash Commands Screenshot

Installation

Flask (Server)

Install the Flask Extras

Using Poetry

poetry install --extras=flask

Using PIP (source install)

pip install .[flask]

Development

flask run

Production

gunicorn pritunl_slack_app.flask_handler:flask_app \
 --bind 0.0.0.0:9000

AWS Lambda (Serverless)

Using .zip file archives

Export Poetry Dependencies to base PIP requirements.txt
poetry export --without-hashes \
  --format requirements.txt \
  --output ./pritunl_slack_app/function/requirements.txt
SAM Build
sam build --use-container
SAM Deployment
sam deploy --guided

Check out the article Build a Pritunl Slack Slash Commands with a Serverless Backend for the complete Serverless Backend deployment.

Docker Image (Containers)

Using Flask and Gunicorn App Handlers

Build an Image
docker buildx build . \
  --file flask-gunicorn.Dockerfile \
  --progress plain \
  --target production \
  --tag nathanielvarona/pritunl-slack-app
Production Mode
docker run -it --rm \
  --env PRITUNL_BASE_URL=https://vpn.domain.tld/ \
  --env PRITUNL_API_SECRET="####" \
  --env PRITUNL_API_TOKEN="####" \
  --env SLACK_SIGNING_SECRET="####" \
  --env SLACK_BOT_TOKEN="####" \
  --env GUNICORN_CMD_ARGS="--timeout 0" \
  --env APP_PORT=8081 \
  --publish 8081:8081 \
  nathanielvarona/pritunl-slack-app
Other Options

Example 1: Enable AsyncIO Workers by increasing the number of Gunicorn workers and threads.

docker run -it --rm \
  --env PRITUNL_BASE_URL=https://vpn.domain.tld/ \
  --env PRITUNL_API_SECRET="####" \
  --env PRITUNL_API_TOKEN="####" \
  --env SLACK_SIGNING_SECRET="####" \
  --env SLACK_BOT_TOKEN="####" \
  --env GUNICORN_CMD_ARGS="--timeout 0 --workers 5 --threads 2" \
  --env APP_PORT=8081 \
  --publish 8081:8081 \
  nathanielvarona/pritunl-slack-app

Example 2: Enable debug mode.

docker run -it --rm \
  --env PRITUNL_BASE_URL=https://vpn.domain.tld/ \
  --env PRITUNL_API_SECRET="####" \
  --env PRITUNL_API_TOKEN="####" \
  --env SLACK_SIGNING_SECRET="####" \
  --env SLACK_BOT_TOKEN="####" \
  --env GUNICORN_CMD_ARGS="--timeout 0" \
  --env FLASK_DEBUG=True \
  --env APP_PORT=8081 \
  --publish 8081:8081 \
  nathanielvarona/pritunl-slack-app