Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 20 additions & 37 deletions .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,26 @@ on:

permissions:
contents: write
id-token: write

jobs:
goreleaser:
runs-on: ubuntu-24.04
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
CLOUDSMITH_NAMESPACE: ${{ vars.CLOUDSMITH_NAMESPACE || 'libops' }}
CLOUDSMITH_REPOSITORY: ${{ vars.CLOUDSMITH_REPOSITORY || 'sitectl' }}
CLOUDSMITH_DEB_TARGETS: ${{ vars.CLOUDSMITH_DEB_TARGETS || 'debian/bookworm ubuntu/noble' }}
CLOUDSMITH_RPM_TARGETS: ${{ vars.CLOUDSMITH_RPM_TARGETS || 'fedora/41' }}
CLOUDSMITH_ALPINE_TARGETS: ${{ vars.CLOUDSMITH_ALPINE_TARGETS || 'alpine/any-version' }}
steps:
- name: Checkout
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
with:
go-version: '>=1.25.8'

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_REPO }}

- name: Install Cloudsmith CLI
if: ${{ env.CLOUDSMITH_API_KEY != '' }}
uses: cloudsmith-io/cloudsmith-cli-action@v1
with:
api-key: ${{ env.CLOUDSMITH_API_KEY }}

- name: Publish Linux packages to Cloudsmith
if: ${{ env.CLOUDSMITH_API_KEY != '' }}
run: make publish-cloudsmith
uses: libops/terraform-linux-packages/.github/workflows/reusable-goreleaser.yaml@main
permissions:
contents: write
id-token: write
secrets: inherit
with:
go-version: ">=1.25.8"
publish-package-repo: true
package-name: sitectl
package-repo-prefix: sitectl
package-repo-label: sitectl
package-public-key-name: sitectl-archive-keyring
gcp-project: ${{ vars.LIBOPS_PACKAGES_GCLOUD_PROJECT }}
workload-identity-provider: ${{ vars.LIBOPS_PACKAGES_GCLOUD_OIDC_POOL }}
service-account: ${{ vars.LIBOPS_PACKAGES_GSA }}
gcs-bucket: ${{ vars.LIBOPS_PACKAGES_GCS_BUCKET }}
aptly-gpg-key-id: ${{ vars.LIBOPS_PACKAGES_APTLY_GPG_KEY_ID }}
aptly-gpg-private-key-secret: ${{ vars.LIBOPS_PACKAGES_APTLY_GPG_PRIVATE_KEY_SECRET }}
aptly-gpg-passphrase-secret: ${{ vars.LIBOPS_PACKAGES_APTLY_GPG_PASSPHRASE_SECRET }}
37 changes: 37 additions & 0 deletions .github/workflows/publish-apt-repo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: publish-apt-repo

on:
workflow_dispatch:
push:
tags:
- "*"

permissions:
contents: read
id-token: write

jobs:
publish-apt-repo:
if: ${{ vars.LIBOPS_PACKAGES_GCLOUD_PROJECT != '' && vars.LIBOPS_PACKAGES_GCLOUD_OIDC_POOL != '' && vars.LIBOPS_PACKAGES_GSA != '' && vars.LIBOPS_PACKAGES_GCS_BUCKET != '' && vars.LIBOPS_PACKAGES_APTLY_GPG_KEY_ID != '' }}
uses: libops/terraform-linux-packages/.github/workflows/reusable-publish-apt-repo.yaml@main
permissions:
contents: read
id-token: write
secrets: inherit
with:
go-version: ">=1.25.8"
gcp-project: ${{ vars.LIBOPS_PACKAGES_GCLOUD_PROJECT }}
workload-identity-provider: ${{ vars.LIBOPS_PACKAGES_GCLOUD_OIDC_POOL }}
service-account: ${{ vars.LIBOPS_PACKAGES_GSA }}
gcs-bucket: ${{ vars.LIBOPS_PACKAGES_GCS_BUCKET }}
gcs-bucket-prefix: ${{ vars.GCS_BUCKET_PREFIX }}
aptly-gpg-key-id: ${{ vars.LIBOPS_PACKAGES_APTLY_GPG_KEY_ID }}
aptly-gpg-private-key-secret: ${{ vars.LIBOPS_PACKAGES_APTLY_GPG_PRIVATE_KEY_SECRET || 'aptly-gpg-private-key' }}
aptly-gpg-passphrase-secret: ${{ vars.LIBOPS_PACKAGES_APTLY_GPG_PASSPHRASE_SECRET || 'aptly-gpg-passphrase' }}
aptly-distributions: ${{ vars.APTLY_DISTRIBUTIONS || 'bookworm' }}
aptly-component: ${{ vars.APTLY_COMPONENT || 'main' }}
aptly-architectures: ${{ vars.APTLY_ARCHITECTURES || 'amd64,arm64' }}
aptly-publish-prefix: ${{ vars.APTLY_PUBLISH_PREFIX || '.' }}
aptly-origin: ${{ vars.APTLY_ORIGIN || 'libops' }}
aptly-label: ${{ vars.APTLY_LABEL || 'sitectl' }}
aptly-public-key-name: ${{ vars.APTLY_PUBLIC_KEY_NAME || 'sitectl-archive-keyring' }}
103 changes: 0 additions & 103 deletions CONTRIBUTING.md

