diff --git a/README.md b/README.md index 0872ce1..f941d93 100644 --- a/README.md +++ b/README.md @@ -20,15 +20,33 @@ Discord

+## 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 - [ ] Asset Attachments for Items - [ ] Db Migrations - [ ] How To -- [ ] Documentation - - [ ] Docker Compose - - [ ] Config File - - [ ] TLDR; Getting Started +- [x] Documentation + - [x] Docker Compose + - [x] Config Options - [x] Locations - [x] Create - [x] Update diff --git a/backend/app/api/docs/docs.go b/backend/app/api/docs/docs.go index fe8b893..90e77ce 100644 --- a/backend/app/api/docs/docs.go +++ b/backend/app/api/docs/docs.go @@ -844,7 +844,7 @@ const docTemplate = `{ "types.Build": { "type": "object", "properties": { - "build_time": { + "buildTime": { "type": "string" }, "commit": { diff --git a/backend/app/api/docs/swagger.json b/backend/app/api/docs/swagger.json index 06f67ed..3d56184 100644 --- a/backend/app/api/docs/swagger.json +++ b/backend/app/api/docs/swagger.json @@ -836,7 +836,7 @@ "types.Build": { "type": "object", "properties": { - "build_time": { + "buildTime": { "type": "string" }, "commit": { diff --git a/backend/app/api/docs/swagger.yaml b/backend/app/api/docs/swagger.yaml index 5d52cff..10cb358 100644 --- a/backend/app/api/docs/swagger.yaml +++ b/backend/app/api/docs/swagger.yaml @@ -31,7 +31,7 @@ definitions: type: object types.Build: properties: - build_time: + buildTime: type: string commit: type: string diff --git a/backend/app/api/logger.go b/backend/app/api/logger.go index b410cd1..f0cfee4 100644 --- a/backend/app/api/logger.go +++ b/backend/app/api/logger.go @@ -14,7 +14,7 @@ import ( func (a *app) setupLogger() { // Logger Init // 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}) } diff --git a/backend/app/api/v1/controller_test.go b/backend/app/api/v1/controller_test.go index 11e008c..de8a73e 100644 --- a/backend/app/api/v1/controller_test.go +++ b/backend/app/api/v1/controller_test.go @@ -38,7 +38,7 @@ func TestHandlersv1_HandleBase(t *testing.T) { } // 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 { t.Errorf("Expected json to be %s, got %s", expected, rr.Body.String()) diff --git a/backend/internal/config/conf.go b/backend/internal/config/conf.go index 79edadd..d9ffe0c 100644 --- a/backend/internal/config/conf.go +++ b/backend/internal/config/conf.go @@ -40,7 +40,7 @@ type WebConfig struct { func NewConfig(file string) (*Config, error) { var cfg Config - const prefix = "API" + const prefix = "HBOX" help, err := func() (string, error) { if _, err := os.Stat(file); errors.Is(err, os.ErrNotExist) { diff --git a/backend/internal/config/conf_logger.go b/backend/internal/config/conf_logger.go index 9438cb8..b81db9c 100644 --- a/backend/internal/config/conf_logger.go +++ b/backend/internal/config/conf_logger.go @@ -1,6 +1,11 @@ package config +const ( + LogFormatJSON = "json" + LogFormatText = "text" +) + type LoggerConf struct { - Level string `conf:"default:debug"` - File string `conf:""` + Level string `conf:"default:info"` + Format string `conf:"default:text"` } diff --git a/docs/docs/assets/stylesheets/extras.css b/docs/docs/assets/stylesheets/extras.css index 72ae471..d490588 100644 --- a/docs/docs/assets/stylesheets/extras.css +++ b/docs/docs/assets/stylesheets/extras.css @@ -3,3 +3,23 @@ --md-primary-fg-color--light: #5b7f67; --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; +} \ No newline at end of file diff --git a/docs/docs/index.md b/docs/docs/index.md index d95772c..567d47d 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -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: - _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. -- _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. +- _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 anywhere. We use SQLite and an embedded Web UI to make it easy to deploy, use, and backup. ## 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 diff --git a/docs/docs/quick-start.md b/docs/docs/quick-start.md index 27f22ae..fce544d 100644 --- a/docs/docs/quick-start.md +++ b/docs/docs/quick-start.md @@ -2,8 +2,77 @@ ## 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 -... \ No newline at end of file +```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 (default: development) + --web-port/$HBOX_WEB_PORT (default: 7745) + --web-host/$HBOX_WEB_HOST + --database-driver/$HBOX_DATABASE_DRIVER (default: sqlite3) + --database-sqlite-url/$HBOX_DATABASE_SQLITE_URL (default: file:ent?mode=memory&cache=shared&_fk=1) + --log-level/$HBOX_LOG_LEVEL (default: debug) + --log-file/$HBOX_LOG_FILE + --mailer-host/$HBOX_MAILER_HOST + --mailer-port/$HBOX_MAILER_PORT + --mailer-username/$HBOX_MAILER_USERNAME + --mailer-password/$HBOX_MAILER_PASSWORD + --mailer-from/$HBOX_MAILER_FROM + --swagger-host/$HBOX_SWAGGER_HOST (default: localhost:7745) + --swagger-scheme/$HBOX_SWAGGER_SCHEME (default: http) + --help/-h + display this help message + ``` \ No newline at end of file diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 091f925..3437089 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -1,5 +1,7 @@ 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 theme: name: material @@ -41,3 +43,9 @@ markdown_extensions: - attr_list - pymdownx.tabbed - pymdownx.superfences + +nav: + - Home: index.md + - Quick Start: quick-start.md + - Importing Data: import-csv.md + - Building The Binary: build.md diff --git a/frontend/lib/api/types/data-contracts.ts b/frontend/lib/api/types/data-contracts.ts index a802309..4d0d9aa 100644 --- a/frontend/lib/api/types/data-contracts.ts +++ b/frontend/lib/api/types/data-contracts.ts @@ -30,7 +30,7 @@ export interface ApiSummary { } export interface Build { - build_time: string; + buildTime: string; commit: string; version: string; }