update docs

This commit is contained in:
Hayden 2022-09-14 09:35:23 -08:00
parent 84144d823d
commit 6341aebe66
13 changed files with 139 additions and 19 deletions

View file

@ -20,15 +20,33 @@
<a href="https://discord.gg/tuncmNrE4z">Discord</a> <a href="https://discord.gg/tuncmNrE4z">Discord</a>
</p> </p>
## Quick Start
```yml
version: "3.4"
services:
homebox:
image: ghcr.io/hay-kot/homebox:nightly
container_name: homebox
restart: always
volumes:
- homebox-data:/data/
ports:
- 3100:7745
volumes:
homebox-data:
driver: local
```
## MVP Todo ## MVP Todo
- [ ] Asset Attachments for Items - [ ] Asset Attachments for Items
- [ ] Db Migrations - [ ] Db Migrations
- [ ] How To - [ ] How To
- [ ] Documentation - [x] Documentation
- [ ] Docker Compose - [x] Docker Compose
- [ ] Config File - [x] Config Options
- [ ] TLDR; Getting Started
- [x] Locations - [x] Locations
- [x] Create - [x] Create
- [x] Update - [x] Update

View file

@ -844,7 +844,7 @@ const docTemplate = `{
"types.Build": { "types.Build": {
"type": "object", "type": "object",
"properties": { "properties": {
"build_time": { "buildTime": {
"type": "string" "type": "string"
}, },
"commit": { "commit": {

View file

@ -836,7 +836,7 @@
"types.Build": { "types.Build": {
"type": "object", "type": "object",
"properties": { "properties": {
"build_time": { "buildTime": {
"type": "string" "type": "string"
}, },
"commit": { "commit": {

View file

@ -31,7 +31,7 @@ definitions:
type: object type: object
types.Build: types.Build:
properties: properties:
build_time: buildTime:
type: string type: string
commit: commit:
type: string type: string

View file

@ -14,7 +14,7 @@ import (
func (a *app) setupLogger() { func (a *app) setupLogger() {
// Logger Init // Logger Init
// zerolog.TimeFieldFormat = zerolog.TimeFormatUnix // zerolog.TimeFieldFormat = zerolog.TimeFormatUnix
if a.conf.Mode != config.ModeProduction { if a.conf.Log.Format != config.LogFormatJSON {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}) log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
} }

View file

@ -38,7 +38,7 @@ func TestHandlersv1_HandleBase(t *testing.T) {
} }
// Validate Json Payload // Validate Json Payload
expected := `{"health":true,"versions":null,"title":"Go API Template","message":"Welcome to the Go API Template Application!","Build":{"version":"0.1.0","commit":"HEAD","build_time":"now"}}` expected := `{"health":true,"versions":null,"title":"Go API Template","message":"Welcome to the Go API Template Application!","Build":{"version":"0.1.0","commit":"HEAD","buildTime":"now"}}`
if rr.Body.String() != expected { if rr.Body.String() != expected {
t.Errorf("Expected json to be %s, got %s", expected, rr.Body.String()) t.Errorf("Expected json to be %s, got %s", expected, rr.Body.String())

View file

@ -40,7 +40,7 @@ type WebConfig struct {
func NewConfig(file string) (*Config, error) { func NewConfig(file string) (*Config, error) {
var cfg Config var cfg Config
const prefix = "API" const prefix = "HBOX"
help, err := func() (string, error) { help, err := func() (string, error) {
if _, err := os.Stat(file); errors.Is(err, os.ErrNotExist) { if _, err := os.Stat(file); errors.Is(err, os.ErrNotExist) {

View file

@ -1,6 +1,11 @@
package config package config
const (
LogFormatJSON = "json"
LogFormatText = "text"
)
type LoggerConf struct { type LoggerConf struct {
Level string `conf:"default:debug"` Level string `conf:"default:info"`
File string `conf:""` Format string `conf:"default:text"`
} }

View file

@ -3,3 +3,23 @@
--md-primary-fg-color--light: #5b7f67; --md-primary-fg-color--light: #5b7f67;
--md-primary-fg-color--dark: #90030c; --md-primary-fg-color--dark: #90030c;
} }
/* Site width etc.*/
.md-grid {
max-width: 64rem !important;
}
.md-typeset table:not([class]) th {
color: white;
background-color: var(--md-primary-fg-color--light);
}
th {
font-weight: bold;
}
.md-button {
padding: 0.2rem 0.75rem !important;
}

View file

@ -18,12 +18,12 @@
Homebox is the inventory and organization system built for the Home User! With a focus on simplicity and ease of use, Homebox is the perfect solution for your home inventory, organization, and management needs. While developing this project I've tried to keep the following principles in mind: Homebox is the inventory and organization system built for the Home User! With a focus on simplicity and ease of use, Homebox is the perfect solution for your home inventory, organization, and management needs. While developing this project I've tried to keep the following principles in mind:
- _Simple_ - Homebox is designed to be simple and easy to use. No complicated setup or configuration required. Use either a single docker container, or deploy yourself by compiling the binary for your platform of choice. - _Simple_ - Homebox is designed to be simple and easy to use. No complicated setup or configuration required. Use either a single docker container, or deploy yourself by compiling the binary for your platform of choice.
- _Blazingly Fast_ - Homebox is written in Go which makes it extremely fast and requires minimal resources to deploy. In general idle memory usage is deploy 75MB for the whole container. - _Blazingly Fast_ - Homebox is written in Go which makes it extremely fast and requires minimal resources to deploy. In general idle memory usage is less than 50MB for the whole container.
- _Portable_ - Homebox is designed to be portable and run on any platform. It can be run as a single docker container, or compiled for your platform of choice. We use SQLite and an embedded Web UI to make it easy to deploy and use. - _Portable_ - Homebox is designed to be portable and run on anywhere. We use SQLite and an embedded Web UI to make it easy to deploy, use, and backup.
## Project Status ## Project Status
Homebox is currently in active development and is currently in **preview** stage. This means that the project may still be unstable and clunky. Overall we are striving to not introduce any breaking changes and have checks in place to ensure migrations and upgrades are smooth. However, we do not guarantee that there will be no breaking changes. We will try to keep the documentation up to date as we make changes. Homebox is currently in early-active development and is currently in **preview** stage. This means that the project may still be unstable and clunky. Overall we are striving to not introduce any breaking changes and have checks in place to ensure migrations and upgrades are smooth. However, we do not guarantee that there will be no breaking changes. We will try to keep the documentation up to date as we make changes.
## Features ## Features

View file

@ -2,8 +2,77 @@
## Docker Run ## Docker Run
... Great for testing out the application, but not recommended for stable use. Checkout the docker-compose for the recommended deployment.
```sh
docker run --name=homebox \
--restart=always \
--publish=3100:7745 \
ghcr.io/hay-kot/homebox:nightly
```
## Docker-Compose ## Docker-Compose
... ```yml
version: "3.4"
services:
homebox:
image: ghcr.io/hay-kot/homebox:nightly
container_name: homebox
restart: always
environment:
- HBOX_LOG_LEVEL=info
- HBOX_LOG_FORMAT=text
volumes:
- homebox-data:/data/
ports:
- 3100:7745
volumes:
homebox-data:
driver: local
```
## Env Variables & Configuration
| Variable | Default | Description |
| ------------------------ | ---------------- | ---------------------------------------------------------------------------------- |
| HBOX_MODE | production | application mode used for runtime behavior can be one of: development, production |
| HBOX_WEB_PORT | 7745 | port to run the web server on, in you're using docker do not change this |
| HBOX_WEB_HOST | | host to run the web server on, in you're using docker do not change this |
| HBOX_DATABASE_DRIVER | sqlite | database driver to use, currently only sqlite is supported |
| HBOX_DATABASE_SQLITE_URL | /data/homebox.db | sqlite database url, in you're using docker do not change this |
| HBOX_LOG_LEVEL | info | log level to use, can be one of: trace, debug, info, warn, error, critical |
| HBOX_LOG_FORMAT | text | log format to use, can be one of: text, json |
| HBOX_MAILER_HOST | | email host to use, if not set no email provider will be used |
| HBOX_MAILER_PORT | 587 | email port to use |
| HBOX_MAILER_USERNAME | | email user to use |
| HBOX_MAILER_PASSWORD | | email password to use |
| HBOX_MAILER_FROM | | email from address to use |
| HBOX_SWAGGER_HOST | 7745 | swagger host to use, if not set swagger will be disabled |
| HBOX_SWAGGER_SCHEMA | http | swagger schema to use, can be one of: http, https |
!!! tip "CLI Arguments"
If you're deploying without docker you can use command line arguments to configure the application. Run `homebox --help` for more information.
```sh
Usage: api [options] [arguments]
OPTIONS
--mode/$HBOX_MODE <string> (default: development)
--web-port/$HBOX_WEB_PORT <string> (default: 7745)
--web-host/$HBOX_WEB_HOST <string>
--database-driver/$HBOX_DATABASE_DRIVER <string> (default: sqlite3)
--database-sqlite-url/$HBOX_DATABASE_SQLITE_URL <string> (default: file:ent?mode=memory&cache=shared&_fk=1)
--log-level/$HBOX_LOG_LEVEL <string> (default: debug)
--log-file/$HBOX_LOG_FILE <string>
--mailer-host/$HBOX_MAILER_HOST <string>
--mailer-port/$HBOX_MAILER_PORT <int>
--mailer-username/$HBOX_MAILER_USERNAME <string>
--mailer-password/$HBOX_MAILER_PASSWORD <string>
--mailer-from/$HBOX_MAILER_FROM <string>
--swagger-host/$HBOX_SWAGGER_HOST <string> (default: localhost:7745)
--swagger-scheme/$HBOX_SWAGGER_SCHEME <string> (default: http)
--help/-h
display this help message
```

View file

@ -1,5 +1,7 @@
site_name: Homebox site_name: Homebox
# site_url: https://hay-kot.github.io/homebox/ site_url: https://hay-kot.github.io/homebox/
repo_name: Homebox
repo_url: https://github.com/hay-kot/homebox
use_directory_urls: true use_directory_urls: true
theme: theme:
name: material name: material
@ -41,3 +43,9 @@ markdown_extensions:
- attr_list - attr_list
- pymdownx.tabbed - pymdownx.tabbed
- pymdownx.superfences - pymdownx.superfences
nav:
- Home: index.md
- Quick Start: quick-start.md
- Importing Data: import-csv.md
- Building The Binary: build.md

View file

@ -30,7 +30,7 @@ export interface ApiSummary {
} }
export interface Build { export interface Build {
build_time: string; buildTime: string;
commit: string; commit: string;
version: string; version: string;
} }