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.
A possible use-case for GCServe is to host a private PyPI instance. All you need is:
- Download packages from pypi.org using pip download.
- Upload packages into the bucket using gsutil rsync.
- Generate static index using dumb-pypi.
- Serve the bucket with GCServe.
This pipeline is much faster, smaller, and more reliable than a more dynamic solution, like pypicloud.
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