Skip to content

Commit

Permalink
chore: set up FOCA (#13)
Browse files Browse the repository at this point in the history
Signed-off-by: Prati28 <[email protected]>
Signed-off-by: Pratiksha Sankhe <[email protected]>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: Alex Kanitz <[email protected]>
  • Loading branch information
3 people authored Aug 19, 2024
1 parent 0516517 commit cb97130
Show file tree
Hide file tree
Showing 22 changed files with 1,519 additions and 396 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"author_email": "[email protected]",
"development_status": "1 - Planning",
"short_description": "File handler utilizing TUS and MinIO with DRS-Filer integration.",
"project_name": "tus-storagehandler",
"project_name": "tus_storagehandler",
"project_slug": "tus_storagehandler",
"github_username": "elixir-cloud-aai",
"python_version": "3.11",
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/general-purpose.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ bug in -->
- Operating System and version (desktop or mobile):
- Link to your project:

[issue-tracker]: https://github.com/elixir-cloud-aai/tus-storagehandler/issues
[issue-tracker]: https://github.com/elixir-cloud-aai/tus_storagehandler/issues
48 changes: 48 additions & 0 deletions .github/workflows/run-application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Run Application

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Activate environment and install dependencies
run: |
make v
source .venv/bin/activate
make i
- name: Start server in the background
run: |
tus_storagehandler &
echo $! > server.pid
- name: Run tests
run: |
poetry run pytest tests/test_integration
- name: Stop server
run: |
kill $(cat server.pid) || true
...
2 changes: 1 addition & 1 deletion .markdownlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ MD037: true # Spaces inside emphasis markers
MD038: true # Spaces inside code span elements
MD039: true # Spaces inside link elements
MD040: true # Fenced code blocks should have a language specified
MD041: false # First line need not be h1
MD041: false # First line need not be h1
MD046: true # Code block style
MD047: true # Files should end with a single newline character
MD048: true # Code fence style
Expand Down
57 changes: 45 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,53 +18,76 @@ File handler utilizing TUS and MinIO with DRS-Filer integration.
- [Basic Usage](#basic-usage)
- [Installation](#installation)
- [Development](#development)
- [Environment Variables](#environment-variables)
- [Contributing](#contributing)
- [Code of Conduct](#code-of-conduct)
- [Versioning](#versioning)
- [License](#license)
- [Contact](#contact)

## Synopsis
This application provides endpoints for uploading, downloading, and listing files in a MinIO bucket, with TUS protocol support for uploads, and CORS enabled for cross-origin requests.

This application provides endpoints for uploading, downloading, and listing
files in a MinIO bucket, with TUS protocol support for uploads, and CORS enabled
for cross-origin requests.

## Basic Usage

## Installation

### Prerequisites

This flask application requires a running instance of [minio](https://min.io/download)
This Flask application requires a running instance of
[MinIO](https://min.io/download).

Run the minio instance by executing the following command in the location where minio is installed
Run the MinIO instance by executing the following command in the location where
MinIO is installed:

```sh
minio server /data --console-address ":9001"
```

### Install Dependencies using Poetry

1. **Download the required dependencies**
1. **Clone the Repository**

To get started, first, clone the repository using the following command:

```sh
git clone https://github.com/elixir-cloud-aai/tus-storagehandler.git
```

1. **Navigate to the package folder**

Navigate to the folder `tus_storagehandler`:

```sh
cd tus_storagehandler
```

Navigate to the folder `tus_storagehandler`.
1. **Install Poetry**

2. **Install Poetry**
If you haven't already, install Poetry by following the instructions on the
[Poetry website](https://python-poetry.org/docs/#installation).

If you haven't already, install Poetry by following the instructions on the [Poetry website](https://python-poetry.org/docs/#installation).
1. **Create and Activate a Virtual Environment (optional)**

3. **Create and Activate a Virtual Environment (optional)**
Poetry automatically creates and manages a virtual environment for your
project. You can activate it using:

Poetry automatically creates and manages a virtual environment for your project. You can activate it using:
```sh
poetry shell
```

4. **Install Dependencies**
1. **Install Dependencies**

Run the following command to install the dependencies defined in the
`pyproject.toml` file:

Run the following command to install the dependencies defined in the `pyproject.toml` file:
```sh
poetry install
```

## Development

For ease of use, certain scripts have been abbreviated in `Makefile`, make sure
Expand Down Expand Up @@ -157,6 +180,16 @@ make u
> **Note**: This is not the complete list of commands, run `make` to find out if
> more have been added.
## Environment Variables
<!-- markdownlint-disable line-length -->
| **Environment Variable** | **Description** | **Usage** | **Error Handling** |
|--|--|--|--|
| `CSH_FOCA_CONFIG_PATH` | Specifies the path to the configuration file for the FOCA app. | The FOCA app uses this environment variable to locate the configuration file. If not set, it defaults to `dev`. | If the configuration file is not found at the specified or default path, a `FileNotFoundError` will be raised. |
<!-- markdownlint-enable line-length -->
## Contributing
This project is a community effort and lives off _your_ contributions, be it in
Expand Down
42 changes: 42 additions & 0 deletions deployment/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
server:
host: '0.0.0.0'
port: 8080
debug: false
environment: development
testing: false
use_reloader: true

security:
auth:
required: true
add_key_to_claims: true
allow_expired: false
audience: null
claim_identity: sub
claim_issuer: iss
algorithms:
- RS256
validation_methods:
- userinfo
- public_key
validation_checks: all

api:
specs:
- path: tus_storagehandler/api/specs/specs.yaml
append: null
add_operation_fields:
x-openapi-router-controller: tus_storagehandler.api.elixircloud.csh.controllers
connexion:
strict_validation: true
validate_responses: false
options:
swagger_ui: true
serve_spec: true

exceptions:
required_members: [['message'], ['code']]
status_member: ['code']
exceptions: tus_storagehandler.exceptions.exceptions
...
21 changes: 21 additions & 0 deletions docs/source/pages/tus_storagehandler.api.elixircloud.csh.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
tus\_storagehandler.api.elixircloud.csh package
===============================================

Submodules
----------

tus\_storagehandler.api.elixircloud.csh.controllers module
----------------------------------------------------------

.. automodule:: tus_storagehandler.api.elixircloud.csh.controllers
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: tus_storagehandler.api.elixircloud.csh
:members:
:undoc-members:
:show-inheritance:
18 changes: 18 additions & 0 deletions docs/source/pages/tus_storagehandler.api.elixircloud.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
tus\_storagehandler.api.elixircloud package
===========================================

Subpackages
-----------

.. toctree::
:maxdepth: 4

tus_storagehandler.api.elixircloud.csh

Module contents
---------------

.. automodule:: tus_storagehandler.api.elixircloud
:members:
:undoc-members:
:show-inheritance:
18 changes: 18 additions & 0 deletions docs/source/pages/tus_storagehandler.api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
tus\_storagehandler.api package
===============================

Subpackages
-----------

.. toctree::
:maxdepth: 4

tus_storagehandler.api.elixircloud

Module contents
---------------

.. automodule:: tus_storagehandler.api
:members:
:undoc-members:
:show-inheritance:
22 changes: 19 additions & 3 deletions docs/source/pages/tus_storagehandler.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
tus\_storagehandler package
===========================

Subpackages
-----------

.. toctree::
:maxdepth: 4

tus_storagehandler.api

Submodules
----------

tus\_storagehandler.main module
-------------------------------
tus\_storagehandler.app module
------------------------------

.. automodule:: tus_storagehandler.app
:members:
:undoc-members:
:show-inheritance:

tus\_storagehandler.exceptions module
-------------------------------------

.. automodule:: tus_storagehandler.main
.. automodule:: tus_storagehandler.exceptions
:members:
:undoc-members:
:show-inheritance:
Expand Down
Loading

0 comments on commit cb97130

Please sign in to comment.