simple-store

command module
v0.0.0-...-f113028 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2023 License: GPL-3.0 Imports: 1 Imported by: 0

README

simple-store

Simply Store your file Made to make your work easier as for saving files.

Features

  • Chunking file (in one server)
  • Replication (between servers)
  • Centeral database for saving server stats for replication
  • [WIP] Dockerizing and adding installation methods

Made out of

Usage

run project with --help option

All the flags can be set using Environment Variables (if you prefer) Here is the naming convention for them

All of them are starting with SS_ and the Option (replace - with _) and make it Uppercase

Also, prometheus exporter will start at the same address in /metrics address

and swagger will start at /swagger address (If configured)

Installation

From Source

Clone the project and get the requirements by running

go mod tidy

run the project by

go run . --help

or build it then run it

go build .
./simple-store --help
Bare Golang

After installing Golang run the command below

go install github.com/mhkarimi1383/simple-store@latest
Docker

Docker images are in three categories:

  1. Stable: Made when we create tags (also each tag will be usabe as docker tag) [Not Published yet.]
  2. Latest: Made out of last commit on master branch (you can also use commit hashes)
  3. PRs: We make image for each PR to make tests easier (pr-PR ID) [this section is not available yet.]
Docker Compose

Also Ready to use Docker Compose files are present here

docker-compose.local.yaml is used for local builds

docker-compose.stable.yaml is used for production

bring it up by running

docker compose up -d -f ./docker-compose.stable.yaml # or ./docker-compose.local.yaml

or if you are running an older version of docker compose (lower then 2)

docker-compose up -d -f ./docker-compose.stable.yaml # or ./docker-compose.local.yaml

Development

Swagger

After making changes in api run the command below to generate openapi spec

make sure swaggo is installed go install github.com/swaggo/swag/cmd/swag@latest

cd api
swag init -g api.go
Package Structure
  • As you can see utilities are in internal package with sub packages
  • also api related things are inside api package (docs package is auto generated by swaggo)
  • put all of your types inside types package
  • cmd package is just for initializing project using command line

LICENSE

This project is licensed under GPLv3

Documentation

Overview

Copyright © 2022 NAME HERE <EMAIL ADDRESS>

Directories

Path Synopsis
api
Package api api starts from here
Package api api starts from here
docs
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
handlers
Package handlers api handlers are here
Package handlers api handlers are here
Package cmd the magic starts from here
Package cmd the magic starts from here
internal
config
Package config holds a singletone pointer of the configuration
Package config holds a singletone pointer of the configuration
filemanager
Package filemanager is the centeral package for managing files and database
Package filemanager is the centeral package for managing files and database
flagloader
Package flagloader helps us for loading flags from ENV
Package flagloader helps us for loading flags from ENV
pathhelper
Package pathhelper helpers for managing directories and paths are here
Package pathhelper helpers for managing directories and paths are here
typeconverters
Package typeconverters here we make our owned converters when needed
Package typeconverters here we make our owned converters when needed
Package types all of the types used in project are here
Package types all of the types used in project are here

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL