file-store

module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2022 License: Apache-2.0

README

File Store

keep files on a remote server and operate via local client

Download

Container images (Server)

master branch images are tagged as :master
Both released and master branch container images are published in to the quay.io registry

To Run Container Image
podman run --detach --name store-server \
    --volume $PWD/_store:/app/_store \
    --publish 8080:8080 \
    --env  TZ="Asia/Kolkata" \
    --restart unless-stopped \
    quay.io/jkandasa/file-store-server:master
Download Executables

Configuration

Server

Server can be started with container image or with an executable binary.

  • For container images refer Container Image
  • Binary images can be downloaded from release page
    • To execute binary download and extract store-server-* for your platform.
# to get server version details
$ ./store-server -version

version:master, buildDate:2022-11-21T01:54:41+00:00, gitCommit:d8bd781d2096cd8f8565de812ced6d5109df177c, goLang:go1.19, platform:linux/amd64}

# to execute
$ ./store-server -port 8080

2022-11-21T08:02:32.642+0530	info	server/main.go:36	version details	{"version": "{version:master, buildDate:2022-11-21T01:54:41+00:00, gitCommit:d8bd781d2096cd8f8565de812ced6d5109df177c, goLang:go1.19, platform:linux/amd64}"}
2022-11-21T08:02:32.643+0530	info	server/main.go:46	listening HTTP service on	{"address": "0.0.0.0:8080"}

Client

Client is available only in binary executable format. To execute binary download and extract store-client-* for your platform.

  • To change server address update STORE_SERVER environment variable. default: http://127.0.0.1:8080
# update server address
export STORE_SERVER=http://127.0.0.1:8080

$ ./store version

To get command helps in the client, always use -h or --help in the end of command, example:

$ ./store --help
Storage Client
  
This client helps you to control your storage server from the command line.

Usage:
  storage [command]

Available Commands:
  add         Adds the files to remote server
  completion  Generate the autocompletion script for the specified shell
  freq-words  Prints the frequent words count from the available text files
  help        Help about any command
  ls          Prints the available file details from the server
  rm          Removes the files from the remote server
  update      Updates/sync the files on the remote server
  version     Print the client version information
  wc          Prints the word count from the available text files on the remote server

Flags:
  -h, --help            help for storage
      --hide-header     hides the header on the console output
      --insecure        connect to server in insecure mode (default true)
  -o, --output string   output format. options: yaml, json, console (default "console")
      --pretty          JSON pretty print

Use "storage [command] --help" for more information about a command.


$ ./store add --help
Adds the files to remote server

Usage:
  storage add [flags]

Examples:
  # add files
  store add file1.txt file2.txt

Flags:
  -h, --help   help for add

Global Flags:
      --hide-header     hides the header on the console output
      --insecure        connect to server in insecure mode (default true)
  -o, --output string   output format. options: yaml, json, console (default "console")
      --pretty          JSON pretty print

Build

To build executables run the following command from the root location of the repository

./scripts/generate_executables.sh
# generated executables will be available under ./builds

Tests

Unit tests

Unit tests are not fully covered. some of the tests are available.

To run unit tests

$ go test -v ./pkg/... ./cmd/...
E2E tests

To run e2e tests

$ ./scripts/run_e2e_tests.sh

Deploy in Kubernetes and OpenShift

  • Kubernetes
$ kubectl create -f ./kubernetes/kubernetes.yaml
  • OpenShift
$ oc create -f ./kubernetes/openshift.yaml

$ oc get route -n store
NAME   HOST/PORT                                            PATH   SERVICES     PORT   TERMINATION   WILDCARD
fs     fs-store.apps.private-host.com          file-store   http   edge          None
  • client
export STORE_SERVER=https://fs-store.apps.private-host.com

$ ./store add /tmp/file_hi.txt 
Files are added successfully

$ ./store ls
NAME       	SIZE	MD5 HASH                        	MODIFIED TIME                           
file_hi.txt	3   	764efa883dda1e11db47671c4a3bbd9e	2022-11-21 08:57:57.797868333 +0000 UTC	

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL