Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
feat(hcl): simplify service spec in HCL config
Browse files Browse the repository at this point in the history
  • Loading branch information
tsirysndr committed May 6, 2023
1 parent 047b53c commit 7a8555c
Show file tree
Hide file tree
Showing 23 changed files with 351 additions and 265 deletions.
40 changes: 40 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ async-trait = "0.1.68"
dyn-clone = "1.0.11"
serde_json = "1.0.96"
colored_json = "3.1.0"
spinners = "4.1.0"

[build-dependencies]
tonic-build = "0.8"
33 changes: 15 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,25 +105,22 @@ Start by initializing a new project. This will create a `Superfile.hcl` file in

```hcl
project = "demo"
services = [
{
"name" = "demo"
"type" = "exec"
"command" = "ping $GITHUB_DOMAIN"
"working_dir" = "/tmp"
"description" = "Ping Service Example"
"depends_on" = []
"env" = {
"GITHUB_DOMAIN" = "github.com"
}
"autostart" = true
"autorestart" = false
"namespace" = "demo_namespace"
"port" = 5060
"stdout" = "/tmp/demo-stdout.log"
"stderr" = "/tmp/demo-stderr.log"
service "demo" {
type = "exec"
command = "ping $GITHUB_DOMAIN"
working_dir = "/tmp"
description = "Ping Service Example"
depends_on = []
env = {
"GITHUB_DOMAIN" = "github.com"
}
]
autostart = true
autorestart = false
namespace = "demo_namespace"
stdout = "/tmp/demo-stdout.log"
stderr = "/tmp/demo-stderr.log"
}
```

### Start the service
Expand Down
42 changes: 20 additions & 22 deletions examples/angular/Superfile.hcl
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
project = "angular"
services = [
{
"name" = "angular"
"type" = "exec"
"command" = "npm start"
"working_dir" = "./angular"
"description" = "Angular example"
"depends_on" = []
"env" = {}
"autostart" = true
"autorestart" = false
"namespace" = "demo_namespace"
"stdout" = "/tmp/angular-stdout.log"
"stderr" = "/tmp/angular-stderr.log"
"port" = 4200
flox = {
"environment" = ".#angular"
}
build = {
"command" = "npm install"
}

service "angular" {
"type" = "exec"
"command" = "npm start"
"working_dir" = "./angular"
"description" = "Angular example"
"depends_on" = []
"env" = {}
"autostart" = true
"autorestart" = false
"namespace" = "demo_namespace"
"stdout" = "/tmp/angular-stdout.log"
"stderr" = "/tmp/angular-stderr.log"
"port" = 4200
flox = {
"environment" = ".#angular"
}
]
build = {
"command" = "npm install"
}
}
36 changes: 17 additions & 19 deletions examples/deno-fresh/Superfile.hcl
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
project = "deno-fresh"
services = [
{
"name" = "deno"
"type" = "exec"
"command" = "./dev.ts"
"working_dir" = "."
"description" = "Deno example app"
"depends_on" = []
"env" = {}
"autostart" = true
"autorestart" = false
"namespace" = "deno_namespace"
"stdout" = "/tmp/deno-stdout.log"
"stderr" = "/tmp/deno-stderr.log"
"port" = 8000
flox = {
"environment" = ".#deno-fresh"
}

service "deno" {
type = "exec"
command = "./dev.ts"
working_dir = "."
description = "Deno example app"
depends_on = []
env = {}
autostart = true
autorestart = false
namespace = "deno_namespace"
stdout = "/tmp/deno-stdout.log"
stderr = "/tmp/deno-stderr.log"
port = 8000
flox = {
environment = ".#deno-fresh"
}
]
}
38 changes: 19 additions & 19 deletions examples/deno-fresh/deno.lock

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

80 changes: 39 additions & 41 deletions examples/nginx-golang-mysql/Superfile.hcl
Original file line number Diff line number Diff line change
@@ -1,43 +1,41 @@
project = "nginx-golang-mysql"
services = [
{
"name" = "go"
"type" = "exec"
"command" = "go run main.go"
"working_dir" = "./backend"
"description" = "Go Service Example"
"depends_on" = ["mysql"]
"env" = { }
"autostart" = true
"autorestart" = false
"namespace" = "demo_namespace"
"stdout" = "/tmp/go-stdout.log"
"stderr" = "/tmp/go-stderr.log"
flox = {
"environment" = ".#nginx-golang-mysql"
}
},
{
"name" = "mysql"
"type" = "exec"
"command" = "mysqld --datadir=$MYSQL_DATADIR --pid-file=$MYSQL_PID_FILE --socket=$PWD/$MYSQL_UNIX_PORT"
"stop_command" = "mysqladmin -u root --socket=$PWD/$MYSQL_UNIX_PORT shutdown"
"working_dir" = "."
"description" = "MySQL Service Example"
"depends_on" = []
"env" = {
MYSQL_HOME = "./.mysql"
MYSQL_DATADIR = "./.mysql/data"
MYSQL_PID_FILE = "./.mysql/./mysql.pid"
MYSQL_UNIX_PORT = "./.mysql/mysql.sock"
}
"autostart" = true
"autorestart" = false
"namespace" = "demo_namespace"
"stdout" = "/tmp/mysql-stdout.log"
"stderr" = "/tmp/mysql-stderr.log"
flox = {
"environment" = ".#nginx-golang-mysql"
}

service "go" {
"type" = "exec"
"command" = "go run main.go"
"working_dir" = "./backend"
"description" = "Go Service Example"
"depends_on" = ["mysql"]
"env" = { }
"autostart" = true
"autorestart" = false
"namespace" = "demo_namespace"
"stdout" = "/tmp/go-stdout.log"
"stderr" = "/tmp/go-stderr.log"
flox = {
"environment" = ".#nginx-golang-mysql"
}
]
}

service "mysql" {
"type" = "exec"
"command" = "mysqld --datadir=$MYSQL_DATADIR --pid-file=$MYSQL_PID_FILE --socket=$PWD/$MYSQL_UNIX_PORT"
"stop_command" = "mysqladmin -u root --socket=$PWD/$MYSQL_UNIX_PORT shutdown"
"working_dir" = "."
"description" = "MySQL Service Example"
"depends_on" = []
"env" = {
MYSQL_HOME = "./.mysql"
MYSQL_DATADIR = "./.mysql/data"
MYSQL_PID_FILE = "./.mysql/./mysql.pid"
MYSQL_UNIX_PORT = "./.mysql/mysql.sock"
}
"autostart" = true
"autorestart" = false
"namespace" = "demo_namespace"
"stdout" = "/tmp/mysql-stdout.log"
"stderr" = "/tmp/mysql-stderr.log"
flox = {
"environment" = ".#nginx-golang-mysql"
}
}
Loading

0 comments on commit 7a8555c

Please sign in to comment.