Skip to content

Commit 88decf5

Browse files
committed
start container with iroh ssh compatibility
1 parent 1622787 commit 88decf5

File tree

5 files changed

+33
-1
lines changed

5 files changed

+33
-1
lines changed

.github/workflows/release.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ jobs:
2222
name: coman-Linux-x86_64-musl.tar.gz
2323
cargo_command: cargo
2424

25+
- os_name: Linux-aarch64
26+
os: ubuntu-latest
27+
target: aarch64-unknown-linux-musl
28+
bin: coman
29+
name: coman-Linux-aarch64-musl.tar.gz
30+
cargo_command: cargo
31+
2532
- os_name: Windows-aarch64
2633
os: windows-latest
2734
target: aarch64-pc-windows-msvc
@@ -47,7 +54,7 @@ jobs:
4754
- name: Install oas3-gen
4855
run: cargo install [email protected]
4956
- name: Install build dependencies on Linux
50-
run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools openssl libssl-dev
57+
run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools openssl libssl-dev squashfs-tools
5158
if: contains(matrix.platform.os, 'ubuntu')
5259
- name: Build binary (*nix)
5360
shell: bash
@@ -76,6 +83,9 @@ jobs:
7683
else
7784
tar czvf ../../../${{ matrix.platform.name }} ${{ matrix.platform.bin }}
7885
fi
86+
if [[ "${{ matrix.platform.os }}" == "ubuntu-latest" ]]; then
87+
mksquashfs coman coman_${{matrix.platform.os_name}}.sqsh
88+
fi
7989
cd -
8090
- name: Publish GitHub release
8191
uses: softprops/action-gh-release@v1

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coman/.config/config.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ workdir = "{{container_workdir}}"
4141
{% for key, value in env %}
4242
{{key}} = "{{value}}"
4343
{% endfor %}
44+
45+
[annotations]
46+
com.hooks.ssh.enabled = "true"
47+
com.hooks.ssh.authorize_ssh_key = "{{ remote_ssh_key_path}}"
48+
com.hooks.ssh.port = 15263
4449
"""
4550

4651
# set environment variables that should be passed to a job

coman/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ pid1 = "0.1.5"
7878
rust_supervisor = "0.2.0"
7979
iroh-ssh = "0.2.7"
8080
whoami = "1.6.1"
81+
base64 = "0.22.1"
8182

8283
[build-dependencies]
8384
anyhow = "1.0.90"

coman/src/cli.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::{error::Error, path::PathBuf, thread, time::Duration};
22

3+
use base64::prelude::*;
34
use clap::{Args, Command, Parser, Subcommand, ValueHint, builder::TypedValueParser};
45
use clap_complete::{Generator, Shell, generate};
56
use color_eyre::Result;
@@ -401,6 +402,20 @@ pub(crate) async fn cli_exec_command(command: Vec<String>) -> Result<()> {
401402
// Call the asynchronous connect method using the runtime.
402403
rt.block_on(async move {
403404
let mut builder = IrohSsh::builder().accept_incoming(true).accept_port(22);
405+
if let Ok(secret) = std::env::var("COMAN_IROH_SECRET") {
406+
let secret_key = BASE64_STANDARD.decode(secret).unwrap();
407+
let secret_key: &[u8; 32] = secret_key[0..32].try_into().unwrap();
408+
builder = builder.secret_key(secret_key);
409+
//TODO: for this feature:
410+
// - upload an ssh key and template to the ssh hook
411+
// - upload coman squash and mount to container
412+
// - use coman as entrypoint for container command (also add -pty to start command)
413+
// - generate secret key on client, set as env var on container
414+
// - wait for connection to endpoint to be available?
415+
// - drop into a local shell once connection is established?
416+
// - add connection to ssh config so it can be picked up by vscode et al?
417+
}
418+
404419
let server = builder.build().await.expect("couldn't create iroh server");
405420
println!("{}@{}", whoami::username(), server.node_id());
406421
loop {

0 commit comments

Comments
 (0)