Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
fix: always install ruby with flox

fix: always install ruby with flox
  • Loading branch information
tsirysndr committed Jul 17, 2024
1 parent 4326c18 commit 5484614
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 31 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fluentci run --wasm kamal help
| redeploy | Deploy app to servers without bootstrapping servers, starting Traefik, pruning, and registry login |
| registry | Login and -out of the image registry |
| remove | Remove Traefik, app, accessories, and registry session from servers |
| rolback | Rollback app to VERSION |
| rollback | Rollback app to VERSION |
| server | Bootstrap servers with curl and Docker |
| setup | Setup all accessories, push the env, and deploy app to servers |
| traefik | Manage Traefik load balancer |
Expand Down
17 changes: 9 additions & 8 deletions src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,22 @@ pub fn setup() -> Result<(), Error> {
let home = dag().get_env("HOME")?;
let path = dag().get_env("PATH")?;

dag().set_envs(vec![(
"PATH".into(),
format!("{}/.local/bin:{}", home, path),
)])?;

setup_flox()?;
dag()
.pipeline("setup kamal")?
.flox()?
.with_exec(vec!["flox install ruby"])?
.with_exec(vec!["gem install kamal"])?
.with_exec(vec!["[ -d $HOME/.local/bin ] || mkdir -p $HOME/.local/bin"])?
.with_exec(vec![
"ln -s `gem environment gemhome`/bin/kamal $HOME/.local/bin/kamal || true",
])?
.with_exec(vec!["ln -s `flox activate -- gem environment gemhome`/bin/kamal $HOME/.local/bin/kamal || true"])?
.with_exec(vec!["PATH=$HOME/.local/bin:$PATH", "type", "kamal"])?
.with_exec(vec!["PATH=$HOME/.local/bin:$PATH", "type", "ruby"])?
.stdout()?;

dag().set_envs(vec![(
"PATH".into(),
format!("{}/.local/bin:{}", home, path),
)])?;

Ok(())
}
104 changes: 82 additions & 22 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ pub fn accessory(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("accessory")?
.flox()?
.with_exec(vec!["kamal", "accessory", &args])?
.with_exec(vec![
"PATH=$HOME/.local/bin:$PATH",
"kamal",
"accessory",
&args,
])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -20,7 +25,7 @@ pub fn app(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("app")?
.flox()?
.with_exec(vec!["kamal", "app", &args])?
.with_exec(vec!["PATH=$HOME/.local/bin:$PATH", "kamal", "app", &args])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -31,7 +36,7 @@ pub fn audit(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("audit")?
.flox()?
.with_exec(vec!["kamal", "audit", &args])?
.with_exec(vec!["PATH=$HOME/.local/bin:$PATH", "kamal", "audit", &args])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -42,7 +47,7 @@ pub fn build(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("build")?
.flox()?
.with_exec(vec!["kamal", "build", &args])?
.with_exec(vec!["PATH=$HOME/.local/bin:$PATH", "kamal", "build", &args])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -53,7 +58,12 @@ pub fn config(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("config")?
.flox()?
.with_exec(vec!["kamal", "config", &args])?
.with_exec(vec![
"PATH=$HOME/.local/bin:$PATH",
"kamal",
"config",
&args,
])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -64,7 +74,12 @@ pub fn deploy(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("deploy")?
.flox()?
.with_exec(vec!["kamal", "deploy", &args])?
.with_exec(vec![
"PATH=$HOME/.local/bin:$PATH",
"kamal",
"deploy",
&args,
])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -75,7 +90,12 @@ pub fn details(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("details")?
.flox()?
.with_exec(vec!["kamal", "details", &args])?
.with_exec(vec![
"PATH=$HOME/.local/bin:$PATH",
"kamal",
"details",
&args,
])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -86,7 +106,7 @@ pub fn docs(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("docs")?
.flox()?
.with_exec(vec!["kamal", "docs", &args])?
.with_exec(vec!["PATH=$HOME/.local/bin:$PATH", "kamal", "docs", &args])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -97,7 +117,7 @@ pub fn env(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("env")?
.flox()?
.with_exec(vec!["kamal", "env", &args])?
.with_exec(vec!["PATH=$HOME/.local/bin:$PATH", "kamal", "env", &args])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -108,7 +128,12 @@ pub fn envify(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("envify")?
.flox()?
.with_exec(vec!["kamal", "envify", &args])?
.with_exec(vec![
"PATH=$HOME/.local/bin:$PATH",
"kamal",
"envify",
&args,
])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -119,7 +144,7 @@ pub fn help(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("help")?
.flox()?
.with_exec(vec!["kamal", "help", &args])?
.with_exec(vec!["PATH=$HOME/.local/bin:$PATH", "kamal", "help", &args])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -130,7 +155,7 @@ pub fn init(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("init")?
.flox()?
.with_exec(vec!["kamal", "init", &args])?
.with_exec(vec!["PATH=$HOME/.local/bin:$PATH", "kamal", "init", &args])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -152,7 +177,7 @@ pub fn lock(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("lock")?
.flox()?
.with_exec(vec!["kamal", "lock", &args])?
.with_exec(vec!["PATH=$HOME/.local/bin:$PATH", "kamal", "lock", &args])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -163,7 +188,7 @@ pub fn prune(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("prune")?
.flox()?
.with_exec(vec!["kamal", "prune", &args])?
.with_exec(vec!["PATH=$HOME/.local/bin:$PATH", "kamal", "prune", &args])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -174,7 +199,12 @@ pub fn redeploy(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("redeploy")?
.flox()?
.with_exec(vec!["kamal", "redeploy", &args])?
.with_exec(vec![
"PATH=$HOME/.local/bin:$PATH",
"kamal",
"redeploy",
&args,
])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -185,7 +215,12 @@ pub fn registry(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("registry")?
.flox()?
.with_exec(vec!["kamal", "registry", &args])?
.with_exec(vec![
"PATH=$HOME/.local/bin:$PATH",
"kamal",
"registry",
&args,
])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -196,7 +231,12 @@ pub fn remove(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("remove")?
.flox()?
.with_exec(vec!["kamal", "remove", &args])?
.with_exec(vec![
"PATH=$HOME/.local/bin:$PATH",
"kamal",
"remove",
&args,
])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -207,7 +247,12 @@ pub fn rollback(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("rollback")?
.flox()?
.with_exec(vec!["kamal", "rollback", &args])?
.with_exec(vec![
"PATH=$HOME/.local/bin:$PATH",
"kamal",
"rollback",
&args,
])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -218,7 +263,12 @@ pub fn server(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("server")?
.flox()?
.with_exec(vec!["kamal", "server", &args])?
.with_exec(vec![
"PATH=$HOME/.local/bin:$PATH",
"kamal",
"server",
&args,
])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -229,7 +279,7 @@ pub fn setup(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("setup")?
.flox()?
.with_exec(vec!["kamal", "setup", &args])?
.with_exec(vec!["PATH=$HOME/.local/bin:$PATH", "kamal", "setup", &args])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -240,7 +290,12 @@ pub fn traefik(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("traefik")?
.flox()?
.with_exec(vec!["kamal", "traefik", &args])?
.with_exec(vec![
"PATH=$HOME/.local/bin:$PATH",
"kamal",
"traefik",
&args,
])?
.stdout()?;
Ok(stdout)
}
Expand All @@ -251,7 +306,12 @@ pub fn version(args: String) -> FnResult<String> {
let stdout = dag()
.pipeline("version")?
.flox()?
.with_exec(vec!["kamal", "version", &args])?
.with_exec(vec![
"PATH=$HOME/.local/bin:$PATH",
"kamal",
"version",
&args,
])?
.stdout()?;
Ok(stdout)
}

0 comments on commit 5484614

Please sign in to comment.