Giter VIP home page Giter VIP logo

component-filesync's Introduction

Filesync - Google Cloud Storage Syncing

Dockerhub

This service will periodically, atomically sync a Google Cloud Storage directory to this container and server the contents over http.

Requirements for use:

  • CONTROL_PORT env var - port that the control gRPC interface listens on. {DEFAULT: 9102}
  • DATA_PORT env var - port that the files are served on {DEFAULT: 9103}
  • GS_URL env var - gs:// url to the Google Cloud Storage directory where the files are downloaded from
  • SYNC_DIR env var - absolute path to the directory in the container the files should be stored it; this should be a persistent volume and will need to have at least 2x the amount of space that the GCS directory uses
  • SYNC_PERIOD env var - how often in seconds syncing should begin; if syncing is ongoing then the period just restarts
  • GCP service account credentails mounted at /gcloud-credentials.json

This service can be signaled to wait before downloading by placing an empty file called WAIT in the top of the SYNC_DIR:

# Turn waiting on
gsutil cp /dev/null gs://path/to/sync_dir/WAIT

# Turn waiting off
gsutil rm gs://path/to/sync_dir/WAIT

Dev Notes

The script tryit.py can be used to test the control interface. You can use curl to view the files. Here's a quick way to test the whole flow:

echo 'GS_URL=gs://your/gcs/directory/' > .env

pip install grpcio grpcio-tools

python -m grpc_tools.protoc -I . --python_out=. --grpc_python_out=. *.proto

docker-compose up --build -d

python tryit.py localhost:9102

curl http://localhost:9103/

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.