Skip to content

PlaceOS/frontend-loader

Repository files navigation

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