An open API service indexing awesome lists of open source software.

https://github.com/iamnator/imagecache

An Ephemeral server with a CLI tool for storing images (jpg, gif, png).
https://github.com/iamnator/imagecache

file-upload filesharing golang grpc

Last synced: 3 months ago
JSON representation

An Ephemeral server with a CLI tool for storing images (jpg, gif, png).

Awesome Lists containing this project

README

          

# imageCache

imageCache
CI

## REFERENCES
###### https://docs.buf.build
###### A modification of the code from https://github.com/rickslick/grpcUpload

```markdown
imageCache can be used a CLI tool and a Server.
The CLI tool uploads files concurrently using grpc to a server instance of the application.

If the server is spurned in a container
It is Ephemeral, meaning, all data is erased once the container shuts down.
To prevent this, you can make use of volumes.
```

###### by default: all uploaded images are stored in /app/data/files

---
###### Featues :
* concurrent multi file upload using grpc with concept of chunking
* supports tls (both client and sever )
* Displays progress for each file
* Exposes endpoints for file downloads
* Exposes endpoint that return list of files of uploaded
---
###### How it works

Screenshot 2022-06-19 at 13 20 11






Server Exposes GRPC and REST apis













CLI communicates with the grpc server from a terminal



---

## Quick Start

#### 1. spin off server
```shell
go run cmd/server/main.go
```
[more ...](./cmd/server/README.md)

#### 2. upload a file
```shell
go run cmd/client/main.go upload 127.0.0.1:4000 -f ./testdata/sample23.png
```
[more ...](./cmd/cli/README.md)

---
![Quick Start](https://user-images.githubusercontent.com/43158886/174492721-e00e44ca-5b85-4f1f-81da-1bccbf51b199.gif)
---

### Working with Container (e.g Docker)

#### 1. Build Docker container
```shell
docker build . -t imageCache

e.g docker build . -t imageCache
```
output:
```shell
mac@macs-MBP imageCache % docker build . -t imageCache
[+] Building 116.0s (8/11)
=> [internal] load build context 2.0s
=> => transferring context: 51.91kB 1.6s
=> [builder 1/4] FROM docker.io/library/golang:1.18-alpine@sha256
...
```


#### 2. Run Container (locally)

```shell
docker run --env-file .env -p 9900: -p 7700:

e.g docker run --env-file .env -p 9900:9900 -p 7700:7700 server
```

output:
```shell
mac@macs-MBP imageCache % docker run --env-file .env -p 9900:9900 -p 7700:7700 server
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.

[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)

[GIN-debug] GET /data/files/:fileName --> imageCache/delivery/server.DownloadFileHandler (3 handlers)
[GIN-debug] GET /list --> imageCache/delivery/server.ListFilesHandler (3 handlers)
======> we are running REST APIs @ :9900
=========> We are running GRPC APIs @ 127.0.0.1:7700

```