This file was deleted.

18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.PHONY: build deps lint test docker integration-test docs plugins install-plugins publish-cloudsmith
.PHONY: build deps lint test docker integration-test docs docs-host plugins install-plugins publish-aptly-repo

BINARY_NAME=sitectl
DOCS_PORT ?= 3000

deps:
go get .
Expand All @@ -9,6 +10,17 @@ deps:
build: deps
go build -o $(BINARY_NAME) .

docs:
docker run --rm -it \
-p $(DOCS_PORT):$(DOCS_PORT) \
-v "$(CURDIR):/work" \
-w /work \
node:22-bookworm \
sh -lc "npx mint dev --port $(DOCS_PORT) --host 0.0.0.0"

docs-host:
npx mint dev

lint:
go fmt ./...
golangci-lint run
Expand All @@ -23,5 +35,5 @@ lint:
test: build
go test -v -race ./...

publish-cloudsmith:
bash ./scripts/publish-cloudsmith.sh
publish-aptly-repo:
bash ./scripts/publish-aptly-repo.sh
78 changes: 1 addition & 77 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,82 +1,6 @@
# sitectl CLI

Command line utility to interact with your local and remote docker compose sites.

## Install

### Homebrew

You can install `sitectl` using homebrew

```bash
brew tap libops/homebrew https://github.com/libops/homebrew
brew install libops/homebrew/sitectl
```

### Download Binary

Instead of homebrew, you can download a binary for your system from [the latest release of sitectl](https://github.com/libops/sitectl/releases/latest)

Then put the binary in a directory that is in your `$PATH`

### Linux Packages

Releases also publish native Linux packages for:

- Alpine (`.apk`)
- Debian and Ubuntu (`.deb`)
- Fedora and other RPM-based distributions (`.rpm`)

[![OSS hosting by Cloudsmith](https://img.shields.io/badge/OSS%20hosting%20by-cloudsmith-blue?logo=cloudsmith&style=flat-square)](https://cloudsmith.com)

Linux package repository hosting is graciously provided by [Cloudsmith](https://cloudsmith.com).

## Usage

```bash
$ sitectl --help
Interact with your docker compose site

Usage:
sitectl [command]

Available Commands:
completion Generate the autocompletion script for the specified shell
compose Run docker compose commands on sitectl contexts
config Manage sitectl command configuration
help Help about any command
make Run custom make commands
port-forward Forward one or more local ports to a service
sequelace Connect to your MySQL/Mariadb database using Sequel Ace (Mac OS only)

Flags:
--context string The sitectl context to use. See sitectl config --help for more info (default "local")
-h, --help help for sitectl
--log-level string The logging level for the command (default "DEBUG")

Use "sitectl [command] --help" for more information about a command.
```

## Why sitectl vs Docker Context?

While [Docker's native context feature](https://docs.docker.com/engine/manage-resources/contexts/) handles basic daemon connections, `sitectl` is purpose-built for Docker Compose projects and adds:

- **Enhanced remote operations**: SFTP file operations (read env files, upload/download), sudo support, and helpful SSH error messages
- **Container utilities**: Resolve service names to containers, extract secrets/env vars to better support `exec` operations inside containers, get container IPs within Docker networks
- **Service management**: Enable/disable services in docker-compose.yml with automatic cleanup of orphaned resources and Drupal configuration
- **Compose-first design**: Set the equivalent of `DOCKER_HOST`, `COMPOSE_PROJECT_NAME`, `COMPOSE_FILE`, `COMPOSE_ENV_FILES` automatically based on sitectl context settings
- See [Docker's documentation](https://docs.docker.com/compose/how-tos/environment-variables/envvars/#configuration-details) for what these environment variables do

## Plugins

`sitectl` can be extended for project-specific needs

- [islandora](https://github.com/libops/sitectl-isle)
- [drupal](https://github.com/libops/sitectl-drupal)

## Contributing

Contributor guidance, including the TUI and command UI architecture rules, lives in [CONTRIBUTING.md](./CONTRIBUTING.md).
The docs are available at https://sitectl.libops.io


## Attribution
Expand Down
Loading
Loading