Categorygithub.com/patrikcze/go-blob
modulepackage
0.1.3
Repository: https://github.com/patrikcze/go-blob.git
Documentation: pkg.go.dev

# README

Go Blob File Uploader

This is just small project to write simple API to upload files to specific Azure Storage account and Container. For this purpose simple Web Form will be used. This WebForm consist of Browse and Upload botton. You just need to pick up file from your drive and it will simply upload it to predefined Storage in Azure.

At the end it will provide you new SAS URI which can be shared. URI has limited validity (1 Day).

Possible usecase You could run this GO binary in container. It can be used temporarily with random storage account. Quickly upload large files (Max size: 512MB) and share these generated links with vendor, customer or internally. Also customers, vendors or someone can use this way to easily and securely upload some data, which will be then available for you.

upload_page.html is a template page which is used in Go code to render HTML with CSS styles.

main.go is main function of whole project.

Webpage should be located to : http://localhost:9000/

Screenshot

How to Use

  1. Setup environment variables. (Could be on your computer or you can get them from KeyVault on K8S)
  2. To run app locally execute :
make build-app
./release/go-blob 

  1. To build container image execute :
make docker-build
  1. To run app in docker container run (It is not a Deamon to stop run CTRL+C):
make start

  1. To clean build run.
make cleanup #Will delete release/ folder
make delete #Will remove docker image

Docker Registry

To pull built image from docker registry you can try

docker pull patrikcze/go-blob:0.1.3
docker run --rm --name $(APP) -p 9000:9000 \
	-e AZURE_STORAGE_ACCOUNT_NAME=<storage account name> \
	-e AZURE_STORAGE_ACCOUNT_KEY=<shared key> \
	-e AZURE_STORAGE_ACCOUNT_CONTAINER=<containername> \
	$(REGISTRY)/$(IMAGE):$(TAG)

Following architectures have been published.

  • linux/amd64
  • linux/arm/v7
  • linux/arm64

Compressed size approx : 351 MB

Requirements

Environmnet variables

You need to define following Env vars:

export AZURE_STORAGE_ACCOUNT_NAME=<TargetStorageAccountName>
export AZURE_STORAGE_ACCOUNT_KEY=<XXXXXXXXXXXXXXXXXXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXX==>
export AZURE_STORAGE_ACCOUNT_CONTAINER=<TargetContainerName>

Current issues

  • 20.4.2023 - Docker Image Update to version 0.1.3 has been done.
  • 20.4.2023 - Fixed / Progress bar fixed, style can be improved little bit.
  • 19.4.2023 - Microsoft GO SDK implemented in Dev branch
  • 12.4.2023 - Still persist / Progress and Counter CSS via Javascript does not work properly.
  • 10.4.2023 - Fixed / SAS URI links are fully functional and properly formatted.

# Constants

BlockBlobMaxBlocks indicates the maximum number of blocks allowed in a block blob.
4000MiB.
256MB.
"2017-07-27T00:00:00Z" // ISO 8601.

# Structs

Define a struct to hold the template data.