Giter Site home page Giter Site logo

fss's Introduction

File Storage Service

Requirements

  • docker >= 19
  • docker-compose >= v3
  • python >= 3.7

Run Web UI

docker-compose build
docker-compose up -d

Now you can see awesome app in localhost:8080 ๐ŸŽ‰

If UI is stopped as loading, wait a minutes and try again.
(Maybe application waiting database initialization)

Use with CLI app.

You must launch server following above instruction before use cli.

./filestorage --help

CLI details

list

Get file list that stored in the storage.
This command return max 100000 files.

./filestorage list --limit 100

will display

+------+---------------------+---------------------+
|   id | name                |          created_at |
+======+=====================+=====================+
| 1036 | /tmp/test/dummy_16  | 2020-02-16T19:14:58 |
+------+---------------------+---------------------+
| 1037 | /tmp/test/dummy_15  | 2020-02-16T19:14:58 |
+------+---------------------+---------------------+

options

  • raw
    • Display result as row format
  • limit
    • Max fetchable list size.
  • page
    • If list size reached max limit, to setting --page <next value>, cli will fetch list from next offset to limit.

get

Download file that specified by id.

./filestorage get --id <id> --outdir <Relative or absolute file path>

options

  • id required
    • Specify file id
  • outdir optional
    • Specify file output directory. This option will create directories if specified directories are not exists.

upload

Upload a spcfified file.

./filestorage upload --file <Relative or absolute file path>

will display

+------+----------------+---------------+
|   id | name           |    created_at |
+======+================+===============+
| 1002 | filestorage.sh | 1581649426000 |
+------+----------------+---------------+

options

  • file required
    • Path to a file.
  • raw
    • Display result as row format

delete

Delete a specified file.

./filestorage delete --id <id>

will display

+------+----------------+---------------+
|   id | name           |    created_at |
+======+================+===============+
| 1002 | filestorage.sh | 1581649426000 |
+------+----------------+---------------+

options

  • id required
    • File id to delete.
  • row
    • Display result as row format

Development

Additional requirements

  • Rust >= 1.41.0
  • diesel_cli >= 1.4.0
  • Node.JS >= 12.13.0
  • Yarn >= 1.19.1
  • cargo-make >= 0.27.0

Server

/api

Install Requirements

cargo install cargo-make
cargo install diesel_cli

Build

cargo build --bin file_storage_server

Create/Update model for typescript

cargo build --bin typescriptify
./target/debug/typescriptify > ../web/src/domain/entities.ts

Run by hand

docker-compose up db

mkdir /tmp/fss_debug
RUST_LOG=debug STORAGE_PATH="/tmp/fss_debug" MYSQL_URL='mysql://user:[email protected]/file_storage' ./target/debug/file_storage_server

Test

cargo make TEST

UI

/web

Prepare

yarn install

Build

yarn build

Run development server

yarn debug

Test

yarn test

Assets

/assets

Prepare

yarn install

Create icon font

  1. Open icons.ai
  2. Click Save As
  3. Check Use Artboards
  4. Select SVG format
  5. Select /assets/svg directory.
  6. Run yarn build

icons will created in /web directory.
Web UI project references thease fonts without any additional work.

CLI

/cli

All dependencies are stored in the desp directory.
So if you add new dependencies, you need to run below command.

pip3 install <package> -t cli/deps

Integration Test

Run all tests

docker-compose up -d
./integration/run_integration_test

Run CLI test

docker-compose up -d
./integration/run_cli_integration_test

Run UI test

docker-compose up -d
./integration/run_web_e2e_test

Known problems

Web UI work correctly but loading is not end.

Sometimes app container is not started after full build, so please restart all container by

docker-compose down
docker-compose up -d

docker-compose build failed

Please recreate container.
This services's container creations are relatively heavy process, so you can create each container separetely.

docker-compose build app
docker-compose build db
docker-compose build db-migration
docker-compose build web

docker-compose up -d

fss's People

Contributors

brn avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.