package
0.0.0-20190628093746-affaa533fc2e
Repository: https://github.com/szymongib/kyma.git
Documentation: pkg.go.dev

# README

Asset Upload Service

Overview

The Asset Upload Service is an HTTP server that exposes the file upload functionality for Minio. It contains a simple HTTP endpoint which accepts multipart/form-data forms. It can upload files to the private and public system buckets.

Prerequisites

Use the following tools to set up the project:

Usage

Run a local version

To run the application against the local Kyma installation on Minikube without building the binary, run this command:

APP_KUBECONFIG_PATH=/Users/$USER/.kube/config APP_VERBOSE=true APP_UPLOAD_ACCESS_KEY={accessKey} APP_UPLOAD_SECRET_KEY={secretKey} go run main.go

Replace values in curly braces with proper details, where:

  • {accessKey} is the access key required to sign in to the content storage server.
  • {secretKey} is the secret key required to sign in to the content storage server.

The service listens on port 3000.

Access on a cluster

To use the Asset Upload Service on a cluster, run the command:

kubectl port-forward deployment/assetstore-asset-upload-service 3000:3000 -n kyma-system

You can access the service on port 3000.

Build a production version

To build the production Docker image, run this command:

docker build {image_name}:{image_tag}

The variables are:

  • {image_name} that is the name of the output image. The default name is asset-upload-service.
  • {image_tag} that is the tag of the output image. The default tag is latest.

Upload files

For the full API documentation, including OpenAPI specification, see the Asset Store docs.

Environmental variables

Use the following environment variables to configure the application:

NameRequiredDefaultDescription
APP_HOSTNo127.0.0.1The host on which the HTTP server listens
APP_PORTNo3000The port on which the HTTP server listens
APP_KUBECONFIG_PATHNoThe path to the kubeconfig file, needed for running an application outside of the cluster
APP_VERBOSENoNoThe toggle used to enable detailed logs in the application
APP_UPLOAD_TIMEOUTNo30mThe file upload timeout
APP_MAX_UPLOAD_WORKERSNo10The maximum number of concurrent upload workers
APP_UPLOAD_ENDPOINTNominio.kyma.localThe address of the content storage server
APP_UPLOAD_PORTNo443The port on which the content storage server listens
APP_UPLOAD_ACCESS_KEYYesThe access key required to sign in to the content storage server
APP_UPLOAD_SECRET_KEYYesThe secret key required to sign in to the content storage server
APP_UPLOAD_SECURENotrueThe HTTPS connection with the content storage server
APP_UPLOAD_EXTERNAL_ENDPOINTNohttps://minio.kyma.localThe external address of the content storage server. If not set, the system uses the APP_UPLOAD_ENDPOINT variable.
APP_BUCKET_PRIVATE_PREFIXNoprivateThe prefix of the private system bucket
APP_BUCKET_PUBLIC_PREFIXNopublicThe prefix of the public system bucket
APP_BUCKET_PUBLIC_PREFIXNous-east-1The region of the system buckets
APP_CONFIG_ENABLEDNotrueThe toggle used to save and load the configuration using the ConfigMap resource
APP_CONFIG_NAMENoasset-upload-serviceConfigMap resource name
APP_CONFIG_NAMESPACENokyma-systemConfigMap resource namespace

Configure the logger verbosity level

This application uses glog to log messages. Pass command line arguments described in the glog.go file to customize the log parameters, such as the log level and output.

For example:

go run main.go --stderrthreshold=INFO -logtostderr=false

Development

Install dependencies

This project uses dep as a dependency manager. To install all required dependencies, use the following command:

dep ensure -vendor-only

Run tests

To run all unit tests, execute the following command:

go test ./...

Verify the code

To check if the code is correct and you can push it, run the before-commit.sh script. It builds the application, runs tests, and checks the status of the vendored libraries. It also runs the static code analysis and ensures that the formatting of the code is correct.

# Packages

No description provided by the author