mach-composer / mach-composer-cli

MACH composer is an orchestration tool for modern MACH ecosystems, powered by Terraform infrastructure-as-code underneath.
https://docs.machcomposer.io
MIT License
47 stars 10 forks source link
aws azure commercetools composable gcp headless mach storyblok terraform

MACH composer

Documentation: docs.machcomposer.io

Plug-ins overview: MACH composer plug-ins README

MACH composer is a framework that you use to orchestrate and extend modern digital commerce & experience platforms, based on MACH technologies and cloud native services. It provides a standards-based, future-proof tool-set and methodology to hand to your teams when building these types of platforms.

It includes:

The framework is intended as the 'center piece' of your MACH architecture and incorporates industry best practises such as the 12 Factor Methodology, Infrastrucure-as-code, DevOps, immutable deployments, FAAS, etc.

With combining (and requiring) these practises, using the framework has significant impact on your engineering methodology and organisation. On the other hand, by combining those practises we believe it offers an accelerated 'way in' in terms of embracing modern engineering practises in your organisation.

Installation

MacOS

brew tap mach-composer/mach-composer
brew install mach-composer

Windows

Windows installation through Chocolatery is currently unstable. We recommend to download the latest release from GitHub Releases. Also, it is recommended to run MACH composer through WSL.

Getting started

Read our getting started guide on how to deploy your MACH stack with MACH composer.

Example yaml file

---
mach_composer:
  version: 1
global:
  environment: test
  cloud: aws
  terraform_config:
    aws_remote_state:
      bucket: mach-tfstate-tst
      key_prefix: mach-composer-tst
      region: eu-central-1
sites:
  - identifier: my-site
    aws:
      account_id: 1234567890
      region: eu-central-1
    endpoints:
      public: api.tst.mach-example.net
    commercetools:
      project_key: my-site-tst
      client_id: ...
      client_secret: ...
      scopes: manage_project:my-site-tst manage_api_clients:my-site-tst view_api_clients:my-site-tst
      token_url: https://auth.europe-west1.gcp.commercetools.com
      api_url: https://api.europe-west1.gcp.commercetools.com
      project_settings:
        languages:
          - en-GB
          - nl-NL
        currencies:
          - GBP
          - EUR
        countries:
          - GB
          - NL
    components:
      - name: payment
        variables:
          STRIPE_ACCOUNT_ID: 0123456789
        secrets:
          STRIPE_SECRET_KEY: secret-value
components:
  - name: payment
    source: git::ssh://git@github.com/your-project/components/payment-component.git//terraform
    endpoints:
      main: public
    version: e638e57

Running MACH

To generate the files:

mach-composer generate # generates config for main.yml
mach-composer generate -f other-file.yml

To plan Terraform:

mach-composer plan

To apply Terraform config:

mach-composer apply

Optionally you can run a terraform init without taking any action:

mach-composer terraform init

Checking for updates

MACH can check your components for available updates.

To do this, run:

mach-composer update -f main.yml