Sign inSign up

oneofftech/k-link-registry

By oneofftech

•Updated over 7 years ago

Registry to manage a k-link-network with multiple applications.

Image
0

10K+

oneofftech/k-link-registry repository overview

Build Status - Build Status

The K-Link-Registry is a Web Application that allows its Users, the "Registrants", to modify Applications served by K-Link.

⁠Installation

Precompiled binaries as well as docker images are provided for easy installation.

K-Link registry builds ontop of the API schema for the last iteration of the registry. It can be used with a preexisting Database, but this database needs to be migrated first. Refer to the documentation of the migrate subcommand.

⁠Usage

K-Link registry exposes two APIs: Version 1.0 is currently used as an endpoint for application validation, Version 2.0 is used by the frontend to get access to the managed resources, but can be used by other apps in the same way, once they are authenticated.

⁠Configuration

The software can be configured via a config file, environment variables or flags. To learn about the various options, run the binary using the help command, i.e. klinkregistry help.

⁠Base config

Used by every command

flagENVdescription
config-config file to use
assetsREGISTRY_ASSETS_DIRAssets dir (default empty, embedded assets will be used)
migrationsREGISTRY_MIGRATIONS_DIRThe folder that contains the database migrations (default empty, embedded migrations will be used)
db-hostREGISTRY_DB_HOSTDatabase host (default: "database")
db-portREGISTRY_DB_PORTDatabase Port (default: "3306")
db-userREGISTRY_DB_USERDatabase User (default: "kregistry")
db-passREGISTRY_DB_PASSDatabase Password (default: "kregistry")
db-nameREGISTRY_DB_NAMEDatabase Name (default: "kregistry")
smtp-hostREGISTRY_SMTP_HOSTMail Host (default: empty, logger will be used to output mails)
smtp-portREGISTRY_SMTP_PORTOutgoing mail Port (default: 25)
smtp-userREGISTRY_SMTP_USERMail user (default: kregistry)
smtp-passREGISTRY_SMTP_PASSMail Password (default: registry)
smtp-fromREGISTRY_SMTP_FROMFrom Address (default: [email protected]⁠)
enable-user-registrationREGISTRY_ENABLE_USER_REGISTRATIONEnable everyone to register an account (default: false)
⁠server config

Used by the server subcommand

flagENVdescription
httpREGISTRY_HTTP_LISTENAddress for the HTTP server to listen on (default: ":80")
http-read-timeoutREGISTRY_HTTP_READ_TIMEOUTTimeout duration for HTTP read (default: "10s")
http-write-timeoutREGISTRY_HTTP_WRITE_TIMEOUTTimeout duration for HTTP write (default: "10s")
http-max-headerREGISTRY_HTTP_MAX_HEADERMaximal HTTP Header size, in bytes. (default: 1MB)
nameREGISTRY_NAMEName of this instance. (default: "K-Link Registry")
domainREGISTRY_HTTP_DOMAINDomain used for generation of links (default: "example.com")
base-pathREGISTRY_HTTP_BASE_PATHBase path the application is served on (default: "/")
http-secretREGISTRY_HTTP_SECRETSecret string for session generation (default: generated)
admin-usernameREGISTRY_ADMIN_USERNAMEUsername (email) for admin account
admin-passwordREGISTRY_ADMIN_PASSWORDPassword for admin account
⁠migrate config

This command uses the base configuration

Supported arguments:

  • up migrates to the latest database revision, this is probably what you have in mind
  • down cleans the database
  • 1 migrates to the specific revision number, '1' in this case

⁠Development

The K-Link Registry is written in GoLang⁠ with a VueJS⁠ frontend. We currently target Go 1.10.

⁠Build the binary

Before start make sure to have your Go workspace configured

  • Clone the repository in your Go path under github.com/k-box/k-link-registry
  • Enter the cloned repository
  • Pull in the dependencies via go get -tags="dev" -v github.com/k-box/k-link-registry/klinkregistry
  • Run go get github.com/shurcooL/vfsgen/cmd/vfsgendev
  • Build the frontend⁠
  • Move to the ui directory
  • Execute yarn (or npm install)
  • Execute yarn development (or npm run development)

Now you are ready to build a development version.

Build for development

Building a development version will generate a binary that access the migrations and the frontend layer directly from the respective location on disk.

go build --tags="dev" github.com/k-box/k-link-registry/klinkregistry

This will use the files that are in the respective folder and not the included assets in the executable. Migrations will come from assets/migrations/mysql and frontend will come from ui/dist

Watch for changes

During development you might want to continuously re-build the binary and run it to try the changes. To this aim we selected Modd⁠, which is a tool that triggers commands and manages daemons in response to filesystem changes.

# Get Modd
go get -v github.com/cortesi/modd/cmd/modd

# Inser the configuration to be used by the K-Link Registry when started
mkdir ./dist
cp config.example.yaml ./dist/config.yaml

# Run Modd to watch for go files changes
modd --file="./modd.conf"

Build for production

# Build the frontend assets for production
cd ui
yarn production # or npm run production
cd ..

# Enable the assets to be included in the final binary
go generate github.com/k-box/k-link-registry/assets

# Generate the production binary
go build --tags="netgo" github.com/k-box/k-link-registry/klinkregistry
⁠Frontend

For the development documentation of the frontend please refer to the ./ui folder⁠

⁠Known Bugs

Users cannot change their name once registred, except if they are owner

Tag summary

Content type

Image

Digest

Size

5 MB

Last updated

over 7 years ago

docker pull oneofftech/k-link-registry