pvr is about transforming a directory structure that contains files as well as json files into
a single managable, diffable and mergeable json file that unambiguously defines directory state.
To leverage the features of json diff/merge etc. all json files found in a directory tree will
get inlined while all other objects will get a sha reference entry with the files themselves
getting stored in a flat objects directory.
This will atomically update the json file in your repo after ensuring all the
right objects have been synched into the objects store of that pvr repo.
After committing your changes you might want to store your current repository
state for reuse or archiving purpose. You can do so using the push command:
$ pvr push /tmp/myrepo
You can always get a birds view on things in your repo by dumping the complete
current json:
$ pvr json
{...}
You can also push your repository to a pvr compliant REST backend. In this
case to a device trails (replace device id with your device)
$ pvr post https://api.pantahub.com/trails/<DEVICEID>
You can later clone that very repo to use it as a starting point or get
its content to update another repo.
Every PVR Repo is backed by an object repository which has for each
file a hashed file in it. These will be used on device as hardlink or on a checkout as a source to copy the files referenced from the state json file above.
By default the objects are kept centrally so you they get reused across potentially many projects you might checkout as a developer, but on device or in special cases you can use the --objects-dir parameter to use a different location.
$ ls objects/
8862f6feea4f6d01e28adc674285640874da19d7594dd80ed42ff7fb4dc0eea3
ad6da30bb62fae51c770574a5ca33c5e8e4bbc67fd6c5e7c094c34ad52a28e4d
d0365cf6153143a414cccaca9260bc614593feba9fe0379d0ffb7a1178470499
d9206603679fcf0a10bf4e88bf880222b05b828749ea1e2874559016ff0f5230
You would now continue editing this directory as it pleases you and you can refer to any file you put here in your configs just using the path as key (e.g. systemc.json": {} would create a systemc.json file on checkout).
prv add will put a file that exists in working directory under management of pvr. This means that the file will be honored on future pvr diff and pvr commit operations.
Example: If you bring in a basic platform to your system you simply copy them into the working dir and put them under pvr management:
You can copy device state or subelements from one device to another without
downloading the bits to your local machine.
This only works for source devices that the user has access to. Right now
thats the case for Public devices as well as for devices owned by the
user itself.
To fastcopy a complete device experience you would simply use:
pvr fastcopy -m "your commit message to file for the new revision" \
https://pvr.pantahub.com/pantahub-ci/rpi4_initial_latest#bsp \
https://pvr.pantahub.com/yournick/yourdevice
Similarly you can copy apps this way:
pvr fastcopy -m "copy pvr-sdk from source device to yourdevice" \
https://pvr.pantahub.com/pantahub-ci/rpi4_initial_latest#pvr-sdk \
https://pvr.pantahub.com/yournick/yourdevice
PVR Devices commands provide convenience for developers and individuals
that operate their very own pantavisor enabled solutions.
These commands are designed for developers that want to interface with devices
in their own local network, but not does not replace a fleet management
solution.
pvr device set = [KEY2]=[VALUE2]...[KEY-N]=[VALUE-N]¶
pvr device set : Set or Update device user-meta & device-meta fields (Note:If you are logged in as USER then you can update user-meta field but if you are logged in as DEVICE then you can update device-meta field)
example1$ pvr device set 5df243ff0be81900099855e6 a=1 b=2
{
"a": "1",
"b": "2"
}
user-meta field Updated Successfully
example2$ pvr device set 5df243ff0be81900099855e6 a=1 b=2
{
"a": "1",
"b": "2"
}
device-meta field Updated Successfully
pvr device logs list the logs with filter options of device,source,level & platform
example1$ pvr device logs 5d555d5e80123b31faa3cff2/pantavisor.log@INFO#windows
2020-01-06T12:54:17Z 5e0f4ede:windows(pantavisor.log):INFO My log line 1 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:54:43Z 5e0f4ede:windows(pantavisor.log):INFO My log line 2 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:54:53Z 5e0f4ede:windows(pantavisor.log):INFO My log line 3 to remember from device:5d555d5e80123b31faa3cff2
pvr device logs list the logs with filter options of multiple device,source,level &platform
example2$ pvr device logs 5d555d5e80123b31faa3cff2,5d555d5e80123b31faa3cff5/pantavisor.log,pantavisor2.log@INFO,INFO2#windows,linux
2020-01-06T12:54:17Z 5e0f4ede:windows(pantavisor.log):INFO My log line 1 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:54:43Z 5e0f4ede:windows(pantavisor.log):INFO My log line 1 to remember from device:5d555d5e80123b31faa3cff5
2020-01-06T12:54:53Z 5e0f4ede:windows(pantavisor.log):INFO My log line 2 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:55:03Z 5e0f4ede:windows(pantavisor.log):INFO My log line 2 to remember from device:5d555d5e80123b31faa3cff5
2020-01-06T12:55:17Z 5e0f4ede:linux(pantavisor2.log):INFO2 My log line 3 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:55:43Z 5e0f4ede:linux(pantavisor2.log):INFO2 My log line 3 to remember from device:5d555d5e80123b31faa3cff5
2020-01-06T12:55:53Z 5e0f4ede:linux(pantavisor2.log):INFO2 My log line 4 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:56:03Z 5e0f4ede:linux(pantavisor2.log):INFO2 My log line 4 to remember from device:5d555d5e80123b31faa3cff5
pvr device logs --from=2020-01-06 --to=2020-01-07 list the logs within a given date range
example3\$ pvr device logs 5d555d5e80123b31faa3cff2,5d555d5e80123b31faa3cff5/pantavisor.log,pantavisor2.log@INFO,INFO2
2020-01-06T12:54:17Z 5e0f4ede:pantavisor.log:INFO My log line 1 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:54:43Z 5e0f4ede:pantavisor.log:INFO My log line 1 to remember from device:5d555d5e80123b31faa3cff5
2020-01-06T12:54:53Z 5e0f4ede:pantavisor.log:INFO My log line 2 to remember from device:5d555d5e80123b31faa3cff2
2020-01-07T12:55:03Z 5e0f4ede:pantavisor.log:INFO My log line 2 to remember from device:5d555d5e80123b31faa3cff5
2020-01-07T12:55:17Z 5e0f4ede:pantavisor2.log:INFO2 My log line 3 to remember from device:5d555d5e80123b31faa3cff2
2020-01-07T12:55:43Z 5e0f4ede:pantavisor2.log:INFO2 My log line 3 to remember from device:5d555d5e80123b31faa3cff5
2020-01-07T12:55:53Z 5e0f4ede:pantavisor2.log:INFO2 My log line 4 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:56:03Z 5e0f4ede:pantavisor2.log:INFO2 My log line 4 to remember from device:5d555d5e80123b31faa3cff5
pvr device logs --from=2020-01-06T12:54:10--to=2020-01-06T12:54:20 list the logs within a given date time range
example4\$ pvr device logs 5d555d5e80123b31faa3cff2,5d555d5e80123b31faa3cff5/pantavisor.log,pantavisor2.log@INFO,INFO2
2020-01-06T12:54:10Z 5e0f4ede:pantavisor.log:INFO My log line 1 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:54:10Z 5e0f4ede:pantavisor.log:INFO My log line 1 to remember from device:5d555d5e80123b31faa3cff5
2020-01-06T12:54:10Z 5e0f4ede:pantavisor.log:INFO My log line 2 to remember from device:5d555d5e80123b31faa3cff2
2020-01-07T12:55:15Z 5e0f4ede:pantavisor.log:INFO My log line 2 to remember from device:5d555d5e80123b31faa3cff5
2020-01-07T12:55:15Z 5e0f4ede:pantavisor2.log:INFO2 My log line 3 to remember from device:5d555d5e80123b31faa3cff2
2020-01-07T12:55:20Z 5e0f4ede:pantavisor2.log:INFO2 My log line 3 to remember from device:5d555d5e80123b31faa3cff5
2020-01-07T12:55:20Z 5e0f4ede:pantavisor2.log:INFO2 My log line 4 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:56:20Z 5e0f4ede:pantavisor2.log:INFO2 My log line 4 to remember from device:5d555d5e80123b31faa3cff5
pvr device logs --from=2020-01-06T12:54:10+05:30 --to=2020-01-06T12:54:20+05:30 list the logs within a given date time range having timezone: +05:30(IST) ,Note:Timezone is optional
example5\$ pvr device logs 5d555d5e80123b31faa3cff2,5d555d5e80123b31faa3cff5/pantavisor.log,pantavisor2.log@INFO,INFO2
2020-01-06T12:54:10Z 5e0f4ede:pantavisor.log:INFO My log line 1 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:54:10Z 5e0f4ede:pantavisor.log:INFO My log line 1 to remember from device:5d555d5e80123b31faa3cff5
2020-01-06T12:54:10Z 5e0f4ede:pantavisor.log:INFO My log line 2 to remember from device:5d555d5e80123b31faa3cff2
2020-01-07T12:55:15Z 5e0f4ede:pantavisor.log:INFO My log line 2 to remember from device:5d555d5e80123b31faa3cff5
2020-01-07T12:55:15Z 5e0f4ede:pantavisor2.log:INFO2 My log line 3 to remember from device:5d555d5e80123b31faa3cff2
2020-01-07T12:55:20Z 5e0f4ede:pantavisor2.log:INFO2 My log line 3 to remember from device:5d555d5e80123b31faa3cff5
2020-01-07T12:55:20Z 5e0f4ede:pantavisor2.log:INFO2 My log line 4 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:56:20Z 5e0f4ede:pantavisor2.log:INFO2 My log line 4 to remember from device:5d555d5e80123b31faa3cff5
pvr device logs --from=P10D --to=P5D list the logs from last 10 days to last 5 days
Note: --from & --too flags support the ISO 8601 Duration strings
example6\$ pvr device logs 5d555d5e80123b31faa3cff2,5d555d5e80123b31faa3cff5/pantavisor.log,pantavisor2.log@INFO,INFO2
2020-01-06T12:54:10Z 5e0f4ede:pantavisor.log:INFO My log line 1 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:54:10Z 5e0f4ede:pantavisor.log:INFO My log line 1 to remember from device:5d555d5e80123b31faa3cff5
2020-01-06T12:54:10Z 5e0f4ede:pantavisor.log:INFO My log line 2 to remember from device:5d555d5e80123b31faa3cff2
2020-01-07T12:55:15Z 5e0f4ede:pantavisor.log:INFO My log line 2 to remember from device:5d555d5e80123b31faa3cff5
2020-01-07T12:55:15Z 5e0f4ede:pantavisor2.log:INFO2 My log line 3 to remember from device:5d555d5e80123b31faa3cff2
2020-01-07T12:55:20Z 5e0f4ede:pantavisor2.log:INFO2 My log line 3 to remember from device:5d555d5e80123b31faa3cff5
2020-01-07T12:55:20Z 5e0f4ede:pantavisor2.log:INFO2 My log line 4 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:56:20Z 5e0f4ede:pantavisor2.log:INFO2 My log line 4 to remember from device:5d555d5e80123b31faa3cff5
pvr device logs list the logs with filter options of multiple platforms
example7\$ pvr device logs --platform=linux,windows
5ea97febfb( ) May 1 20:28:28 linux(pantavisor.log ): My log line to remember
5ea97febfb( ) May 1 20:28:29 windows(pantavisor.log ): My log line to remember
5ea97febfb( ) May 1 20:28:30 linux(pantavisor.log ): My log line to remember
pvr import : import repo tarball (like the one produced by 'pvr export') into pvr in current working dir.It can import files with.gz or .tgz extension as well as plain .tar. Will not do pvr checkout, so working directory stays untouched.
Since version 006 PVR also provides convenience commands for interacting with pantahub
regardless beyond publishing pvr repositories to pantahub trails.
WARNING:This command is DEPRECATED, please use pvr device ps instead
pvr ps gets a list of devices like below:
\$ pvr ps
ID NICK REV STATUS STATE SEEN MESSAGE
5a21cefc tops_urchin 20 NEW xxxx 7 months ago message....
5af32b42 verified_cicada 5 NEW xxxx 5 months ago message....
5af4ca2c classic_crappie 0 DONE xxxx 5 months ago message....
5b07f476 resolved_mule 0 DONE xxxx 4 months ago message....
5b07ff81 right_vervet 0 DONE xxxx 4 months ago message....
5b08464f helped_aphid 3 NEW xxxx about 23 hours ago message....
WARNING:This command is DEPRECATED, please use pvr device logs instead
pvr logs list the logs with filter options of device,source & level
example1\$ pvr logs 5d555d5e80123b31faa3cff2/pantavisor.log@INFO
2020-01-06T12:54:17Z 5e0f4ede:pantavisor.log:INFO My log line 1 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:54:43Z 5e0f4ede:pantavisor.log:INFO My log line 2 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:54:53Z 5e0f4ede:pantavisor.log:INFO My log line 3 to remember from device:5d555d5e80123b31faa3cff2
pvr logs list the logs with filter options of multiple device,source & level
example2\$ pvr logs 5d555d5e80123b31faa3cff2,5d555d5e80123b31faa3cff5/pantavisor.log,pantavisor2.log@INFO,INFO2#linux,windows
2020-01-06T12:54:17Z 5e0f4ede:windows(pantavisor.log):INFO My log line 1 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:54:43Z 5e0f4ede:windows(pantavisor.log):INFO My log line 1 to remember from device:5d555d5e80123b31faa3cff5
2020-01-06T12:54:53Z 5e0f4ede:windows(antavisor.log):INFO My log line 2 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:55:03Z 5e0f4ede:linux(pantavisor.log):INFO My log line 2 to remember from device:5d555d5e80123b31faa3cff5
2020-01-06T12:55:17Z 5e0f4ede:linux(pantavisor2.log):INFO2 My log line 3 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:55:43Z 5e0f4ede:linux(pantavisor2.log):INFO2 My log line 3 to remember from device:5d555d5e80123b31faa3cff5
2020-01-06T12:55:53Z 5e0f4ede:linux(pantavisor2.log):INFO2 My log line 4 to remember from device:5d555d5e80123b31faa3cff2
2020-01-06T12:56:03Z 5e0f4ede:linux(pantavisor2.log):INFO2 My log line 4 to remember from device:5d555d5e80123b31faa3cff5
pvr logs list the logs with filter options of multiple platforms
example3\$ pvr logs --platform=linux,windows
5ea97febfb( ) May 1 20:28:28 linux(pantavisor.log ): My log line to remember
5ea97febfb( ) May 1 20:28:29 windows(pantavisor.log ): My log line to remember
5ea97febfb( ) May 1 20:28:30 linux(pantavisor.log ): My log line to remember
Also we offer the following template functions:
* sprig funcs: https://github.com/Masterminds/sprig
* sprint FORMAT VALUE: single value string formatter using strformat syntax (e.g. {{ "test1234" | sprintf "%4s" }} => test)
* basename PATH: basename of a given path (e.g. {{ "/path/one" | basename }} => one )
* timeformat TIME: time format for a time field like TimeCreated (e.g. {{ .TimeCreated | timeformat "Stamp" }} => one )
* Any golang time constant is supported, see https://golang.org/pkg/time/#pkg-constants (e.g. ANSIC, UnixDate, ... )
You can also retrieve two mor more parts with , separated (e.g. 'bsp' and $appname) using the fragment (#) notation:
pvr get pantahub-ci/rpi3_initial_latest#bsp,$appname
...
Further can also remove one or multiple parts from repo in the same operation by prefixing the part with a '-', e.g.
the following would get the latest bsp but also remove $appname from the pvr repo
pvr get pantahub-ci/rpi3_initial_latest#bsp,-$appname
...
You can also get from a tarball produced with pvr export:
pvr merge : Merge content of repository into target-directory.Default target-repository is the local .pvr one. If not is provided the last one is used.
pvr self-upgrade : Update pvr command to the latest version
example1$ $ sudo pvr self-upgrade
[sudo] password for nintriva:
Starting update PVR using Docker latest tag (sha256:0d6e747e75758535bdee89657902a1499e449db9510d688e0ef16d3171203975)
Downloading layers 8 ...
Done with [3/8] from repository
Done with [2/8] from repository
Done with [7/8] from repository
Done with [8/8] from repository
Done with [5/8] from repository
Done with [6/8] from repository
Done with [1/8] from repository
Done with [4/8] from repository
Extracting layers 8 ...
Pvr installed on /bin/pvr
Docker layers are going to be cache on: /root/.pvr/cache
PVR has been updated!
pvr checkout|reset : checkout/reset working directory to match the repo stat.reset/checkout also forgets about added files; pvr status and diff will yield empty
pvr register : register new user account with pantahub
example1$ $ pvr register https://api.pantahub.com -e jogn123@gmail.com -u john123 -p 123
Your registration process needs to be complete two steps
1.- Confirm you aren't a bot
2.- Confirm your email address
Follow this link to continue and after that come back and continue
pvr app add creates a new application and generates files by pulling layers from a given docker image in either remote or local docker repo's.
By default it will first look in remote repo. when not found it will pull from local docker repo,the priority can be changed using the --source flag(default:remote,local).
We now can create an app, install an app, and update an app using as source a root filesystem, that filesystem could be as a tar in local for the computer is running the PVR, could be a plain folder with the filesystem inside, or could be an URL where the tar is to be downloaded.
With pvr deploy you can deploy one to many source repos to a deployment directory such as the
one you find on the pantavisor device for each revision.
This command can be used to modify a rootfs and change/replace/update apps.
Example, will deploy the 'os' container from a local repository, the 'bsp' container from a pvr
export to a factory revision (trails/0) in a pantavisor enabled rootfs.
PVR sig commands offers support for maintaining pvs signatures inside your tree.
For details see README.pvs.md
Commands currently supported are:
* Review all object and file usage cases to ensure tall are validated before they are installed/used.
pvr sig add - adds a new signature to the _pvs/ hierarchy of the state
pvr sig update - updates a committed signature from the _pvs/ hierarchy to be validate against committed state
pvr sig ls - list files covered by signatures in sigs/ hieararchy; by default sig ls will show signature info while considering _all signatures in the system state
commit c2d6f1450422b89d90948499c7cd6dd6949e5df3 (HEAD -> feature/pvs-ca, origin/feature/pvs-ca)
Author: Alexander Sack <asac@pantacor.com>
Date: Wed Oct 20 17:58:50 2021 +0200
add support for using x509 cert chains using x5c jws header to determine trust in pvr signatures
* introduce new --x5c argument pvr app sig command to provide the chain to include in pvr sig add and update commands
* introduce --cacerts argument to pvr sig commands to allow to post a trust CACERTS file to use to validate in pvr app ls;
using special value _system will use the system cert store to validate ca chain
* pubkey validation now allows to have multiple trusted pubkeys in the file referenced by --pubkey
* document this feature in README.md
Example 1: "add signature with trust ca chain"
Below statement injects the myKey.crt as the trust chain into the jws.
If you have intermediates your .crt file would need to include those
also in reverse order.
```
pvr sig --x5c ../ca/myKey.crt --key ../ca/myKey.key add --part nginx
```
Example 2: "update signatures with trustchain"
Below will refresh the nginx.json signature and attach myKey.crt as
the trust ca cert chain to validate against root certificates
```
pvr sig --x5c ../ca/myKey.crt --key ../ca/myKey.key update _sigs/nginx.json
```
Example 3: "validate signatures with cert pool in file"
Below you can see how to validate signature with ca cert pool in file myCA.pem.
```
pvr sig --cacerts ../ca/myCA.pem ls --part _sigs/nginx.json
```
Example 4: use system ca cert pool to validate signature
For this you have to put your myCA.pem into one of the system folders for
trusted certificates. e.g. /etc/ssl/certs
```
pvr sig ls --part _sigs/nginx.json
```
pvr device mapper support for container volumes allows for an easy way to
postprocess the squashfs volumes produced by pvr app add etc. in a way that
the pantavisor device mapper addon can mount volumes using device-mapper.
For now dm-verity type device mapper entries are supported by pantavisor
client and hence pvr supports that mode first and foremost for now.
... and also the hash_device in os/root.squashfs.hash.
Also it will convert the volume reference in run.json to "dm:<volume", e.g.
dm:rootfs.squashfs. This syntax will ensure that pantavisor will not try to
mount the squash himself, but rather delegate that to a device-mapper
volume handler.
You can then pvr commit this and post it to a pantavisor device-mapper
enabled device