-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 08dee46
Showing
27 changed files
with
1,192 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## Description | ||
|
||
Please include a summary of the change and which issue is fixed or feature is added. | ||
|
||
## Type of change | ||
|
||
- [ ] Bug fix (non-breaking change which fixes an issue) | ||
- [ ] New feature (non-breaking change which adds functionality) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
- [ ] Documentation update | ||
|
||
## Checklist: | ||
|
||
- [ ] My code follows the style guidelines of this project | ||
- [ ] I have performed a self-review of my own code | ||
- [ ] I have added tests that prove my fix is effective or that my feature works | ||
- [ ] New and existing tests pass locally with my changes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.21" | ||
|
||
- name: Install Task | ||
uses: arduino/setup-task@v1 | ||
|
||
- name: Lint and Test | ||
run: | | ||
task lint | ||
task test | ||
release: | ||
needs: test | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.21" | ||
|
||
- name: Run semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
npm install -g semantic-release @semantic-release/git @semantic-release/github | ||
semantic-release | ||
goreleaser: | ||
needs: release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.21" | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# Go workspace file | ||
go.work | ||
|
||
# SQLite database files | ||
*.db | ||
*.db-journal | ||
|
||
# IDE specific files | ||
.idea | ||
.vscode | ||
*.swp | ||
*.swo | ||
*~ | ||
|
||
# OS specific files | ||
.DS_Store | ||
.DS_Store? | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
ehthumbs.db | ||
Thumbs.db | ||
|
||
# Local development files | ||
.env | ||
.env.local | ||
*.local.yaml | ||
*.local.yml | ||
|
||
# Debug files | ||
debug | ||
__debug_bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
project_name: duet | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- main: ./cmd/duet | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- darwin | ||
- windows | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
mod_timestamp: "{{ .CommitTimestamp }}" | ||
flags: | ||
- -trimpath | ||
ldflags: | ||
- -s -w | ||
- -X main.version={{.Version}} | ||
- -X main.commit={{.Commit}} | ||
- -X main.date={{.Date}} | ||
|
||
archives: | ||
- format: tar.gz | ||
name_template: >- | ||
{{ .ProjectName }}_ | ||
{{- title .Os }}_ | ||
{{- if eq .Arch "amd64" }}x86_64 | ||
{{- else if eq .Arch "386" }}i386 | ||
{{- else }}{{ .Arch }}{{ end }} | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
|
||
checksum: | ||
name_template: "checksums.txt" | ||
|
||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" | ||
- "^ci:" | ||
- "^chore:" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"branches": ["main"], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/github", | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"assets": ["go.mod", "go.sum"], | ||
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
VERSION 0.7 | ||
FROM golang:1.21-alpine | ||
WORKDIR /duet | ||
|
||
deps: | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
SAVE ARTIFACT go.mod AS LOCAL go.mod | ||
SAVE ARTIFACT go.sum AS LOCAL go.sum | ||
|
||
lint: | ||
FROM golangci/golangci-lint:latest | ||
COPY . . | ||
RUN golangci-lint run | ||
|
||
build: | ||
FROM +deps | ||
COPY . . | ||
RUN CGO_ENABLED=0 go build -o duet cmd/duet/main.go | ||
SAVE ARTIFACT duet AS LOCAL dist/duet | ||
|
||
test: | ||
FROM +deps | ||
COPY . . | ||
RUN go test -race -coverprofile=coverage.out ./... | ||
SAVE ARTIFACT coverage.out AS LOCAL coverage.out | ||
|
||
docker: | ||
FROM alpine:latest | ||
COPY +build/duet /usr/local/bin/duet | ||
ENTRYPOINT ["/usr/local/bin/duet"] | ||
SAVE IMAGE duet:latest | ||
|
||
all: | ||
BUILD +lint | ||
BUILD +test | ||
BUILD +build | ||
BUILD +docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Duet | ||
|
||
Duet is a powerful infrastructure and configuration management tool that orchestrates both infrastructure provisioning and system configuration in harmony. Using Lua as its configuration language, Duet provides a unified approach to managing your entire infrastructure lifecycle. | ||
|
||
## Features | ||
|
||
- Infrastructure as Code (similar to Terraform/Pulumi) | ||
- Configuration Management (similar to Ansible) | ||
- Lua-based configuration language | ||
- State management using SQLite | ||
- Idempotent operations | ||
- AWS provider support (more coming soon) | ||
|
||
## Quick Start | ||
|
||
```bash | ||
# Install Duet | ||
go install github.com/rebelopsio/duet/cmd/duet@latest | ||
|
||
# Create a configuration file | ||
cat > infra.lua << EOF | ||
local config = { | ||
infrastructure = { | ||
aws = { | ||
region = "us-west-2", | ||
ec2 = { | ||
instance_type = "t2.micro", | ||
ami = "ami-0c55b159cbfafe1f0", | ||
subnet_id = "subnet-xxxxxxxx" | ||
} | ||
} | ||
} | ||
} | ||
function deploy_infrastructure() | ||
return config.infrastructure | ||
end | ||
function configure_instance(host) | ||
local success, err = install_package("cowsay", host) | ||
if not success then | ||
error("Failed to install cowsay: " .. err) | ||
end | ||
return true | ||
end | ||
EOF | ||
|
||
# Plan your changes | ||
duet plan infra.lua | ||
|
||
# Apply your changes | ||
duet apply infra.lua | ||
``` | ||
|
||
## Architecture | ||
|
||
Duet is built with a clear separation of concerns: | ||
|
||
- Infrastructure as Code (IaC) Engine: Manages infrastructure provisioning | ||
- Configuration Management Engine: Handles system configuration | ||
- Lua Engine: Processes configuration files | ||
- State Store: Maintains system state using SQLite | ||
|
||
## Development | ||
|
||
```bash | ||
# Clone the repository | ||
git clone https://github.com/rebelopsio/duet.git | ||
|
||
# Install dependencies | ||
go mod download | ||
|
||
# Build | ||
go build -o duet cmd/duet/main.go | ||
|
||
# Run tests | ||
go test ./... | ||
``` | ||
|
||
## Contributing | ||
|
||
Contributions are welcome! Please read our contributing guidelines before submitting pull requests. | ||
|
||
## License | ||
|
||
MIT License - see LICENSE file for details |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
version: "3" | ||
|
||
vars: | ||
GO_MODULE: github.com/rebelopsio/duet | ||
BUILD_DIR: dist | ||
COVERAGE_DIR: coverage | ||
|
||
tasks: | ||
default: | ||
cmds: | ||
- task: test | ||
|
||
clean: | ||
desc: Clean build artifacts | ||
cmds: | ||
- rm -rf {{.BUILD_DIR}} | ||
- rm -rf {{.COVERAGE_DIR}} | ||
|
||
lint: | ||
desc: Run golangci-lint | ||
cmds: | ||
- golangci-lint run | ||
|
||
test: | ||
desc: Run tests | ||
cmds: | ||
- mkdir -p {{.COVERAGE_DIR}} | ||
- go test -race -coverprofile={{.COVERAGE_DIR}}/coverage.out -covermode=atomic ./... | ||
- go tool cover -html={{.COVERAGE_DIR}}/coverage.out -o {{.COVERAGE_DIR}}/coverage.html | ||
|
||
build: | ||
desc: Build binary | ||
cmds: | ||
- task: clean | ||
- mkdir -p {{.BUILD_DIR}} | ||
- go build -o {{.BUILD_DIR}}/duet cmd/duet/main.go | ||
|
||
install-tools: | ||
desc: Install development tools | ||
cmds: | ||
- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
- go install github.com/goreleaser/goreleaser@latest | ||
|
||
generate: | ||
desc: Run go generate | ||
cmds: | ||
- go generate ./... | ||
|
||
pre-commit: | ||
desc: Run pre-commit checks | ||
cmds: | ||
- task: generate | ||
- task: lint | ||
- task: test | ||
|
||
check-license: | ||
desc: Check license headers | ||
cmds: | ||
- | | ||
find . -type f -name "*.go" -not -path "./vendor/*" -exec sh -c ' | ||
for file do | ||
if ! grep -q "Copyright" "$file"; then | ||
echo "Missing license header in $file" | ||
exit 1 | ||
fi | ||
done | ||
' sh {} + |
Oops, something went wrong.