Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Better Composition #10

Open
ShindouMihou opened this issue Jul 2, 2023 · 1 comment
Open

[FEATURE] Better Composition #10

ShindouMihou opened this issue Jul 2, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@ShindouMihou
Copy link
Owner

ShindouMihou commented Jul 2, 2023

Burp currently has a composition that takes the main-dependency wherein services are written as either the main application or one of the dependencies, this works well with simpler applications, but for applications that require building one or more applications from a source, this falls apart.

As such, a new composition proposal needs to be implemented and this approach is the 'services' approach wherein all applications are regarded as a service and neither is considered the main application. In this approach, we create a schema as follows:

version = 2.0

[[services]]
name = "burp"
image = { build =  "/", repository = "https://github.com/ShindouMihou/burp" }
restart_policy = { name =  "always" }

[services.environment]
baseline = "burp.env"
server-side = false

[services.environment.replacements]
SIGNING_KEY="burp.Random(256)"

[[services]]
name = "redis"
image = { pull = "redis" }
restart_policy = { name =  "always" }

[services.environment]
baseline = "redis.env"
server-side = false

[services.environment.replacements]
REDIS_PASSWORD="burp.Random(256)"

To support this change, the environment.override will be removed and .env files will be merged into one separated by a comment that will signify to the processor of a new .env file such as in the example:

#burp: burp
BURP_SECRET={some argon2id hash}

#burp: redis
REDIS_USERNAME=root

In addition, future versions of the composition should support more file formats such as json, yaml instead of limiting towards toml which will help with how developers handle their preferences, for example, with JSON:

{
  "version":2.0,
  "services":[
    {
      "name": "burp",
      "image":  {
        "build": "/",
        "repository": "https://github.com/ShindouMihou/burp"
      },
      "restart_policy": {
        "name": "always"
      },
      "environment": {
        "baseline": "burp.env",
        "server-side": false,
        "replacements": {
          "SIGNING_KEY": "burp.Random(256)"
        }
      }
    },
    {
      "name": "redis",
      "image":  {
        "pull": "redis"
      },
      "restart_policy": {
        "name": "always"
      },
      "environment": {
        "baseline": "redis.env",
        "server-side": false,
        "replacements": {
          "REDIS_PASSWORD": "burp.Random(256)"
        }
      }
    }
  ]
}
@ShindouMihou ShindouMihou added the enhancement New feature or request label Jul 2, 2023
@ShindouMihou ShindouMihou self-assigned this Jul 2, 2023
@ShindouMihou
Copy link
Owner Author

In addition to the above, flags can be added to specify a specific mode in the application such as:

flags = ["parallel.builds"]

parallel.builds enables the Burp client to build the images not in a synchronous manner, but in parallel, so if you have more than one services that require an image to be built, Burp will build them in parallel and then spawn the necessary containers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant