placeos-frontend-loader

Version, currently 3.0.068 versions

github.com/PlaceOS/frontend-loader

PlaceOS sidecar service for managing frontends.

0 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  placeos-frontend-loader:
    github: PlaceOS/frontend-loader
    version: ~> 3.0.0

Then run:

shards install

shard.yml

Crystal
no constraint declared
Authors
Caspian Baska, Tassja Kriek
Target
  • frontends from src/app.cr

Dependencies

Runtime Dependencies

Development Dependencies

  • ameba*github: crystal-ameba/amebadev
  • faker*github: askn/fakerdev

README

PlaceOS Frontend Loader

Build CI Changelog

suprisingly, a frontend loader!

An application Intended to be a sidecar to a webserver that listens for published front-end repositories and clones them to the webserver's static folder. The loader can also be configured to update via a CRON.

Included in this repo is an alpine based Dockerfile.

Usage

  • Specify the your static content path via the PLACE_LOADER_WWW environment variable, or the --www flag.

  • Ensure that the content directory is on a shared volume with the webserver.

  • A repository pinned to HEAD will be kept up to date automatically.

  • If a repository commit is specified it will held at that commit.

  • Configuring the update frequency is done via a CRON in PLACE_LOADER_CRON environment variable, or the --update-cron flag. Use crontab guru to validate your CRONs!!!

Client

Included is a simple client that can be configured via the PLACE_LOADER_URI environment variable.

require "placeos-frontend-loader/client"

# One-shot
commits = PlaceOS::FrontendLoader::Client.client do |client|
    client.commits("backoffice")
end

commits # => ["fac3caf3", ...]

# Instance
client = PlaceOS::Frontends::Client.new
client.commits("backoffice") # => ["fac3caf3", ...]
client.loaded # => {"backoffice" => "fac3caf3"...}
client.close

Routes

  • GET ../frontends/v1/repositories/:id/commits: returns a list of commits
  • GET ../frontends/v1/repositories/: return the loaded frontends and their current commit

Contributing

See CONTRIBUTING.md.

Contributors