Coder Social home page Coder Social logo

c100k / rebootx-on-prem Goto Github PK

View Code? Open in Web Editor NEW
96.0 1.0 0.0 1.02 MB

RebootX On-Prem is an open source specification for defining a custom server in order to manage on-premise runnables and dashboards in the RebootX app.

Home Page: https://c100k.eu/p/rebootx

License: Apache License 2.0

Go 61.29% TypeScript 33.56% JavaScript 5.15%
cloud infrastructure on-prem server dashboard

rebootx-on-prem's Introduction

RebootX On-Prem

CI

What is RebootX On-Prem?

RebootX On-Prem is an open source specification for defining a custom server in order to manage on-premise runnables and dashboards in the RebootX app.

A Runnable is anything that runs, can be stopped and rebooted. For instance, Virtual Machines (VMs), Dedicated servers, Containers, PaaS Applications, Databases... are all valid concretions of a runnable.

A Dashboard is a collection of numeric metrics. For example, number of nodes, number of orders, latency... are all eligible metrics for a dashboard.

If you have already used the RebootX app, you are already familiar with how it works when you connect public cloud providers (Amazon Web Services (AWS), Microsoft Azure, Clever Cloud, Google Cloud (GCP), OVH, Scaleway) or dashboard managers (Grafana).

Why should you use this specification ?

  • You have servers in your local network that you want to manage via an app
  • You hack around small devices like the Raspberry Pi and you want to manage it via an app
  • You have dedicated servers in a datacenter that do not have a central administration console and you want to manage them via an app
  • You have metrics that you want to observe but don't have the time or the need for a big tool like Grafana

Of course, these are only examples and the only limit is your imagination.

Getting Started

The spec follows the OpenAPI Specification allowing a high level of compatibility with existing tools.

You can play with it by loading it locally in SwaggerUI with Docker Compose:

# Generate swagger.json (optional since it's already present in the repository)
docker run --rm -v $(pwd):/app oven/bun run /app/spec/generate-swagger.ts
yarn lint

# Generate Go code with OpenAPI Generator
(cd impl/http-server-go && go mod vendor)
docker run --rm \
-v $(pwd):/app \
openapitools/openapi-generator-cli:v7.4.0 generate \
-i /app/spec/_generated/swagger.json \
-g go \
-o /app/impl/http-server-go/vendor/openapi

# Run Swagger UI calling the http-server-go (see below for more details)
docker-compose up

You can then access http://localhost:9002 via your browser and test the endpoints. See docker-compose.yml to have the apiKey.

You can also directly test the server with cURL:

curl -v -H "Authorization: <apiKey>" http://localhost:9001/cd5331ba/runnables
curl -v -X POST -H "Authorization: <apiKey>" http://localhost:9001/cd5331ba/runnables/123/reboot
curl -v -X POST -H "Authorization: <apiKey>" http://localhost:9001/cd5331ba/runnables/123/stop
curl -v -H "Authorization: <apiKey>" http://localhost:9001/cd5331ba/dashboards

Creating your own server

You can develop your own server to fit your personal needs and keep control on everything that runs on your infra. It is also possible to add endpoints to any existing REST API.

As long as you respect the specification, you can use the language of your choice. To speed things up, you can generate some code using OpenAPI Generator.

For instance, you can generate Rust code with the following command :

docker run --rm \
-v $(pwd):/app \
openapitools/openapi-generator-cli:v7.4.0 generate \
-i /app/spec/_generated/swagger.json \
-g rust \
-o /app/impl/http-server-rust/openapi

Although it can be handful, we do not recommend relying on all the generated code for a production server, because it contains too much boilerplate, making it harder to maintain. It's fine to use the generated structs, interfaces, enums, traits, though. That being said, it's up to you.

Once ready, your server should get your runnables and dashboards from a local file, another API, network calls or a database (remote or local)... Once again, it's up to you.

It should be deployed to an independent location, accessible by the phone you want to use : Internet if you want access from anywhere / LAN if local access is enough for your use case.

Of course, except in some cases, you must serve it with HTTPS to secure the connection between the app and your server.

Existing servers

HTTP Server Go

This is the implementation used in the docker-compose command above, made in Go. You can browse the code at impl/http-server-go.

If you don't want or cannot build your own server, you can use this one.

You can download the latest release from the releases page or build it yourself from source.

The server can run in different modes depending on your use case :

  • Runnables
    • self : it returns the host as a runnable. Be careful if you run this on a machine as a privileged user. It relies on syscall and exec so it can actually reboot or stop the machine for real
    • fileJson (default) : it reads the runnables from a JSON file that must respect the schema in order to be unmarshalled into an array of Runnable (see servers.example.json)
  • Dashboards
    • fileJson (default) : it reads the dashboards from a JSON file that must respect the schema in order to be unmarshalled into an array of Dashboard (see dashboards.example.json)

To override the default behavior, see docker-compose.yml or config.go and update the appropriate environment variables accordingly.

Contributing

We welcome all kind of contributions. Feel free to reach out to us or to publish a PR.

If you want to develop an implementation in a specific language, it must be clean, follow good practice and be self contained in its own directory in ./impl.

In any case, please read the CONTRIBUTING.md guide first.

rebootx-on-prem's People

Contributors

c100k avatar dependabot[bot] avatar

Stargazers

 avatar Kirill Kossov avatar Alexander Johnstone avatar s3rj1k avatar Zaher Ghaibeh avatar Nathan Lloyd Ward avatar Damian Truszkiewicz avatar  avatar Peter Kilonzo Jr avatar Sergio avatar  avatar karyo avatar Jarrod Oxical avatar Graciele Damasceno avatar Emmanuel Pays avatar Justin Garrison avatar  avatar Christopher Webb avatar Nikolay Kolev avatar  avatar genix avatar  avatar  avatar Samy Lahfa avatar M Adib zamzam avatar  avatar Aayushman Choudhary avatar Rishu Mehrotra avatar Šimon Mravec avatar  avatar Aravind S Narayan avatar Patrick Rachford avatar Zander Hill avatar  avatar Anil Dewani avatar Foaad avatar Bao Nguyen avatar tom zhou avatar nnechm avatar  avatar Eduard Carreras avatar Luca Medeiros avatar  avatar Miki Oracle avatar koutsie avatar Adam Zell avatar Elvis Nuno avatar Peter avatar William Angelo avatar rockybi avatar Daniel Mahony avatar dai avatar  avatar  avatar Salvatore Gentile avatar Denys Vitali avatar Niranjan Ravichandra avatar Viet Phan avatar Massimo avatar  avatar  avatar Adam Charnock avatar Bjoern Rennhak avatar Clemens avatar Emilio Loi avatar Bueller avatar  avatar Justin Bennett avatar Matthew Walther avatar Arto Bendiken avatar Lucas Barbosa avatar stormed avatar Flynn Martin avatar Colby Melvin avatar Patrick avatar Jason Riddle avatar Jordan Coeyman avatar Mòrian avatar RT avatar Kenneth Bruskiewicz avatar  avatar  avatar Eric S. avatar Hunter Austin avatar Bruno Paulino avatar Joshua Paine avatar  avatar Antonio De Lucreziis avatar Sandeep Shantharam avatar Martijn van Berkum avatar Ed avatar Alexander avatar Andy Dormire avatar Ivan Danov avatar Louis Bourguignon avatar Bozhidar Genev avatar

Watchers

 avatar

rebootx-on-prem's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.