Skip to content

Commit

Permalink
fix: isolate overmind socket
Browse files Browse the repository at this point in the history
  • Loading branch information
tsirysndr committed Jul 16, 2024
1 parent 3ec20f2 commit e28778f
Show file tree
Hide file tree
Showing 125 changed files with 258 additions and 250 deletions.
50 changes: 25 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Apache HTTPD server plugin for FluentCI"
edition = "2021"
license = "MIT"
name = "apache"
version = "0.1.1"
version = "0.1.2"

[lib]
crate-type = [
Expand Down
2 changes: 1 addition & 1 deletion apache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use fluentci_pdk::dag;

// ...

dag().call("https://pkg.fluentci.io/[email protected].1?wasm=1", "start", vec![])?;
dag().call("https://pkg.fluentci.io/[email protected].2?wasm=1", "start", vec![])?;
```

## 📚 Examples
Expand Down
2 changes: 1 addition & 1 deletion apache/fluentci.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ keywords = [
]
license = "MIT"
name = "apache"
version = "0.1.1"
version = "0.1.2"
15 changes: 9 additions & 6 deletions apache/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn setup() -> Result<String, Error> {
setup_flox()?;
dag()
.pipeline("setup")?
.with_exec(vec!["mkdir", "-p", ".fluentci"])?
.with_exec(vec!["mkdir", "-p", ".fluentci/apache"])?
.stdout()?;

let pwd = dag().get_env("PWD")?;
Expand All @@ -31,31 +31,34 @@ pub fn setup() -> Result<String, Error> {
}

if httpd_confdir.is_empty() {
dag().set_envs(vec![("HTTPD_CONFDIR".into(), format!("{}/.fluentci", pwd))])?;
dag().set_envs(vec![(
"HTTPD_CONFDIR".into(),
format!("{}/.fluentci/apache", pwd),
)])?;
}

if httpd_error_log_file.is_empty() {
dag().set_envs(vec![(
"HTTPD_ERROR_LOG_FILE".into(),
format!("{}/.fluentci/log/error.log", pwd),
format!("{}/.fluentci/apache/log/error.log", pwd),
)])?;
}

if httpd_access_log_file.is_empty() {
dag().set_envs(vec![(
"HTTPD_ACCESS_LOG_FILE".into(),
format!("{}/.fluentci/log/access.log", pwd),
format!("{}/.fluentci/apache/log/access.log", pwd),
)])?;
}

let stdout = dag()
.flox()?
.with_workdir(".fluentci")?
.with_workdir(".fluentci/apache")?
.with_exec(vec!["flox", "install", "apacheHttpd", "overmind", "tmux", "wget", "curl"])?
.with_exec(vec!["mkdir", "-p", "log"])?
.with_exec(vec![r#"[ -f log/.gitignore ] || echo -e 'error.log\naccess.log' > log/.gitignore"#])?
.with_exec(vec!["[ -f httpd.conf ] || flox activate -- wget https://raw.githubusercontent.com/fluentci-io/services/main/apache/httpd.conf"])?
.with_exec(vec!["[ -f ../index.html ] || flox activate -- wget https://raw.githubusercontent.com/fluentci-io/services/main/apache/web/index.html -O ../index.html"])?
.with_exec(vec!["[ -f ../../index.html ] || flox activate -- wget https://raw.githubusercontent.com/fluentci-io/services/main/apache/web/index.html -O ../../index.html"])?
.with_exec(vec![
"grep -q web Procfile || echo -e 'web: apachectl start -f $PWD/httpd.conf -D FOREGROUND\\n' >> Procfile",
])?
Expand Down
4 changes: 2 additions & 2 deletions apache/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub fn start(_args: String) -> FnResult<String> {
helpers::setup()?;
let stdout = dag()
.flox()?
.with_workdir(".fluentci")?
.with_workdir(".fluentci/apache")?
.with_exec(vec!["overmind", "--version"])?
.with_exec(vec!["httpd", "-v"])?
.with_exec(vec!["type", "overmind"])?
Expand Down Expand Up @@ -38,7 +38,7 @@ pub fn stop(args: String) -> FnResult<String> {

let stdout = dag()
.flox()?
.with_workdir(".fluentci")?
.with_workdir(".fluentci/apache")?
.with_exec(vec!["overmind", "stop", &args])?
.stdout()?;
Ok(stdout)
Expand Down
2 changes: 1 addition & 1 deletion caddy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Caddy plugin for FluentCI"
edition = "2021"
license = "MIT"
name = "caddy"
version = "0.1.0"
version = "0.1.1"

[lib]
crate-type = [
Expand Down
2 changes: 1 addition & 1 deletion caddy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use fluentci_pdk::dag;

// ...

dag().call("https://pkg.fluentci.io/[email protected].0?wasm=1", "start", vec![])?;
dag().call("https://pkg.fluentci.io/[email protected].1?wasm=1", "start", vec![])?;
```

## 📚 Examples
Expand Down
2 changes: 1 addition & 1 deletion caddy/fluentci.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ keywords = [
]
license = "MIT"
name = "caddy"
version = "0.1.0"
version = "0.1.1"
17 changes: 10 additions & 7 deletions caddy/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ pub fn setup() -> Result<String, Error> {
dag()
.pipeline("setup")?
.with_exec(vec!["mkdir", "-p", ".fluentci"])?
.with_exec(vec!["mkdir", "-p", ".fluentci/logs"])?
.with_exec(vec!["mkdir", "-p", ".fluentci/caddy/logs"])?
.with_exec(vec![
"grep -q logs .fluentci/.gitignore || echo 'logs' >> .fluentci/.gitignore",
"grep -q logs .fluentci/caddy/.gitignore || echo 'logs' >> .fluentci/caddy/.gitignore",
])?
.stdout()?;

Expand All @@ -34,7 +34,10 @@ pub fn setup() -> Result<String, Error> {
}

if caddy_log_dir.is_empty() {
dag().set_envs(vec![("CADDY_LOG_DIR".into(), ".fluentci/logs".into())])?;
dag().set_envs(vec![(
"CADDY_LOG_DIR".into(),
".fluentci/caddy/logs".into(),
)])?;
}

if caddy_port.is_empty() {
Expand All @@ -49,12 +52,12 @@ pub fn setup() -> Result<String, Error> {

let stdout = dag()
.flox()?
.with_workdir(".fluentci")?
.with_workdir(".fluentci/caddy")?
.with_exec(vec!["flox", "install", "caddy", "overmind", "tmux", "wget", "curl"])?
.with_exec(vec!["[ -f ../Caddyfile ] || flox activate -- wget https://raw.githubusercontent.com/fluentci-io/services/main/caddy/Caddyfile -O ../Caddyfile"])?
.with_exec(vec!["[ -f ../index.html ] || flox activate -- wget https://raw.githubusercontent.com/fluentci-io/services/main/caddy/web/index.html -O ../index.html"])?
.with_exec(vec!["[ -f ../../Caddyfile ] || flox activate -- wget https://raw.githubusercontent.com/fluentci-io/services/main/caddy/Caddyfile -O ../../Caddyfile"])?
.with_exec(vec!["[ -f ../../index.html ] || flox activate -- wget https://raw.githubusercontent.com/fluentci-io/services/main/caddy/web/index.html -O ../../index.html"])?
.with_exec(vec![
&format!("grep -q caddy Procfile || echo -e 'caddy: cd .. && caddy run {}\\n' >> Procfile", opts),
&format!("grep -q caddy Procfile || echo -e 'caddy: cd ../.. && caddy run {}\\n' >> Procfile", opts),
])?
.stdout()?;

Expand Down
4 changes: 2 additions & 2 deletions caddy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn start(_args: String) -> FnResult<String> {

let stdout = dag()
.flox()?
.with_workdir(".fluentci")?
.with_workdir(".fluentci/caddy")?
.with_exec(vec!["overmind", "--version"])?
.with_exec(vec!["caddy", "--version"])?
.with_exec(vec!["type", "overmind"])?
Expand All @@ -42,7 +42,7 @@ pub fn stop(args: String) -> FnResult<String> {

let stdout = dag()
.flox()?
.with_workdir(".fluentci")?
.with_workdir(".fluentci/caddy")?
.with_exec(vec!["overmind", "stop", &args])?
.stdout()?;
Ok(stdout)
Expand Down
Loading

0 comments on commit e28778f

Please sign in to comment.