No description
Find a file
Varakh 6e3e543b23
All checks were successful
/ build (pull_request) Successful in 3m14s
chore(deps): update dependencies and move to gocron v2
2024-05-16 09:23:43 +02:00
.forgejo/workflows fix(release): prepare next dev cycle 2024-05-01 12:22:31 +02:00
_doc fix(release): prepare next dev cycle 2024-05-01 12:22:31 +02:00
api feat(actions): introduce an explicit event for changes of an update's version 2024-04-28 22:27:34 +02:00
cmd Initial commit 2023-12-21 17:04:04 +01:00
server chore(deps): update dependencies and move to gocron v2 2024-05-16 09:23:43 +02:00
terminal feat(auth): align CLI application with new auth mode wording 2024-04-28 22:27:34 +02:00
util fix(locks): access to in-memory locks inside scheduled background tasks are now properly guarded 2024-04-28 22:27:34 +02:00
.editorconfig Initial commit 2023-12-21 17:04:04 +01:00
.gitignore Initial commit 2023-12-21 17:04:04 +01:00
CHANGELOG.md chore(deps): update dependencies and move to gocron v2 2024-05-16 09:23:43 +02:00
Dockerfile chore(docker,deps): updates and change docker base (#31) 2024-05-01 20:45:35 +00:00
go.mod chore(deps): update dependencies and move to gocron v2 2024-05-16 09:23:43 +02:00
go.sum chore(deps): update dependencies and move to gocron v2 2024-05-16 09:23:43 +02:00
LICENSE.txt feat(docs,license): clean up documentation and add license 2024-04-28 22:34:26 +02:00
Makefile Initial commit 2023-12-21 17:04:04 +01:00
README.md feat(docs,license): clean up documentation and add license 2024-04-28 22:34:26 +02:00
renovate.json5 Change Renovate schedule 2024-04-28 22:27:34 +02:00

README

Backend for upda - Update Dashboard in Go.

The main git repository is hosted at https://git.myservermanager.com/varakh/upda. Other repositories are mirrors and pull requests, issues, and planning are managed there.

Contributions are very welcome!

Official documentation is hosted in a separate git repository.

Development & contribution

  • Ensure to set the following environment variables for proper debug logs during development
DEVELOPMENT=true
LOGGING_ENCODING=console
LOGGING_LEVEL=debug
  • Code guidelines
    • Each entity has its own repository
    • Each entity is only used in repository and service (otherwise, mapping happens)
    • Presenter layer is constructed from the entity, e.g., in REST responses and mapped
    • No entity is directly returned in any REST response
    • All log calls should be handled by zap.L()
    • Configuration is bootstrapped via separated struct types which are given to the service which need them
    • Error handling
      • Always throw an error with NewServiceError
      • Always wrap the cause error with fmt.Errorf
      • Forward/bubble up the error directly, when original error is already a NewServiceError (most likely internal calls)
      • Always abort handler chain with AbortWithError
      • Utils can throw any error

Please look into the _doc/ folder for OpenAPI specification and a Postman Collection.

Getting started

  1. Run make clean dependencies to fetch dependencies
  2. Start git.myservermanager.com/varakh/upda/cmd/server (or cli) as Go application and ensure to have required environment variables set

If you like to test with PSQL and/or REDIS for task locking, here are some useful docker commands to have containers up and running quickly. Set necessary environment variables properly.

# postgres
docker run --rm --name=upda-db \
  -p 5432:5432 \
  --restart=unless-stopped \
  -e POSTGRES_USER=upda \
  -e POSTGRES_PASSWORD=upda \
  -e POSTGRES_DB=upda \
  postgres:16-alpine
  
# redis
docker run --rm --name some-redis \
  -p 6379:6379 \
  redis redis-server --save 60 1 --loglevel warning

Windows hints

On Windows, you need a valid gcc, e.g., https://jmeubank.github.io/tdm-gcc/download/ and add the \bin folder to your path.

For any go command you run, ensure that your PATH has the gcc binary and that you add CGO_ENABLED=1 as environment.

Release

Releases are handled by the SCM platform and pipeline. Creating a new git tag, creates a new release in the SCM platform, uploads produced artifacts to that release and publishes docker images automatically. Before doing so, please ensure that the commit on master has the correct version settings and has been built successfully:

  • Adapt constants_app.go and change Version to the correct version number
  • Adapt CHANGELOG.md to reflect changes and ensure a date is properly set in the header, also add a reference link in footer (link to scm git tag source)
  • Adapt api.yaml: version attribute must reflect the to be released version
  • Adapt env: VERSION_* in .forgejo/workflows/release.yaml

After the release has been created, ensure to change the following settings for the next development cycle:

  • Adapt constants_app.go and change Version to the next version number
  • Adapt CHANGELOG.md and add an UNRELEASED section
  • Adapt api.yaml: version attribute must reflect the next version number
  • Adapt env: VERSION_* in .forgejo/workflows/release.yaml to next version number