Coder Social home page Coder Social logo

rslvn / fileservice Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 184 KB

Distributed and microservice architected file service

Java 99.44% Dockerfile 0.56%
spring-boot microservices spring-microservices upload-file download-file filesystem spring-cloud-netflix spring-rest circleci travisci

fileservice's Introduction

fileservice

CircleCI Build Status Coverage Status

Artifacts

  • fileservice-api: A common library that includes microservice application names, URLs and method names to make easy client-server intagration
  • fileservice-client: Microservice feign client. It also has its own REST service. The REST service behaves as proxy between feign client to fileservice-server
  • fileservice-server: The microservice that can be used as scaled. It is creates a folder uploads and all container use the same folder as file system.
  • fileservice-discovery: Eureka discovery server

microservices

File Service Overview:

FileServiceOverview

discovery server

http://localhost:8761/

docker

manage images and containers

docker-compose build
docker-compose down
docker-compose up -d

scale server container

docker-compose scale server=3

container IPs

docker network inspect fileservice_default

or

docker exec -it fileservicediscovery ifconfig

docker exec -it fileservice_server_1 ifconfig
docker exec -it fileservice_server_2 ifconfig
docker exec -it fileservice_server_3 ifconfig

docker exec -it fileservice_client_1 ifconfig

docker logs

docker-compose logs -f

or

~$ docker exec -it fileservicediscovery /bin/sh
#tail -f logs/application.log 


~$ docker exec -it fileservice_server_1 /bin/sh
#tail -f logs/application.log 

~$ docker exec -it fileservice_server_2 /bin/sh
#tail -f logs/application.log 

~$ docker exec -it fileservice_server_3 /bin/sh
#tail -f logs/application.log 


~$ docker exec -it fileservice_client_1 /bin/sh
#tail -f logs/application.log 

server

  • upload a file
curl -i -X POST -H "Content-Type: multipart/form-data" \
        -F "[email protected];filename=test.out" \
        http://172.21.0.3:8080/api/v1/files/upload
  • upload a file with folder structure
curl -i -X POST -H "Content-Type: multipart/form-data" \
        -F "file=@test/test.out;filename=test/test.out" \
        http://172.21.0.3:8080/api/v1/files/upload
  • download a file
curl -i -X GET \
        http://172.21.0.3:8080/api/v1/files/download/test.out
  • list files
# folder
curl -i -X GET -H "Content-Type: application/json" \
            "http://172.21.0.3:8080/api/v1/files/test"
# file            
curl -i -X GET -H "Content-Type: application/json" \
            "http://172.21.0.3:8080/api/v1/files/test.out"
  • delete file or folder
# file
curl -i -X DELETE \
        http://172.21.0.3:8080/api/v1/files/test.out/false

client

  • upload a file
curl -i -X POST -H "Content-Type: multipart/form-data" \
        -F "[email protected];filename=test.out" \
        http://172.21.0.4:8090/api/v1/files/client/upload
  • upload a file with folder structure
curl -i -X POST -H "Content-Type: multipart/form-data" \
        -F "file=@test/test.out;filename=test/test.out" \
        http://172.21.0.4:8090/api/v1/files/client/upload
  • download a file
curl -i -X GET \
        http://172.21.0.4:8090/api/v1/files/client/download/test.out
  • list files
# folder
curl -i -X GET -H "Content-Type: application/json" \
            "http://172.21.0.4:8090/api/v1/files/client/test"
# file            
curl -i -X GET -H "Content-Type: application/json" \
            "http://172.21.0.4:8090/api/v1/files/client/test.out"
  • delete file or folder
# file
curl -i -X DELETE \
        http://172.21.0.4:8090/api/v1/files/client/test.out/false

#folder recursive
curl -i -X DELETE \
        http://172.21.0.4:8090/api/v1/files/client/test/true
        
#folder not recursive
curl -i -X DELETE \
        http://172.21.0.3:8080/api/v1/files/files/test/false

fileservice's People

Stargazers

 avatar

Watchers

 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.