Skip to main content

The Serverless File Uploader

Project description

tuxput

PyPI version

The Serverless File Uploader

tuxput is a python/flask application which provides a file uploading interface to S3, and is designed to be run serverlessly with Zappa.

Configuration

Configuration is handled by a JSON file stored in S3 and some environment variables that must be set in order to access it.

Environment Variables

The following configuration variables should be set when running tuxput:

  • CONF_BUCKET
    • required: True
    • description: S3 bucket name containing the configuration. Example: testing-tuxput-auth
  • CONF_FILE
    • required: False
    • description: String that is the key (filename) of a json file containing user with access and the buckets to which they may upload. Defaults to 'tuxput.json'
  • S3_REGION
    • required: True
    • description: Region containing the S3 bucket. Example:us-east-1
  • SITE_TITLE
    • required: False
    • description: Defaults to Tuxput. Set to anything you like for a global site title.
  • ALLOW_UPLOAD_OVERWRITE
    • required: False
    • description: boolean, defaults to False. Allows uploaders to overwrite existing files.

JSON Configuration

The CONF_FILE provides configuration information for buckets that are served and the users that may access them. An example may be found in the file sample-tuxput.json. There are two top level JSON objects that are listed here: buckets and users

buckets

"buckets" is a list of dicts consisting of:

name : The name of the bucket in S3 root (optional): Specifies an offset directory from the root of the S3 share.

If not "root" setting is available for the bucket, then tuxput assumes that "/" is the root.

users

"users" is a list of dicts describing the users that are allowed to upload to the server. The only two required options are:

token : The token that is used to identify the user authorizations : a list of authorizations for the user

"authorizations" are made up of:

bucket : a pattern to match for the name of the S3 bucket for which the authorization rule applies restricted_paths: a list path patterns where the user is allowed to upload (will default to "*" and grant full access if not specified)

Any other fields in the file are ignored, but may be used to record administratively interesting information (ie, username or email assocaited with the token, when the token was created, etc).

Run Locally

To run locally, install tuxput, ensure AWS access is available environmentally, and run:

CONF_BUCKET=testing-tuxput-auth S3_REGION=us-east-1 FLASK_APP=tuxput flask run

Run with Zappa

This application is intended to be ran and deployed with Zappa and hosted by AWS API Gateway and Lambda.

To use with Zappa, create an app shim named zappa_init.py:

# When using a flask app factory, this file is required.
# See https://github.com/Miserlou/Zappa/issues/1771
# and https://github.com/Miserlou/Zappa/pull/1775
from tuxpub import create_app
app = create_app()

An example zappa_settings.yaml file may look like:

{
---
prod:
  app_function: zappa_init.app
  aws_region: us-east-1
  project_name: testing-tuxput
  runtime: python3.7
  s3_bucket: testing-tuxput
  domain: testing-tuxput.ctt.linaro.org
  certificate_arn: arn:aws:acm:us-east-1:49557002050:certificate/92772d7-0d15-48d1-a707-010ec561c10
  environment_variables:
    CONF_BUCKET: testing-tuxput-auth
    S3_REGION: us-east-1

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tuxput-0.0.7.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

tuxput-0.0.7-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file tuxput-0.0.7.tar.gz.

File metadata

  • Download URL: tuxput-0.0.7.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.12

File hashes

Hashes for tuxput-0.0.7.tar.gz
Algorithm Hash digest
SHA256 3b0b4b837469a2aef4121e2cbf1b62594ba98c5bebd00bc287ae909a7b8be428
MD5 61f1d682b15de8e30e9d93acbf7087c9
BLAKE2b-256 15790ffb09a284d7e020714875c4b6f3792896e1bc8d2f538f2205bba3183af2

See more details on using hashes here.

File details

Details for the file tuxput-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: tuxput-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.12

File hashes

Hashes for tuxput-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 bc61a442b94c7cac67d3fc95b022edc56b3391b49e21e0220c7633d4f0a764b9
MD5 6b494bdeb006964611d97eb8c05c7684
BLAKE2b-256 3b104a9297c6609e70d38a8f7662cf275982830bf5b9f6f4f2e7d93fb206e50d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page