2024-04-22 06:24:38 +00:00
# jx
2024-03-09 00:12:54 +00:00
2024-03-27 20:10:32 +00:00
# Purpose
These tools work with YAML descriptions of resources (E.g. files, users, containers, etc) for (de)serializing the state of the given resource. This enables more generically describing the state of a supported resource type, pipeling state transformations and enabling the use of other tools in that process.
2024-03-21 22:28:29 +00:00
2024-03-27 23:08:13 +00:00
# Dependencies
* Go >= 1.21.1
2024-07-08 17:06:07 +00:00
# Releases
2024-09-23 17:03:20 +00:00
**v0 releases are unstable and changes may be made to interfaces and specifications.**
# JX Documents
The JX YAML specification is a simple way to describe system resources. The two main components are `configurations` and `resources` .
## Configurations
`
configurations:
- name: myhttpconfig
values:
http_user: jex
http_password: sample
- name: myhttptoken
values:
authorization_token: abcde123456789
`
## Resources
`
resources:
- type: http
config: myhttptoken
transition: read
attributes:
endpoint: https://myserver/v1/api
`
2024-07-08 17:06:07 +00:00
2024-03-27 23:08:13 +00:00
# Testing
Testing the current version involves checking out main and building.
2024-03-27 23:09:18 +00:00
```
2024-05-06 00:48:54 +00:00
git clone https://gitea.rosskeen.house/doublejynx/jx.git
2024-03-27 23:08:13 +00:00
make test
make build
2024-03-27 23:09:18 +00:00
```
2024-03-27 23:08:13 +00:00
2024-03-21 22:28:29 +00:00
# Command-line
2024-03-27 19:25:12 +00:00
# Update Resource state
2024-04-22 06:24:38 +00:00
`jx apply decl-runner.yaml`
Create the resources specified in a resource document HTTP endpoint.
`jx apply http://localhost/resources`
2024-05-14 18:26:05 +00:00
Convert a tar archive into resource definitions and apply them (extracts the contents of a tar).
`jx apply https://gitea.rosskeen.house/doublejynx/jx/archive/v0.2.1.tar.gz`
2024-03-21 22:28:29 +00:00
2024-03-27 19:25:12 +00:00
# Read resource state
2024-03-27 20:03:28 +00:00
Read the state of an existing resource (URI) and generate a YAML representation of it.
2024-04-22 06:24:38 +00:00
`jx import -resource file://COPYRIGHT`
2024-07-02 16:30:21 +00:00
## Importing resources from different sources
JX supports importing resources data from various source types, among these are filesystem directories, tar archive contents, containers, iptables chains, installed packages, etc.
Import system packages using the debian package type, and output the resource documents in JSON format.
`jx import --output json:// package://?type=deb`
2024-04-22 06:24:38 +00:00
Import the contents of a tar archive into a resource document.
`jx import ./test.tgz`
2024-05-09 08:54:12 +00:00
Import resource documents from multiple sources.
2024-05-09 08:50:56 +00:00
`jx import repo/packages/build.jx.yaml ./gopkgs.tar.gz`
![Import Doc ](md-images/jx-import.gif )
2024-04-22 06:24:38 +00:00
Read a resource document from an http endpoint.
`jx import http://localhost/resources`
2024-05-09 00:49:50 +00:00
# Diff resource documents
![Diff Resources ](md-images/jx-diff.gif )
2024-03-25 21:57:30 +00:00
# Examples
2024-03-21 22:28:29 +00:00
2024-03-25 21:57:30 +00:00
Resources:
2024-07-17 08:34:57 +00:00
* [container ](examples/container.jx.yaml ) [schema ](internal/resource/schemas/container.schema.json )
* [container-image ](examples/container-image.jx.yaml ) [schema ](internal/resource/schemas/container-image.schema.json )
* [container-network ](examples/container-network.jx.yaml ) [schema ](internal/resource/schemas/container-network.schema.json )
* [exec ](examples/exec.jx.yaml ) [schema ](internal/resource/schemas/exec.schema.json )
* [file ](examples/file.jx.yaml ) [schema ](internal/resource/schemas/file.schema.json )
* [group ](examples/group.jx.yaml ) [schema ](internal/resource/schemas/group.schema.json )
* [http ](examples/http.jx.yaml ) [schema ](internal/resource/schemas/http.schema.json )
* [iptable ](examples/iptable.jx.yaml ) [schema ](internal/resource/schemas/iptable.schema.json )
* [network_route ](examples/network_route.jx.yaml ) [schema ](internal/resource/schemas/network_route.schema.json )
* [package ](examples/package.jx.yaml ) [schema ](internal/resource/schemas/package.schema.json )
* [user ](examples/user.jx.yaml ) [schema ](internal/resource/schemas/user.schema.json )