chore: merge release-v0.1.8 into main

This commit is contained in:
Jack Wills
2022-12-05 02:41:01 +00:00
16 changed files with 236 additions and 127 deletions
+7 -5
View File
@@ -1,11 +1,13 @@
### 2022-11-13 ### 2022-12-05
### Chores ### Chores
+ update dependencies, closes #17, [8a5d0ef8376e3739dda5b0ed4c3e75e565deed45], [eadfc3d6c6896ecc8cff88c6a9e9c8b3e477c0cd] + dependencies updated, [e3aa4420cb510df0381e311d37e768937070387a]
+ aggressive linting with Rust 1.65.0, [8f3a15137155dc374e6b2822c9155c07d05d5e28] + docker-compose.yml alpine bump, [911c6596684db4ccbe7a55aadd6f595a95f89bb0]
+ github workflow use dtolnay/rust-toolchain, [57c18878690477a05d7330112a65d1d58a07901e]
### Docs ### Features
+ README.md improved Download & Install section, and now available on [NixPkg](https://search.nixos.org/packages?channel=unstable&show=oxker&from=0&size=50&sort=relevance&type=packages&query=oxker), thanks [siph](https://github.com/siph), [67a9e183ca04199da758255075ff7e73061eb850] + Clicking a header now toggles between Ascending -> Descending -> Default. Use the containers created_time as the default order - maybe add created column in future version, closes #18, [cf14ba498987db587c0f5bef8a67cf4113ffcb1e], [d1de291473d8a1028f1936429832d3820d75df54]
+ `-s` flag for showing the oxker container when executing the docker image, [c93870e5fbbc7df35c69d32e4460d2104e521e33]
see <a href='https://github.com/mrjackwills/oxker/blob/main/CHANGELOG.md'>CHANGELOG.md</a> for more details see <a href='https://github.com/mrjackwills/oxker/blob/main/CHANGELOG.md'>CHANGELOG.md</a> for more details
+33 -39
View File
@@ -10,74 +10,64 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
#########################
## Publish to crates.io #
#########################
# Publish to crates.io
- name: publish to crates.io - name: publish to crates.io
uses: katyo/publish-crates@v1 uses: katyo/publish-crates@v1
with: with:
registry-token: ${{ secrets.CRATES_IO_TOKEN }} registry-token: ${{ secrets.CRATES_IO_TOKEN }}
####################################
## Build binaries for release page #
####################################
# Install stable rust, and associated tools
- name: install rust
uses: dtolnay/rust-toolchain@stable
# Install cross-rs
- name: install cross
run: cargo install cross --git https://github.com/cross-rs/cross
# Build for linux x86_64 # Build for linux x86_64
- name: build release linux_x86_64 - name: build release linux_x86_64
uses: actions-rs/cargo@v1 run: cargo build --release
with: # Compress ouput into tar
command: build
args: --release
- name: compress oxker_linux_x86_64 binary - name: compress oxker_linux_x86_64 binary
run: tar -C target/release -czf ./oxker_linux_x86_64.tar.gz oxker run: tar -C target/release -czf ./oxker_linux_x86_64.tar.gz oxker
# Build for linux aarch64, aka 64 bit pi 4 # Build for linux aarch64, aka 64 bit pi 4
- name: build release arm64v8 - name: build aarch64-unknown-linux-musl
uses: actions-rs/toolchain@v1 run: cross build --target aarch64-unknown-linux-musl --release
with: # Compress ouput into tar
toolchain: stable
target: aarch64-unknown-linux-musl
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --target aarch64-unknown-linux-musl --release
- name: compress aarch64 binary - name: compress aarch64 binary
run: tar -C target/aarch64-unknown-linux-musl/release -czf ./oxker_linux_aarch64.tar.gz oxker run: tar -C target/aarch64-unknown-linux-musl/release -czf ./oxker_linux_aarch64.tar.gz oxker
# Build for linux armv6, aka 32 bit pi zero w # Build for linux armv6, aka 32 bit pi zero w
- name: build release armv6 - name: build arm-unknown-linux-musleabihf
uses: actions-rs/toolchain@v1 run: cross build --target arm-unknown-linux-musleabihf --release
with: # Compress ouput into tar
toolchain: stable
target: arm-unknown-linux-musleabihf
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --target arm-unknown-linux-musleabihf --release
- name: compress armv6 binary - name: compress armv6 binary
run: tar -C target/arm-unknown-linux-musleabihf/release -czf ./oxker_linux_armv6.tar.gz oxker run: tar -C target/arm-unknown-linux-musleabihf/release -czf ./oxker_linux_armv6.tar.gz oxker
# Build for windows # Build for windows
- name: build release windows_x86_64 - name: build release windows_x86_64
uses: actions-rs/toolchain@v1 run: cross build --target x86_64-pc-windows-gnu --release
with: # Compress ouput into zip
toolchain: stable
target: x86_64-pc-windows-gnu
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --target x86_64-pc-windows-gnu --release
- name: compress windows_x86_64 binary - name: compress windows_x86_64 binary
run: zip -j ./oxker_windows_x86_64.zip target/x86_64-pc-windows-gnu/release/oxker.exe run: zip -j ./oxker_windows_x86_64.zip target/x86_64-pc-windows-gnu/release/oxker.exe
# Build images for Dockerhub ###############################
## Build images for Dockerhub #
###############################
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/setup-buildx-action@v2 - uses: docker/setup-buildx-action@v2
id: buildx id: buildx
with: with:
@@ -89,6 +79,10 @@ jobs:
--push \ --push \
-f containerised/Dockerfile . -f containerised/Dockerfile .
###################
## Create release #
###################
- name: Release - name: Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
+12
View File
@@ -1,3 +1,15 @@
# <a href='https://github.com/mrjackwills/oxker/releases/tag/v0.1.8'>v0.1.8</a>
### 2022-12-05
### Chores
+ dependencies updated, [e3aa4420](https://github.com/mrjackwills/oxker/commit/e3aa4420cb510df0381e311d37e768937070387a)
+ docker-compose.yml alpine bump, [911c6596](https://github.com/mrjackwills/oxker/commit/911c6596684db4ccbe7a55aadd6f595a95f89bb0)
+ github workflow use dtolnay/rust-toolchain, [57c18878](https://github.com/mrjackwills/oxker/commit/57c18878690477a05d7330112a65d1d58a07901e)
### Features
+ Clicking a header now toggles between Ascending -> Descending -> Default. Use the containers created_time as the default order - maybe add created column in future version, closes #18, [cf14ba49](https://github.com/mrjackwills/oxker/commit/cf14ba498987db587c0f5bef8a67cf4113ffcb1e), [d1de2914](https://github.com/mrjackwills/oxker/commit/d1de291473d8a1028f1936429832d3820d75df54)
+ `-s` flag for showing the oxker container when executing the docker image, [c93870e5](https://github.com/mrjackwills/oxker/commit/c93870e5fbbc7df35c69d32e4460d2104e521e33)
# <a href='https://github.com/mrjackwills/oxker/releases/tag/v0.1.7'>v0.1.7</a> # <a href='https://github.com/mrjackwills/oxker/releases/tag/v0.1.7'>v0.1.7</a>
### 2022-11-13 ### 2022-11-13
Generated
+107 -40
View File
@@ -8,17 +8,6 @@ version = "1.0.66"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6"
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.1.0"
@@ -77,9 +66,9 @@ dependencies = [
[[package]] [[package]]
name = "bytes" name = "bytes"
version = "1.2.1" version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c"
[[package]] [[package]]
name = "cansi" name = "cansi"
@@ -93,6 +82,12 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53"
[[package]]
name = "cc"
version = "1.0.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "1.0.0" version = "1.0.0"
@@ -101,14 +96,14 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.0.23" version = "4.0.29"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eb41c13df48950b20eb4cd0eefa618819469df1bffc49d11e8487c4ba0037e5" checksum = "4d63b9e9c07271b9957ad22c173bae2a4d9a81127680962039296abcd2f8251d"
dependencies = [ dependencies = [
"atty",
"bitflags", "bitflags",
"clap_derive", "clap_derive",
"clap_lex", "clap_lex",
"is-terminal",
"once_cell", "once_cell",
"strsim", "strsim",
"termcolor", "termcolor",
@@ -198,6 +193,27 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "errno"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
dependencies = [
"errno-dragonfly",
"libc",
"winapi",
]
[[package]]
name = "errno-dragonfly"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
dependencies = [
"cc",
"libc",
]
[[package]] [[package]]
name = "fnv" name = "fnv"
version = "1.0.7" version = "1.0.7"
@@ -316,6 +332,15 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "hermit-abi"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "hex" name = "hex"
version = "0.4.3" version = "0.4.3"
@@ -411,14 +436,36 @@ dependencies = [
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "1.9.1" version = "1.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"hashbrown", "hashbrown",
] ]
[[package]]
name = "io-lifetimes"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c"
dependencies = [
"libc",
"windows-sys",
]
[[package]]
name = "is-terminal"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330"
dependencies = [
"hermit-abi 0.2.6",
"io-lifetimes",
"rustix",
"windows-sys",
]
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.4" version = "1.0.4"
@@ -433,9 +480,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.137" version = "0.2.138"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
[[package]]
name = "linux-raw-sys"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"
[[package]] [[package]]
name = "lock_api" name = "lock_api"
@@ -490,7 +543,7 @@ version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5"
dependencies = [ dependencies = [
"hermit-abi", "hermit-abi 0.1.19",
"libc", "libc",
] ]
@@ -502,9 +555,9 @@ checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
[[package]] [[package]]
name = "os_str_bytes" name = "os_str_bytes"
version = "6.4.0" version = "6.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b5bf27447411e9ee3ff51186bf7a08e16c341efdde93f4d823e8844429bed7e" checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
[[package]] [[package]]
name = "overload" name = "overload"
@@ -514,7 +567,7 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]] [[package]]
name = "oxker" name = "oxker"
version = "0.1.7" version = "0.1.8"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bollard", "bollard",
@@ -542,9 +595,9 @@ dependencies = [
[[package]] [[package]]
name = "parking_lot_core" name = "parking_lot_core"
version = "0.9.4" version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
@@ -678,6 +731,20 @@ dependencies = [
"bitflags", "bitflags",
] ]
[[package]]
name = "rustix"
version = "0.36.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb93e85278e08bb5788653183213d3a60fc242b10cb9be96586f5a73dcb67c23"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys",
]
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.11" version = "1.0.11"
@@ -692,18 +759,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.147" version = "1.0.148"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.147" version = "1.0.148"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -712,9 +779,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.87" version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@@ -827,9 +894,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.103" version = "1.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -891,9 +958,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.21.2" version = "1.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"bytes", "bytes",
@@ -911,9 +978,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio-macros" name = "tokio-macros"
version = "1.8.0" version = "1.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1072,9 +1139,9 @@ dependencies = [
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.2.1" version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "feb41e78f93363bb2df8b0e86a2ca30eed7806ea16ea0c790d757cf93f79be83" checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c"
dependencies = [ dependencies = [
"getrandom", "getrandom",
"rand", "rand",
+2 -2
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "oxker" name = "oxker"
version = "0.1.7" version = "0.1.8"
edition = "2021" edition = "2021"
authors = ["Jack Wills <email@mrjackwills.com>"] authors = ["Jack Wills <email@mrjackwills.com>"]
description = "A simple tui to view & control docker containers" description = "A simple tui to view & control docker containers"
@@ -19,7 +19,7 @@ clap={version="4.0", features = ["derive", "unicode", "color"] }
crossterm = "0.25" crossterm = "0.25"
futures-util = "0.3" futures-util = "0.3"
parking_lot = {version= "0.12"} parking_lot = {version= "0.12"}
tokio = {version = "1.21", features=["full"]} tokio = {version = "1.22", features=["full"]}
tracing = "0.1" tracing = "0.1"
tracing-subscriber = "0.3" tracing-subscriber = "0.3"
tui = "0.19" tui = "0.19"
+1
View File
@@ -73,6 +73,7 @@ Available command line arguments
|```-r```| show raw logs, by default oxker will remove ANSI formatting (conflicts with -c) | |```-r```| show raw logs, by default oxker will remove ANSI formatting (conflicts with -c) |
|```-c```| attempt to color the logs (conflicts with -r) | |```-c```| attempt to color the logs (conflicts with -r) |
|```-t```| remove timestamps from each log entry | |```-t```| remove timestamps from each log entry |
|```-s```| if running via docker, will show the oxker container |
|```-g```| no tui, basically a pointless debugging mode, for now | |```-g```| no tui, basically a pointless debugging mode, for now |
## Build step ## Build step
+2 -1
View File
@@ -31,7 +31,7 @@ WORKDIR /usr/src/oxker
# Install target platform (Cross-Compilation) # Install target platform (Cross-Compilation)
RUN rustup target add $(cat /.platform) RUN rustup target add $(cat /.platform)
# This is a dummy build to get the dependencies cached # This is a dummy build to get the dependencies cached - probably not needed - as run via a github action
RUN cargo build --target $(cat /.platform) --release RUN cargo build --target $(cat /.platform) --release
# Now copy in the rest of the sources # Now copy in the rest of the sources
@@ -56,4 +56,5 @@ COPY --from=builder /oxker /usr/local/bin
COPY ./containerised/start_oxker.sh ./ COPY ./containerised/start_oxker.sh ./
# Run the application # Run the application
# this is used in the application itself, to stop itself show when running from a docker container, so DO NOT EDIT
ENTRYPOINT [ "./start_oxker.sh"] ENTRYPOINT [ "./start_oxker.sh"]
+6 -3
View File
@@ -8,13 +8,16 @@ FROM alpine:latest AS runtime
COPY ./target/x86_64-unknown-linux-musl/release/oxker /usr/local/bin COPY ./target/x86_64-unknown-linux-musl/release/oxker /usr/local/bin
COPY ./containerised/start_oxker.sh ./ COPY ./containerised/start_oxker.sh ./
## Run the application # Run the application
# this is used in the application itself, to stop itself show when running from a docker container, so DO NOT EDIT
ENTRYPOINT [ "./start_oxker.sh"] ENTRYPOINT [ "./start_oxker.sh"]
## One liner to build musl program, build docker image, then execute the image ## One liner to build musl program, build docker image, then execute the image
# cargo build --release --target x86_64-unknown-linux-musl && docker build -t oxker_dev -f containerised/Dockerfile_dev . && docker run --rm -it --volume /var/run/docker.sock:/var/run/docker.sock:ro oxker_dev # cargo build --release --target x86_64-unknown-linux-musl && docker build -t oxker_dev -f containerised/Dockerfile . && docker run --rm -it --volume /var/run/docker.sock:/var/run/docker.sock:ro oxker_dev
# Build production version
# docker build --platform linux/arm/v6 --platform linux/arm64 --platform linux/amd64 -t oxker_dev -f containerised/Dockerfile . && docker run --rm -it --volume /var/run/docker.sock:/var/run/docker.sock:ro oxker_dev
## Buildx command to build musl version for all three platforms, should probably be executed in create_release # Buildx command to build musl version for all three platforms, should probably be executed in create_release
# docker buildx create --use # docker buildx create --use
# docker buildx build --platform linux/arm/v6,linux/arm64,linux/amd64 -t oxker_dev_all -o type=tar,dest=/tmp/oxker_dev_all.tar -f containerised/Dockerfile . # docker buildx build --platform linux/arm/v6,linux/arm64,linux/amd64 -t oxker_dev_all -o type=tar,dest=/tmp/oxker_dev_all.tar -f containerised/Dockerfile .
+3 -3
View File
@@ -104,12 +104,12 @@ update_release_body_and_changelog () {
echo -e "# <a href='${GIT_REPO_URL}/releases/tag/${NEW_TAG_WITH_V}'>${NEW_TAG_WITH_V}</a>\n${DATE_SUBHEADING}${CHANGELOG_ADDITION}$(cat CHANGELOG.md)" > CHANGELOG.md echo -e "# <a href='${GIT_REPO_URL}/releases/tag/${NEW_TAG_WITH_V}'>${NEW_TAG_WITH_V}</a>\n${DATE_SUBHEADING}${CHANGELOG_ADDITION}$(cat CHANGELOG.md)" > CHANGELOG.md
# Update changelog to add links to commits [hex:8](url_with_full_commit) # Update changelog to add links to commits [hex:8](url_with_full_commit)
# "[aaaaaaaaaabbbbbbbbbbccccccccccddddddddd]" -> "[aaaaaaaa](https:/www.../commit/aaaaaaaaaabbbbbbbbbbccccccccccddddddddd)," # "[aaaaaaaaaabbbbbbbbbbccccccccccddddddddd]" -> "[aaaaaaaa](https:/www.../commit/aaaaaaaaaabbbbbbbbbbccccccccccddddddddd)"
sed -i -E "s=(\s)\[([0-9a-f]{8})([0-9a-f]{32})\]= [\2](${GIT_REPO_URL}/commit/\2\3)=g" ./CHANGELOG.md sed -i -E "s=(\s)\[([0-9a-f]{8})([0-9a-f]{32})\]= [\2](${GIT_REPO_URL}/commit/\2\3)=g" ./CHANGELOG.md
# Update changelog to add links to closed issues - comma included! # Update changelog to add links to closed issues - comma included!
# "closes #1," -> "closes [#1](https:/www.../issues/1),"" # "closes #1" -> "closes [#1](https:/www.../issues/1),""
sed -i -r -E "s=closes \#([0-9]+)\,=closes [#\1](${GIT_REPO_URL}/issues/\1),=g" ./CHANGELOG.md sed -i -r -E "s=closes \#([0-9]+)\=closes [#\1](${GIT_REPO_URL}/issues/\1)=g" ./CHANGELOG.md
} }
# update version in cargo.toml, to match selected current version # update version in cargo.toml, to match selected current version
+2 -2
View File
@@ -4,7 +4,7 @@ networks:
name: oxker-examaple-net name: oxker-examaple-net
services: services:
postgres: postgres:
image: postgres:alpine3.16 image: postgres:alpine3.17
container_name: postgres container_name: postgres
environment: environment:
- POSTGRES_PASSWORD=never_use_this_password_in_production - POSTGRES_PASSWORD=never_use_this_password_in_production
@@ -18,7 +18,7 @@ services:
limits: limits:
memory: 128M memory: 128M
redis: redis:
image: redis:alpine3.16 image: redis:alpine3.17
container_name: redis container_name: redis
ipc: private ipc: private
restart: always restart: always
+12 -3
View File
@@ -356,6 +356,7 @@ pub type CpuTuple = (Vec<(f64, f64)>, CpuStats, State);
/// Info for each container /// Info for each container
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct ContainerItem { pub struct ContainerItem {
pub created: u64,
pub cpu_stats: VecDeque<CpuStats>, pub cpu_stats: VecDeque<CpuStats>,
pub docker_controls: StatefulList<DockerControls>, pub docker_controls: StatefulList<DockerControls>,
pub id: ContainerId, pub id: ContainerId,
@@ -366,19 +367,27 @@ pub struct ContainerItem {
pub mem_stats: VecDeque<ByteStats>, pub mem_stats: VecDeque<ByteStats>,
pub name: String, pub name: String,
pub rx: ByteStats, pub rx: ByteStats,
pub tx: ByteStats,
pub state: State, pub state: State,
pub status: String, pub status: String,
pub tx: ByteStats,
} }
impl ContainerItem { impl ContainerItem {
/// Create a new container item /// Create a new container item
pub fn new(id: ContainerId, status: String, image: String, state: State, name: String) -> Self { pub fn new(
id: ContainerId,
status: String,
image: String,
state: State,
name: String,
created: u64,
) -> Self {
let mut docker_controls = StatefulList::new(DockerControls::gen_vec(state)); let mut docker_controls = StatefulList::new(DockerControls::gen_vec(state));
docker_controls.start(); docker_controls.start();
let mut logs = StatefulList::new(vec![]); let mut logs = StatefulList::new(vec![]);
logs.end(); logs.end();
Self { Self {
created,
cpu_stats: VecDeque::with_capacity(60), cpu_stats: VecDeque::with_capacity(60),
docker_controls, docker_controls,
id, id,
@@ -389,9 +398,9 @@ impl ContainerItem {
mem_stats: VecDeque::with_capacity(60), mem_stats: VecDeque::with_capacity(60),
name, name,
rx: ByteStats::default(), rx: ByteStats::default(),
tx: ByteStats::default(),
state, state,
status, status,
tx: ByteStats::default(),
} }
} }
+20 -9
View File
@@ -11,10 +11,10 @@ pub use container_state::*;
/// Global app_state, stored in an Arc<Mutex> /// Global app_state, stored in an Arc<Mutex>
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct AppData { pub struct AppData {
args: CliArgs,
error: Option<AppError>, error: Option<AppError>,
logs_parsed: bool, logs_parsed: bool,
sorted_by: Option<(Header, SortedOrder)>, sorted_by: Option<(Header, SortedOrder)>,
pub args: CliArgs,
pub containers: StatefulList<ContainerItem>, pub containers: StatefulList<ContainerItem>,
} }
@@ -171,19 +171,20 @@ impl AppData {
output output
} }
/// Sort the containers vec, based on a heading, either ascending or descending /// Sort the containers vec, based on a heading, either ascending or descending,
pub fn sort_containers(&mut self) { /// If not sort set, then sort by created time
if let Some((head, ord)) = self.sorted_by.as_ref() { fn sort_containers(&mut self) {
if let Some((head, ord)) = self.sorted_by {
match head { match head {
Header::State => match ord { Header::State => match ord {
SortedOrder::Desc => self
.containers
.items
.sort_by(|a, b| a.state.order().cmp(&b.state.order())),
SortedOrder::Asc => self SortedOrder::Asc => self
.containers .containers
.items .items
.sort_by(|a, b| b.state.order().cmp(&a.state.order())), .sort_by(|a, b| b.state.order().cmp(&a.state.order())),
SortedOrder::Desc => self
.containers
.items
.sort_by(|a, b| a.state.order().cmp(&b.state.order())),
}, },
Header::Status => match ord { Header::Status => match ord {
SortedOrder::Asc => self SortedOrder::Asc => self
@@ -238,6 +239,10 @@ impl AppData {
SortedOrder::Desc => self.containers.items.sort_by(|a, b| b.tx.cmp(&a.tx)), SortedOrder::Desc => self.containers.items.sort_by(|a, b| b.tx.cmp(&a.tx)),
}, },
} }
} else {
self.containers
.items
.sort_by(|a, b| a.created.cmp(&b.created))
} }
} }
@@ -428,9 +433,13 @@ impl AppData {
pub fn update_containers(&mut self, all_containers: &mut [ContainerSummary]) { pub fn update_containers(&mut self, all_containers: &mut [ContainerSummary]) {
let all_ids = self.get_all_ids(); let all_ids = self.get_all_ids();
// Sort the containes by created, that have a constant order
all_containers.sort_by(|a, b| a.created.cmp(&b.created));
if !all_containers.is_empty() && self.containers.state.selected().is_none() { if !all_containers.is_empty() && self.containers.state.selected().is_none() {
self.containers.start(); self.containers.start();
} }
let now = Self::get_systemtime();
for (index, id) in all_ids.iter().enumerate() { for (index, id) in all_ids.iter().enumerate() {
if !all_containers if !all_containers
@@ -472,6 +481,8 @@ impl AppData {
.map_or(String::new(), std::clone::Clone::clone); .map_or(String::new(), std::clone::Clone::clone);
let id = ContainerId::from(id); let id = ContainerId::from(id);
let created = i.created.map_or(now, |i| u64::try_from(i).unwrap_or(now));
// If container info already in containers Vec, then just update details // If container info already in containers Vec, then just update details
if let Some(item) = self.get_container_by_id(&id) { if let Some(item) = self.get_container_by_id(&id) {
if item.name != name { if item.name != name {
@@ -496,7 +507,7 @@ impl AppData {
}; };
// else container not known, so make new ContainerItem and push into containers Vec // else container not known, so make new ContainerItem and push into containers Vec
} else { } else {
let container = ContainerItem::new(id, status, image, state, name); let container = ContainerItem::new(id, status, image, state, name, created);
self.containers.items.push(container); self.containers.items.push(container);
} }
} }
+13 -11
View File
@@ -51,14 +51,14 @@ impl Binate {
pub struct DockerData { pub struct DockerData {
app_data: Arc<Mutex<AppData>>, app_data: Arc<Mutex<AppData>>,
args: CliArgs,
binate: Binate,
docker: Arc<Docker>, docker: Arc<Docker>,
gui_state: Arc<Mutex<GuiState>>, gui_state: Arc<Mutex<GuiState>>,
initialised: bool, initialised: bool,
is_running: Arc<AtomicBool>, is_running: Arc<AtomicBool>,
receiver: Receiver<DockerMessage>, receiver: Receiver<DockerMessage>,
spawns: Arc<Mutex<HashMap<SpawnId, JoinHandle<()>>>>, spawns: Arc<Mutex<HashMap<SpawnId, JoinHandle<()>>>>,
timestamps: bool,
binate: Binate,
} }
impl DockerData { impl DockerData {
@@ -173,7 +173,7 @@ impl DockerData {
/// Get all current containers, handle into ContainerItem in the app_data struct rather than here /// Get all current containers, handle into ContainerItem in the app_data struct rather than here
/// Just make sure that items sent are guaranteed to have an id /// Just make sure that items sent are guaranteed to have an id
/// Will ignore any container that contains `oxker` as an entry point /// Will ignore any container that uses `./start_oxker.sh` as an entry point, unless the `-s` flag is set
pub async fn update_all_containers(&mut self) -> Vec<(bool, ContainerId)> { pub async fn update_all_containers(&mut self) -> Vec<(bool, ContainerId)> {
let containers = self let containers = self
.docker .docker
@@ -188,7 +188,11 @@ impl DockerData {
.into_iter() .into_iter()
.filter_map(|f| match f.id { .filter_map(|f| match f.id {
Some(_) => { Some(_) => {
if f.command.as_ref().map_or(false, |c| c.contains("oxker")) { if f.command
.as_ref()
.map_or(false, |c| c.starts_with("./start_oxker.sh"))
&& self.args.show_self
{
None None
} else { } else {
Some(f) Some(f)
@@ -200,9 +204,6 @@ impl DockerData {
self.app_data.lock().update_containers(&mut output); self.app_data.lock().update_containers(&mut output);
let current_sort = self.app_data.lock().get_sorted();
self.app_data.lock().set_sorted(current_sort);
// Just get the containers that are currently running, or being restarted, no point updating info on paused or dead containers // Just get the containers that are currently running, or being restarted, no point updating info on paused or dead containers
output output
.into_iter() .into_iter()
@@ -263,7 +264,7 @@ impl DockerData {
tokio::spawn(Self::update_log( tokio::spawn(Self::update_log(
docker, docker,
id.clone(), id.clone(),
self.timestamps, self.args.timestamp,
0, 0,
app_data, app_data,
spawns, spawns,
@@ -288,7 +289,7 @@ impl DockerData {
tokio::spawn(Self::update_log( tokio::spawn(Self::update_log(
docker, docker,
container.id.clone(), container.id.clone(),
self.timestamps, self.args.timestamp,
container.last_updated, container.last_updated,
app_data, app_data,
spawns, spawns,
@@ -323,6 +324,7 @@ impl DockerData {
let loading_spin = self.loading_spin(loading_uuid).await; let loading_spin = self.loading_spin(loading_uuid).await;
let all_ids = self.update_all_containers().await; let all_ids = self.update_all_containers().await;
self.update_all_container_stats(&all_ids); self.update_all_container_stats(&all_ids);
// Maybe only do a single one at first? // Maybe only do a single one at first?
@@ -410,22 +412,22 @@ impl DockerData {
/// Initialise self, and start the message receiving loop /// Initialise self, and start the message receiving loop
pub async fn init( pub async fn init(
args: CliArgs,
app_data: Arc<Mutex<AppData>>, app_data: Arc<Mutex<AppData>>,
docker: Arc<Docker>, docker: Arc<Docker>,
gui_state: Arc<Mutex<GuiState>>, gui_state: Arc<Mutex<GuiState>>,
receiver: Receiver<DockerMessage>, receiver: Receiver<DockerMessage>,
is_running: Arc<AtomicBool>, is_running: Arc<AtomicBool>,
) { ) {
let args = app_data.lock().args;
if app_data.lock().get_error().is_none() { if app_data.lock().get_error().is_none() {
let mut inner = Self { let mut inner = Self {
app_data, app_data,
args,
docker, docker,
gui_state, gui_state,
initialised: false, initialised: false,
receiver, receiver,
spawns: Arc::new(Mutex::new(HashMap::new())), spawns: Arc::new(Mutex::new(HashMap::new())),
timestamps: args.timestamp,
is_running, is_running,
binate: Binate::One, binate: Binate::One,
}; };
+9 -6
View File
@@ -121,13 +121,16 @@ impl InputHandler {
self.mouse_capture = !self.mouse_capture; self.mouse_capture = !self.mouse_capture;
} }
/// Sort containers based on a given header, switch asc to desc if already sorted, else always desc /// Sort containers based on a given header, if headings match, and already ascending, remove sorting
fn sort(&self, header: Header) { fn sort(&self, selected_header: Header) {
let mut output = Some((header, SortedOrder::Desc));
let mut locked_data = self.app_data.lock(); let mut locked_data = self.app_data.lock();
if let Some((h, order)) = locked_data.get_sorted().as_ref() { let mut output = Some((selected_header, SortedOrder::Asc));
if &SortedOrder::Desc == order && h == &header { if let Some((current_header, order)) = locked_data.get_sorted() {
output = Some((header, SortedOrder::Asc)); if current_header == selected_header {
match order {
SortedOrder::Desc => output = None,
SortedOrder::Asc => output = Some((selected_header, SortedOrder::Desc)),
}
} }
} }
locked_data.set_sorted(output); locked_data.set_sorted(output);
-1
View File
@@ -50,7 +50,6 @@ async fn main() {
let docker = Arc::new(docker); let docker = Arc::new(docker);
let is_running = Arc::clone(&is_running); let is_running = Arc::clone(&is_running);
tokio::spawn(DockerData::init( tokio::spawn(DockerData::init(
args,
docker_app_data, docker_app_data,
docker, docker,
docker_gui_state, docker_gui_state,
+5
View File
@@ -23,6 +23,10 @@ pub struct CliArgs {
#[clap(short = 'r', conflicts_with = "color")] #[clap(short = 'r', conflicts_with = "color")]
pub raw: bool, pub raw: bool,
/// Show self when running as a docker container
#[clap(short = 's')]
pub show_self: bool,
/// Don't draw gui - for debugging - mostly pointless /// Don't draw gui - for debugging - mostly pointless
#[clap(short = 'g')] #[clap(short = 'g')]
pub gui: bool, pub gui: bool,
@@ -43,6 +47,7 @@ impl CliArgs {
color: args.color, color: args.color,
docker_interval: args.docker_interval, docker_interval: args.docker_interval,
gui: !args.gui, gui: !args.gui,
show_self: !args.show_self,
raw: args.raw, raw: args.raw,
timestamp: !args.timestamp, timestamp: !args.timestamp,
} }