diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0efedc9..5dca4c6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,7 +7,8 @@ "args": { // Use the VARIANT arg to pick a Debian OS version: buster, bullseye // Use bullseye when on local on arm64/Apple Silicon. - "VARIANT": "bullseye" + "VARIANT": "bullseye", + "BUILDKIT_INLINE_CACHE": "0" } }, "runArgs": [ @@ -16,41 +17,49 @@ "seccomp=unconfined" ], - "postCreateCommand": "cargo install cross", + "postCreateCommand": "cargo install cross typos-cli", "mounts": [ "source=/etc/timezone,target=/etc/timezone,type=bind,readonly" ], - // Set *default* container specific settings.json values on container create. - "settings": { - "lldb.executable": "/usr/bin/lldb", - // VS Code don't watch files under ./target - "files.watcherExclude": { - "**/target/**": true - }, - "rust-analyzer.checkOnSave.command": "clippy" + "customizations": { + "vscode": { + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "bmuskalla.vscode-tldr", + "christian-kohler.path-intellisense", + "ms-vscode.live-server", + "mutantdino.resourcemonitor", + "rangav.vscode-thunder-client", + "rust-lang.rust-analyzer", + "serayuzgur.crates", + "tamasfe.even-better-toml", + "timonwong.shellcheck", + "vadimcn.vscode-lldb" + ], + + // Set *default* container specific settings.json values on container create. + "settings": { + "lldb.executable": "/usr/bin/lldb", + // VS Code don't watch files under ./target + "files.watcherExclude": { + "**/target/**": true + }, + "rust-analyzer.checkOnSave.command": "clippy" + } + } }, - - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "vadimcn.vscode-lldb", - "mutantdino.resourcemonitor", - "rust-lang.rust-analyzer", - "tamasfe.even-better-toml", - "serayuzgur.crates", - "christian-kohler.path-intellisense", - "timonwong.shellcheck", - "ms-vscode.live-server", - "rangav.vscode-thunder-client", - "bmuskalla.vscode-tldr" - ], - - // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode", "features": { - "docker-in-docker": "latest", - "git": "os-provided" + "ghcr.io/devcontainers/features/docker-in-docker:2": { + "version": "latest", + "moby": true, + "dockerDashComposeVersion":"v2" + }, + "ghcr.io/devcontainers/features/git:1": { + "version":"os-provided" + } } } \ No newline at end of file diff --git a/.github/release-body.md b/.github/release-body.md index dae66a3..fb82468 100644 --- a/.github/release-body.md +++ b/.github/release-body.md @@ -1,22 +1,17 @@ -### 2023-01-29 +### 2023-02-04 ### Chores -+ dependencies updated, [c129f474fe2976454b1868d00e8d7d99b87ec23b], [9788b8afd98e59b1d4412a8adc54b34d2c5671fd], [2ab88eb26e9bbbc4dad4651256d8d9b044ea3272] ++ devcontainer.json updated, typos-cli installed, temporary(?) buildkit fix, [3c6a8db6ef74d499b49fabe8912785cac16d9c4b] ++ create_release.sh check for typos, [310a63f4cabaa374797a7e4ed0d7fd1f5e79c8fe] ### Docs -+ comment typo, [1025579138f11e4987263c7bfe936c4c8542f8b3] ++ AUR install instructions, thanks [orhun](https://github.com/orhun), [c5aa346bca139cc5ece1f4127293977924d16fca] ++ typos fixes, thanks [kianmeng](https://github.com/kianmeng), [5052d7ab0a156c43cadbd922c0019b284f24943a] ++ Readme.md styling tweak, [310a63f4cabaa374797a7e4ed0d7fd1f5e79c8fe] ++ Contributing guide, [5aaa00d6a3c58d98cb250b7b14584238df02961c], [a44b15f76088561a0e272d4e7456197c2aaabdb4] -### Fixes -+ deadlock on draw logs when no containers found, [68e444bfc393eb46bac2b99eb57697bb9b0451af] -+ github workflow release on main only (with semver tag), [e4ca41dfd8ec3acae202a2d2464b8e18f5c5bdd5], [749ec712f07cff2c941aed6726c56bdbd5cb8d2c] - -### Refactors -+ major refactor of internal data handling, [b4488e4bdb0252f5c5680cee6a46427f22a282ab] -+ needless (double) referencing removed, [a174dafe1b05908735680a874dc551a86da24777] -+ app_data methods re-ordered & renamed, [c0bb5355d6a5d352260655110ce3d5ab695acda9] - -### Reverts -+ is_running AtomicBool back to SeqCst, [c4d80061dab94afd08d4d793dc147f878c965ad6] +### Features ++ Use a scratch container for the docker image, should reduce image size by around 60%. This checks for the ENV `OXKER_RUNTIME=container`, which is automatically set by the docker image, [17b71b6b41f6a98a0f92277f40a88f4b1b8a1328] see CHANGELOG.md for more details diff --git a/.github/workflows/create_release_and_build.yml b/.github/workflows/create_release_and_build.yml index 253058a..118944d 100644 --- a/.github/workflows/create_release_and_build.yml +++ b/.github/workflows/create_release_and_build.yml @@ -40,28 +40,28 @@ jobs: # Build for linux x86_64 - name: build release linux_x86_64 run: cargo build --release - # Compress ouput into tar + # Compress output into tar - name: compress oxker_linux_x86_64 binary run: tar -C target/release -czf ./oxker_linux_x86_64.tar.gz oxker # Build for linux aarch64, aka 64 bit pi 4 - name: build aarch64-unknown-linux-musl run: cross build --target aarch64-unknown-linux-musl --release - # Compress ouput into tar + # Compress output into tar - name: compress aarch64 binary 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 - name: build arm-unknown-linux-musleabihf run: cross build --target arm-unknown-linux-musleabihf --release - # Compress ouput into tar + # Compress output into tar - name: compress armv6 binary run: tar -C target/arm-unknown-linux-musleabihf/release -czf ./oxker_linux_armv6.tar.gz oxker # Build for windows - name: build release windows_x86_64 run: cross build --target x86_64-pc-windows-gnu --release - # Compress ouput into zip + # Compress output into zip - name: compress windows_x86_64 binary run: zip -j ./oxker_windows_x86_64.zip target/x86_64-pc-windows-gnu/release/oxker.exe diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c5bd32..c70df5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +# v0.2.2 +### 2023-02-04 + +### Chores ++ devcontainer.json updated, typos-cli installed, temporary(?) buildkit fix, [3c6a8db6](https://github.com/mrjackwills/oxker/commit/3c6a8db6ef74d499b49fabe8912785cac16d9c4b) ++ create_release.sh check for typos, [310a63f4](https://github.com/mrjackwills/oxker/commit/310a63f4cabaa374797a7e4ed0d7fd1f5e79c8fe) + +### Docs ++ AUR install instructions, thanks [orhun](https://github.com/orhun), [c5aa346b](https://github.com/mrjackwills/oxker/commit/c5aa346bca139cc5ece1f4127293977924d16fca) ++ typos fixes, thanks [kianmeng](https://github.com/kianmeng), [5052d7ab](https://github.com/mrjackwills/oxker/commit/5052d7ab0a156c43cadbd922c0019b284f24943a) ++ Readme.md styling tweak, [310a63f4](https://github.com/mrjackwills/oxker/commit/310a63f4cabaa374797a7e4ed0d7fd1f5e79c8fe) ++ Contributing guide, [5aaa00d6](https://github.com/mrjackwills/oxker/commit/5aaa00d6a3c58d98cb250b7b14584238df02961c), [a44b15f7](https://github.com/mrjackwills/oxker/commit/a44b15f76088561a0e272d4e7456197c2aaabdb4) + +### Features ++ Use a scratch container for the docker image, should reduce image size by around 60%. This checks for the ENV `OXKER_RUNTIME=container`, which is automatically set by the docker image, [17b71b6b](https://github.com/mrjackwills/oxker/commit/17b71b6b41f6a98a0f92277f40a88f4b1b8a1328) + # v0.2.1 ### 2023-01-29 @@ -256,7 +272,7 @@ ### 2022-04-29 ### Features -+ allow toggling of mouse caputre, to select & copy text with mouse, closes [#2](https://github.com/mrjackwills/oxker/issues/2), [aec184ea](https://github.com/mrjackwills/oxker/commit/aec184ea22b289e91942a4c3e6a415685884bc47), ++ allow toggling of mouse capture, to select & copy text with mouse, closes [#2](https://github.com/mrjackwills/oxker/issues/2), [aec184ea](https://github.com/mrjackwills/oxker/commit/aec184ea22b289e91942a4c3e6a415685884bc47), + show id column, [b10f9274](https://github.com/mrjackwills/oxker/commit/b10f927481c9e38a48c1d4b94e744ec48e8b6ba6), + draw_popup, using enum to draw in one of 9 areas, closes [#6](https://github.com/mrjackwills/oxker/issues/6), [1017850a](https://github.com/mrjackwills/oxker/commit/1017850a6cc91328abc1127bdb117495f5e909d8), + use a message rx/sx for all docker commands, remove update loop, wait for update message from gui instead, [9b70fdfa](https://github.com/mrjackwills/oxker/commit/9b70fdfad7b38361ebee301bdc2545d3f0dfcf9e), diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..ebfa982 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,14 @@ +# Contributing to oxker + +oxker encourages any, and all, suggestions, bug reports, pull requests, and/or feedback. + +## Submitting Issues + +Please use the oxker [issue templates for](https://github.com/mrjackwills/oxker/issues/new/choose) any Bug Report, Feature Suggestions, +Refactor Idea, or Security Vulnerabilities. + +Don't hesitate to submit any issues or pull requests, regardless of size. + +## Conduct + +oxker follow the [Rust Code of Conduct](https://www.rust-lang.org/policies/code-of-conduct) \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index e6dc54d..f7785bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -88,9 +88,9 @@ checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "bytes" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "cansi" @@ -227,9 +227,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322296e2f2e5af4270b54df9e85a02ff037e271af20ba3e7fe1575515dc840b8" +checksum = "bc831ee6a32dd495436e317595e639a587aa9907bef96fe6e6abc290ab6204e9" dependencies = [ "cc", "cxxbridge-flags", @@ -239,9 +239,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "017a1385b05d631e7875b1f151c9f012d37b53491e2a87f65bff5c262b2111d8" +checksum = "94331d54f1b1a8895cd81049f7eaaaef9d05a7dcb4d1fd08bf3ff0806246789d" dependencies = [ "cc", "codespan-reporting", @@ -254,15 +254,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c26bbb078acf09bc1ecda02d4223f03bdd28bd4874edcb0379138efc499ce971" +checksum = "48dcd35ba14ca9b40d6e4b4b39961f23d835dbb8eed74565ded361d93e1feb8a" [[package]] name = "cxxbridge-macro" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357f40d1f06a24b60ae1fe122542c1fb05d28d32acb2aed064e84bc2ad1e252e" +checksum = "81bbeb29798b407ccd82a3324ade1a7286e0d29851475990b612670f6f5124d2" dependencies = [ "proc-macro2", "quote", @@ -307,24 +307,24 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" dependencies = [ "proc-macro2", "quote", @@ -333,21 +333,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" +checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" dependencies = [ "futures-core", "futures-macro", @@ -395,9 +395,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -408,6 +408,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "856b5cb0902c2b6d65d5fd97dfa30f9b70c7538e770b98eab5ed52d8db923e01" + [[package]] name = "hex" version = "0.4.3" @@ -450,9 +456,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.23" +version = "0.14.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" +checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" dependencies = [ "bytes", "futures-channel", @@ -532,24 +538,24 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" +checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] name = "is-terminal" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.0", "io-lifetimes", "rustix", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] @@ -560,9 +566,9 @@ checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" dependencies = [ "wasm-bindgen", ] @@ -628,7 +634,7 @@ dependencies = [ "libc", "log", "wasi", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -666,7 +672,7 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] @@ -690,7 +696,7 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "oxker" -version = "0.2.1" +version = "0.2.2" dependencies = [ "anyhow", "bollard", @@ -718,15 +724,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.6" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] @@ -856,16 +862,16 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.7" +version = "0.36.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fdebc4b395b7fbb9ab11e462e20ed9051e7b16e42d24042c776eca0ac81b03" +checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" dependencies = [ "bitflags", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] @@ -1112,15 +1118,15 @@ dependencies = [ [[package]] name = "tinyvec_macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.24.2" +version = "1.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb" +checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" dependencies = [ "autocfg", "bytes", @@ -1133,7 +1139,7 @@ dependencies = [ "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -1276,9 +1282,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "unicode-width" @@ -1299,9 +1305,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c" +checksum = "1674845326ee10d37ca60470760d4288a6f80f304007d92e5c53bab78c9cfd79" dependencies = [ "getrandom", "rand", @@ -1337,9 +1343,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1347,9 +1353,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" dependencies = [ "bumpalo", "log", @@ -1362,9 +1368,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1372,9 +1378,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", @@ -1385,9 +1391,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "winapi" @@ -1435,6 +1441,30 @@ dependencies = [ "windows_x86_64_msvc", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.1" diff --git a/Cargo.toml b/Cargo.toml index 2b3cc38..2521eb8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oxker" -version = "0.2.1" +version = "0.2.2" edition = "2021" authors = ["Jack Wills "] description = "A simple tui to view & control docker containers" @@ -19,11 +19,11 @@ clap={version="4.1", features = ["derive", "unicode", "color"] } crossterm = "0.26" futures-util = "0.3" parking_lot = {version= "0.12"} -tokio = {version = "1.24", features=["full"]} +tokio = {version = "1.25", features=["full"]} tracing = "0.1" tracing-subscriber = "0.3" tui = "0.19" -uuid = {version = "1.2", features = ["v4", "fast-rng"]} +uuid = {version = "1.3", features = ["v4", "fast-rng"]} [dev-dependencies] diff --git a/README.md b/README.md index ea806f9..ae54143 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@

+

+


oxker

A simple tui to view & control docker containers
@@ -132,8 +134,8 @@ using docker-compose.yml; or individually -```docker run --name redis -d redis:alpine3.16``` +```docker run --name redis -d redis:alpine3.17``` -```docker run --name postgres -e POSTGRES_PASSWORD=never_use_this_password_in_production -d postgres:alpine3.16``` +```docker run --name postgres -e POSTGRES_PASSWORD=never_use_this_password_in_production -d postgres:alpine3.17``` ```docker run -d --hostname my-rabbit --name rabbitmq rabbitmq:3``` diff --git a/containerised/DOCKERHUB_README.md b/containerised/DOCKERHUB_README.md index d073b02..7e8f51c 100644 --- a/containerised/DOCKERHUB_README.md +++ b/containerised/DOCKERHUB_README.md @@ -1,6 +1,8 @@

+

+

oxker

A simple tui to view & control docker containers diff --git a/containerised/Dockerfile b/containerised/Dockerfile index 525ea7d..9d0fe10 100644 --- a/containerised/Dockerfile +++ b/containerised/Dockerfile @@ -51,10 +51,12 @@ RUN cp /usr/src/oxker/target/$(cat /.platform)/release/oxker / FROM alpine:latest AS runtime +# Set an ENV that we're running in a container, so that the application can sleep for 250ms at start +ENV OXKER_RUNTIME=container + # Copy application binary from builder image COPY --from=builder /oxker /usr/local/bin -COPY ./containerised/start_oxker.sh ./ # 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 [ "./app/oxker"] diff --git a/containerised/Dockerfile_dev b/containerised/Dockerfile_dev index 4a91c38..77a5522 100644 --- a/containerised/Dockerfile_dev +++ b/containerised/Dockerfile_dev @@ -1,16 +1,23 @@ ############# ## Runtime ## ############# +FROM scratch -FROM alpine:latest AS runtime +# Set env that we're running in a container, so that the application can sleep for 250ms at start +ENV OXKER_RUNTIME=container # Copy application binary from builder image -COPY ./target/x86_64-unknown-linux-musl/release/oxker /usr/local/bin -COPY ./containerised/start_oxker.sh ./ +COPY ./target/x86_64-unknown-linux-musl/release/oxker /app/ # 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 [ "./app/oxker"] + +# Dev build for testing +# docker build -t oxker_dev -f Dockerfile . && docker run --rm -it --volume /var/run/docker.sock:/var/run/docker.sock:ro oxker_dev + +# Dev build one liner, x86 host +# docker image prune -a; 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 ## 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 . && docker run --rm -it --volume /var/run/docker.sock:/var/run/docker.sock:ro oxker_dev diff --git a/containerised/start_oxker.sh b/containerised/start_oxker.sh deleted file mode 100755 index 7ac5fa3..0000000 --- a/containerised/start_oxker.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -set -e - -# Without this sleep, the docker image will instantly close -# No idea why this is solving my issue, or even where the issue is originally coming from -sleep .1 - -exec /usr/local/bin/oxker "$@" \ No newline at end of file diff --git a/create_release.sh b/create_release.sh index f04c721..75484be 100755 --- a/create_release.sh +++ b/create_release.sh @@ -1,7 +1,7 @@ #!/bin/bash # rust create_release -# v0.1.2 +# v0.2.1 STAR_LINE='****************************************' CWD=$(pwd) @@ -176,12 +176,16 @@ cargo_test () { # This will download GB's of docker images cargo_build () { cargo install cross + echo -e "${YELLOW}cargo build --release${RESET}" cargo build --release ask_continue + echo -e "${YELLOW}cross build --target aarch64-unknown-linux-musl --release${RESET}" cross build --target aarch64-unknown-linux-musl --release ask_continue + echo -e "${YELLOW}cross build --target arm-unknown-linux-musleabihf --release${RESET}" cross build --target arm-unknown-linux-musleabihf --release ask_continue + echo -e "${YELLOW}cross build --target x86_64-pc-windows-gnu --release${RESET}" cross build --target x86_64-pc-windows-gnu --release ask_continue } @@ -190,12 +194,22 @@ cargo_build () { release_continue () { echo -e "\n${PURPLE}$1${RESET}" ask_continue - } + +# Check repository for typos +check_typos () { + echo -e "\n${PURPLE}check typos${RESET}" + typos + ask_continue +} + # Full flow to create a new release release_flow() { + check_typos + check_git get_git_remote_url + cargo_test cargo_build @@ -227,8 +241,10 @@ release_flow() { release_continue "git checkout main" git checkout main - release_continue "git merge --no-ff \"${RELEASE_BRANCH}\" -m \"chore: merge ${RELEASE_BRANCH} into main\"" + echo -e "${PURPLE}git merge --no-ff \"${RELEASE_BRANCH}\" -m \"chore: merge ${RELEASE_BRANCH} into main\"${RESET}" git merge --no-ff "$RELEASE_BRANCH" -m "chore: merge ${RELEASE_BRANCH} into main" + echo -e "\n${PURPLE}cargo check${RESET}\n" + cargo check release_continue "git tag -am \"${RELEASE_BRANCH}\" \"$NEW_TAG_WITH_V\"" git tag -am "${RELEASE_BRANCH}" "$NEW_TAG_WITH_V" diff --git a/src/app_data/container_state.rs b/src/app_data/container_state.rs index efa2d81..aedc613 100644 --- a/src/app_data/container_state.rs +++ b/src/app_data/container_state.rs @@ -377,8 +377,8 @@ impl fmt::Display for LogsTz { } /// Store the logs alongside a HashSet, each log *should* generate a unique timestamp, -/// so if we store the timestamp seperately in a HashSet, we can then check if we should insert a log line into the -/// stateful list dependant on whethere the timestamp is in the HashSet or not +/// so if we store the timestamp separately in a HashSet, we can then check if we should insert a log line into the +/// stateful list dependent on whethere the timestamp is in the HashSet or not #[derive(Debug, Clone)] pub struct Logs { logs: StatefulList>, diff --git a/src/app_data/mod.rs b/src/app_data/mod.rs index 0837c24..441c23a 100644 --- a/src/app_data/mod.rs +++ b/src/app_data/mod.rs @@ -376,7 +376,7 @@ impl AppData { .map(|i| i.logs.state()) } - /// Error realted methods + /// Error related methods /// return single app_state error pub const fn get_error(&self) -> Option { diff --git a/src/docker_data/mod.rs b/src/docker_data/mod.rs index 43a2124..ad0c500 100644 --- a/src/docker_data/mod.rs +++ b/src/docker_data/mod.rs @@ -54,6 +54,7 @@ pub struct DockerData { app_data: Arc>, args: CliArgs, binate: Binate, + containerised: bool, docker: Arc, gui_state: Arc>, is_running: Arc, @@ -62,7 +63,7 @@ pub struct DockerData { } impl DockerData { - /// Use docker stats to caluclate current cpu usage + /// Use docker stats to calculate current cpu usage #[allow(clippy::cast_precision_loss)] fn calculate_usage(stats: &Stats) -> f64 { let mut cpu_percentage = 0.0; @@ -175,7 +176,7 @@ impl DockerData { /// 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 - /// Will ignore any container that uses `./start_oxker.sh` as an entry point, unless the `-s` flag is set + /// If in a containerised runtime, will ignore any container that uses the q`./app/oxker` as an entry point, unless the `-s` flag is set pub async fn update_all_containers(&mut self) -> Vec<(bool, ContainerId)> { let containers = self .docker @@ -190,9 +191,10 @@ impl DockerData { .into_iter() .filter_map(|f| match f.id { Some(_) => { - if f.command - .as_ref() - .map_or(false, |c| c.starts_with(ENTRY_POINT)) + if self.containerised + && f.command + .as_ref() + .map_or(false, |c| c.starts_with(ENTRY_POINT)) && self.args.show_self { None @@ -414,6 +416,7 @@ impl DockerData { /// Initialise self, and start the message receiving loop pub async fn init( app_data: Arc>, + containerised: bool, docker: Docker, docker_rx: Receiver, gui_state: Arc>, @@ -423,6 +426,7 @@ impl DockerData { if app_data.lock().get_error().is_none() { let mut inner = Self { app_data, + containerised, args, binate: Binate::One, docker: Arc::new(docker), diff --git a/src/main.rs b/src/main.rs index 9e3fdfe..56b198f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,10 @@ #![forbid(unsafe_code)] -#![warn(clippy::unused_async, clippy::unwrap_used, clippy::expect_used)] +#![warn( + clippy::expect_used, + clippy::todo, + clippy::unused_async, + clippy::unwrap_used +)] // Warning - These are indeed pedantic #![warn(clippy::pedantic)] #![warn(clippy::nursery)] @@ -33,16 +38,35 @@ use ui::{create_ui, GuiState, Status}; use crate::docker_data::DockerMessage; -const ENTRY_POINT: &str = "./start_oxker.sh"; +// this is the entry point when running as a Docker Container, and is used, in conjunction with the `CONTAINER_ENV` ENV, to check if we are running as a Docker Container +const ENTRY_POINT: &str = "./app/oxker"; +const ENV_KEY: &str = "OXKER_RUNTIME"; +const ENV_VALUE: &str = "container"; +/// Enable tracing, only really used in debug mode, for now /// write to file if `-g` is set? fn setup_tracing() { tracing_subscriber::fmt().with_max_level(Level::INFO).init(); } +/// An ENV is set in the ./containerised/Dockerfile, if this is ENV found, then sleep for 250ms, else the container, for as yet unknown reasons, will close immediately +/// returns a bool, so that the `update_all_containers()` won't bother to check the entry point unless running via a container +fn check_if_containerised() -> bool { + if std::env::vars() + .into_iter() + .any(|x| x == (ENV_KEY.into(), ENV_VALUE.into())) + { + std::thread::sleep(std::time::Duration::from_millis(250)); + true + } else { + false + } +} + /// Create docker daemon handler, and only spawn up the docker data handler if a ping returns non-error async fn docker_init( app_data: &Arc>, + containerised: bool, docker_rx: Receiver, gui_state: &Arc>, is_running: &Arc, @@ -53,7 +77,12 @@ async fn docker_init( let gui_state = Arc::clone(gui_state); let is_running = Arc::clone(is_running); tokio::spawn(DockerData::init( - app_data, docker, docker_rx, gui_state, is_running, + app_data, + containerised, + docker, + docker_rx, + gui_state, + is_running, )); } else { app_data.lock().set_error(AppError::DockerConnect); @@ -87,7 +116,10 @@ fn handler_init( #[tokio::main] async fn main() { + let containerised = check_if_containerised(); + setup_tracing(); + let args = CliArgs::new(); let app_data = Arc::new(Mutex::new(AppData::default(args))); let gui_state = Arc::new(Mutex::new(GuiState::default())); @@ -95,7 +127,7 @@ async fn main() { let (docker_sx, docker_rx) = tokio::sync::mpsc::channel(16); let (input_sx, input_rx) = tokio::sync::mpsc::channel(16); - docker_init(&app_data, docker_rx, &gui_state, &is_running).await; + docker_init(&app_data, containerised, docker_rx, &gui_state, &is_running).await; handler_init(&app_data, &docker_sx, &gui_state, input_rx, &is_running); diff --git a/src/ui/draw_blocks.rs b/src/ui/draw_blocks.rs index 9e1a0fe..88010c3 100644 --- a/src/ui/draw_blocks.rs +++ b/src/ui/draw_blocks.rs @@ -328,7 +328,7 @@ fn make_chart<'a, T: Stats + Display>( } /// Draw heading bar at top of program, always visible -/// TODO Should seperate into loading icon/headers/help functions +/// TODO Should separate into loading icon/headers/help functions #[allow(clippy::too_many_lines)] pub fn heading_bar( area: Rect, @@ -510,7 +510,7 @@ pub fn help_box(f: &mut Frame<'_, B>) { ); help_text.push_str("\n ( q ) to quit at any time"); help_text.push_str("\n mouse scrolling & clicking also available"); - help_text.push_str("\n\n currenty an early work in progress, all and any input appreciated"); + help_text.push_str("\n\n currently an early work in progress, all and any input appreciated"); help_text.push_str(format!("\n {}", REPO.trim()).as_str()); // Find the maximum line widths & height @@ -527,7 +527,7 @@ pub fn help_box(f: &mut Frame<'_, B>) { .block(Block::default()) .alignment(Alignment::Center); - let description_paragrpah = Paragraph::new(description_text.as_str()) + let description_paragraph = Paragraph::new(description_text.as_str()) .style(Style::default().bg(Color::Magenta).fg(Color::Black)) .block(Block::default()) .alignment(Alignment::Center); @@ -566,7 +566,7 @@ pub fn help_box(f: &mut Frame<'_, B>) { // Order is important here f.render_widget(Clear, area); f.render_widget(name_paragraph, split_popup[0]); - f.render_widget(description_paragrpah, split_popup[1]); + f.render_widget(description_paragraph, split_popup[1]); f.render_widget(help_paragraph, split_popup[2]); f.render_widget(block, area); } diff --git a/src/ui/gui_state.rs b/src/ui/gui_state.rs index 923c15a..ead3245 100644 --- a/src/ui/gui_state.rs +++ b/src/ui/gui_state.rs @@ -273,7 +273,7 @@ impl GuiState { self.is_loading.insert(uuid); } - /// If is_loading has any entries, return the current loading_icon, else an emtpy string + /// If is_loading has any entries, return the current loading_icon, else an empty string pub fn get_loading(&mut self) -> String { if self.is_loading.is_empty() { String::from(" ")