Code Monkey home page Code Monkey logo

cloudmodular's Introduction

Backend Developer, Open Source Library Developer(Wannabe)

Solved.ac프로필 Leetcode Stats

cloudmodular's People

Contributors

recoma96 avatar

Stargazers

 avatar  avatar  avatar

Forkers

brahimmade

cloudmodular's Issues

Control System settings

관리자가 시스템 설정을 할 수 있어야 한다.

  • 데이터 공유 기한
  • 파일 업로드 크기

Storage Maximum

해당 어플리케이션의 데이터가 들어 있는 파티션 용량을 넘어서면 안된다.
따라서 모든 유저의 최대 용량의 합이 전체 파티션의 남아있는 용량 중 50%를 넘어가면 안된다.

Tag and query

지금 구현된 API는 Tag에 대한 OR 쿼리 즉 여러개의 태그 중 하나만 해당되도 검색이 되는 API
in문으로 간단히 해결했지만 And Query는 생각해 봐야 할 문제.
기존의 query단에서 여러개의 tag의 매칭을 하는 방법을 생각해 봐야 할 필요가 있음

        if tags:
            # 태그 검색 (OR query)
            tag_list = tags.split(',')
            query = query.join(DataTag, DataTag.datainfo_id == DataInfo.id)
            query = query.join(Tag, Tag.id == DataTag.tag_id)
            query = query.filter(Tag.name.in_(tag_list))

When Update, maintain user datas

해당 어플리케이션은 서버를 껏다가 켜도 데이터는 유지된다.
그러나, 업데이트를 위해, 기존 Docker Container를 삭제하고 새 버전의 Docker Container를 생성할 경우, 프로세스 특성상, 모든 유저데이터가 날아가고 초기화 된다. 그 이유는 Docker Container를 처음 생성할 시, DB, Storage를 전부 제거하고 다시 생성하는 Migrate 명령어가 작동되기 때문이다.
Migrate 명령어 또는 함수에서 DB, Storage 상태를 확인하고 데이터를 유지하는 프로세스를 추가해야, 도커를 이용한 업데이트를 진행할 때 차질이 없다.

Strategic of checking user storage size

Issue

디렉토리의 크기를 구하는 방법은 Python에서 os 모듈로 디렉토리 하위 데이터를 recursive하게 일일이 계산하거나, 리눅스에서 du 명령어를 사용해서 구한다. 이 두가지의 방법 전부 상당히 시간이 오래걸리기 때문에, 파일/디렉토리 CRUD를 할 때마다 이 작업을 수행하기에는 상당한 성능 저하가 예상됨

When call Data-Delete-API, get exception about uvicorn that said "Response content longer than Content-Length"

특정 데이터에 대한 Delete를 요청할 경우 아래와 같은 에러가 발생

INFO:     127.0.0.1:46470 - "DELETE /api/users/1/datas/1 HTTP/1.1" 204 No Content
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 372, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/fastapi/applications.py", line 269, in __call__
    await super().__call__(scope, receive, send)
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/starlette/applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/starlette/middleware/cors.py", line 92, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/starlette/middleware/cors.py", line 147, in simple_response
    await self.app(scope, receive, send)
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/starlette/exceptions.py", line 93, in __call__
    raise exc
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
    await self.app(scope, receive, sender)
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
    raise e
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/starlette/routing.py", line 670, in __call__
    await route.handle(scope, receive, send)
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/starlette/routing.py", line 266, in handle
    await self.app(scope, receive, send)
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/starlette/routing.py", line 68, in app
    await response(scope, receive, send)
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/starlette/responses.py", line 162, in __call__
    await send({"type": "http.response.body", "body": self.body})
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/starlette/exceptions.py", line 79, in sender
    await send(message)
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/starlette/middleware/cors.py", line 153, in send
    await send(message)
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/starlette/middleware/errors.py", line 159, in _send
    await send(message)
  File "/mnt/e/projects/cloudmodular/venv/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 501, in send
    raise RuntimeError("Response content longer than Content-Length")
RuntimeError: Response content longer than Content-Length

Efficient way how to manage data when they are accessed by illeagal way.

개요

DB 테이블에 들어있는 데이터와, 실제 스토리지에 들어있는 데이터는 항상 무결성을 유지해야 한다.
하지만 어떠한 오류로 인해 DB와 스토리지 간의 무결성 또는 일관성이 깨질 수 있다.
예방은 못하더라도, DB와 스토리지 상태를 검사하여 일관성을 유지하게 하는 프로세스를 구축할 필요가 있다.

무결성이 깨지는 경우

  1. DB에는 있는데 스토리지에는 없는 경우
  2. 스토리지에는 있는 데 DB에는 없는 경우
  3. DB의 정보가 스토리지와 다른 경우 (ex.파일의 크기가 DB에는 다르게 적혀 있다.)
  4. DB에 중복된 파일/디렉토리의 데이터가 들어가 있는 경우
  5. 유저가 존재하는 데, 이 유저의 스토리지 데이터가 사라진 경우

Remodeling Data RDB Entity

MySQL에서는 Text/Blob을 특정 Key로 사용할 수 없기 때문에 DataInfo에서 Unique Cluster를 해제했다.
그러나 이는 중복 데이터가 들어갈 위험이 있기 때문에 다른 방안을 생각해야 한다.

class DataInfo(Base):
    __tablename__ = 'datainfo'
    """
    TODO root key에 대한 해결 필요
    __table_args__ = (
        UniqueConstraint('root', 'name', 'is_dir'),
    )
    """

    id = Column(Integer, primary_key=True, autoincrement=True)
    root = Column(Text(65535), nullable=False)
    name = Column(String(255), nullable=False)
    is_dir = Column(Boolean, nullable=False)
    created = Column(DateTime(timezone=True), server_default=func.now())
    is_favorite = Column(Boolean, nullable=True, default=False)

    user_id = Column(Integer, ForeignKey('user.id', ondelete='CASCADE', onupdate='CASCADE'))
    user = relationship('User', backref=backref('user', cascade='delete'))

Password Security

패스워드 저장 시, 특수 알고리즘을 사용하여 암호화 필요

Multiple Select Download

파일 또는 디렉토리를 여러개 선택한 다음 다운로드 하는 기능 추가 필요

Limited upload Data Size

무분별한 서버 공격을 방지하기 위해 업로드 데이터의 크기 제한을 잡을 필요가 있음
실제로 Nextcloud에서는 데이터 크기 제한을 걸 수 있으며, ExpressJS에서도 이와 같은 기능이 존재한다.
FastAPI에서도 이러한 기능을 사용할 수 있는 지 찾아보고 기능을 추가 구현할 필요가 있다.
제한 크기는 최초 설치시 사용자가 정할 수 있다.

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.