Skip to content

Serve files from a GCP bucket

License

Notifications You must be signed in to change notification settings

orsinium-labs/gcserve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GCServe

Serve files from a Google Cloud Storage bucket.

There are already a few alternatives (namely, gcsproxy and weasel). Also, GCP allows to make all bucket files public. The main difference is that GCServe provides basic HTTP auth.

Using as PyPI server

A possible use-case for GCServe is to host a private PyPI instance. All you need is:

  1. Download packages from pypi.org using pip download.
  2. Upload packages into the bucket using gsutil rsync.
  3. Generate static index using dumb-pypi.
  4. Serve the bucket with GCServe.

This pipeline is much faster, smaller, and more reliable than a more dynamic solution, like pypicloud.

Usage

Build and run using Go compiler:

go build -o gcserve.bin .
./gcserve.bin \
    --bucket=test-bucket \
    --username=test-user \
    --password=test-pass \
    --debug

Build and run using Docker:

sudo docker build -t gcserve:latest .
sudo docker run \
    -v /path/to/google/credentials.json:/mnt/cred.json \
    -it gcserve:latest \
    --bucket=test-bucket \
    --username=test-user \
    --password=test-pass \
    --debug