Skip to content

versus/goUploadService

Repository files navigation

Getting Started

Requirement

  • Linux kernel (version 5.8.0-44-generic) or macOS 11.0+ or OS X 10.8+
  • docker (version 20.10.5)
  • docker-compose (version 1.25.0)
  • make (GNU Make 4.2.1)
  • golang (1.15 optional)

Quickstart

> git clone https://github.com/versus/goUploadService.git
.......
> cd  goUploadService
> make docker-run
  • waiting for start the service
> curl  http:https://localhost:8080/health
* Connect checker: OK
  • try to connect to the service
> curl  http:https://localhost:8080
Use `curl -F '[email protected]' http:https://localhost:8080/upload` and see file into /tmp
  • try to upload a file upload.jar to the service
> curl -F 'file=@steam_latest.deb' http:https://localhost:8080/upload
File steam_latest.deb has been successfully uploaded
  • check the file in /tmp directory in the service images
> docker exec gouploadservice_go-upload_1 ls /tmp/steam_latest.deb
/tmp/steam_latest.deb
  • get Bearer token to access to prometeus metrics
> curl  http:https://localhost:8080/token
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NDY1NjUwMTcsImlzcyI6IklmY29uZmlnY28iLCJuYmYiOjE2MTUwMjkwMTd9.bfCk_76yTozw4LjQ9cH4Ig1GsaRZZPZUbxScY8iFryA
  • check prometeus metrics for the service
> curl -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NDY1NjUwMTcsImlzcyI6IklmY29uZmlnY28iLCJuYmYiOjE2MTUwMjkwMTd9.bfCk_76yTozw4LjQ9cH4Ig1GsaRZZPZUbxScY8iFryA"  http:https://localhost:8080/metrics

Use make commands

Start the service in local environment

cp example.env .env
..... edit .env file.....
make run

asciicast

Build linux/darwin file of the service

make linux
make darwin
.....
ls ./dist
upload-0.0.2-darwin-amd64  upload-0.0.2-linux-amd64

asciicast

Test build and work for Dockerfile and docker-compose.yml files

make docker-test

asciicast

Build docker image versus/go-upload:latest of the service

make docker-build

asciicast

Build docker image and start project in docker environment

make docker-run

asciicast

Issues

Please open issues here: New Issue

Suggestions and improvements are welcome.

-Valentyn Nastenko(c) 2021 https://github.com/versus