Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jkandasa/file-store
File store server and client
https://github.com/jkandasa/file-store
Last synced: 11 days ago
JSON representation
File store server and client
- Host: GitHub
- URL: https://github.com/jkandasa/file-store
- Owner: jkandasa
- License: apache-2.0
- Created: 2022-11-21T01:20:34.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2022-11-22T10:00:09.000Z (almost 2 years ago)
- Last Synced: 2024-10-11T11:58:12.484Z (about 1 month ago)
- Language: Go
- Size: 53.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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](https://quay.io/repository/jkandasa/file-store-server)
#### To Run Container Image
```bash
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
* [Released versions](https://github.com/jkandasa/file-store/releases)
* [Pre Release](https://github.com/jkandasa/file-store/releases/tag/master) - `master` branch executables## Configuration
### Server
Server can be started with container image or with an executable binary.
* For container images refer [Container Image](#to-run-container-image)
* Binary images can be downloaded from [release page](https://github.com/jkandasa/file-store/releases)
* To execute binary download and extract `store-server-*` for your platform.```bash
# to get server version details
$ ./store-server -versionversion:master, buildDate:2022-11-21T01:54:41+00:00, gitCommit:d8bd781d2096cd8f8565de812ced6d5109df177c, goLang:go1.19, platform:linux/amd64}
# to execute
$ ./store-server -port 80802022-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````bash
# 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:
```bash
$ ./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 serverFlags:
-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 printUse "storage [command] --help" for more information about a command.
$ ./store add --help
Adds the files to remote serverUsage:
storage add [flags]Examples:
# add files
store add file1.txt file2.txtFlags:
-h, --help help for addGlobal 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
```bash
./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
```bash
$ go test -v ./pkg/... ./cmd/...
```### E2E tests
To run e2e tests
```bash
$ ./scripts/run_e2e_tests.sh
```## Deploy in Kubernetes and OpenShift
* Kubernetes
```bash
$ kubectl create -f ./kubernetes/kubernetes.yaml
```* OpenShift
```bash
$ 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
```bash
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
```