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
16 changes: 16 additions & 0 deletions .github/workflows/check-static.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Check Static Build"

on:
workflow_dispatch:

jobs:
check:
runs-on: "ubuntu-latest"

steps:
- name: "Checkout Codebase"
uses: "actions/checkout@v6"

- name: "Build Static Exectutable"
run: |
bash ./build-static.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Check Codebase"
name: "Check, Lint, Test and Build Codebase"

on:
pull_request:
Expand All @@ -10,14 +10,18 @@ jobs:

steps:
- name: "Checkout Codebase"
uses: "actions/checkout@v4"
uses: "actions/checkout@v6"

- name: "Install Nix"
uses: "DeterminateSystems/nix-installer-action@v19"
uses: "DeterminateSystems/nix-installer-action@v21"

- name: "Check, Test and Build"
- name: "Prepare CI devShell"
run: |
nix develop --command bash -c "cabal update --ignore-project && cabal dev-test-build"
nix develop .#ci --command true

- name: "Verify Codebase"
run: |
nix develop .#ci --command cabal verify

- name: "Build Docker Image"
run: |
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,24 @@ jobs:

- name: "Checkout Codebase"
if: "${{ steps.release.outputs.release_created }}"
uses: "actions/checkout@v4"
uses: "actions/checkout@v6"
with:
fetch-depth: 0

- name: "Install Nix"
if: "${{ steps.release.outputs.release_created }}"
uses: "DeterminateSystems/nix-installer-action@v19"
uses: "DeterminateSystems/nix-installer-action@v21"

- name: "Build Application"
- name: "Build Static Exectutable"
id: "build_static"
if: "${{ steps.release.outputs.release_created }}"
run: |
nix develop --command bash -c "bash build-static.sh"
bash ./build-static.sh | tee /tmp/build.log
echo "executable=$(tail -n1 /tmp/build.log)" >> $GITHUB_OUTPUT

- name: "Upload Release Artifact"
if: "${{ steps.release.outputs.release_created }}"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
gh release upload "${{ steps.release.outputs.tag_name }}" /tmp/clompse-static-linux-x86_64
gh release upload "${{ steps.release.outputs.tag_name }}" "${{ steps.build_static.outputs.executable }}"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
*.cabal
*~
/.direnv
/.envrc
/.stack-work
/config.yaml
/dist
/dist-newstyle
/result
/stack.yaml.lock
/tmp
4 changes: 2 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CHANGELOG.md
LICENSE.md
dist-newstyle/
dist/
nix/
*.md
9 changes: 8 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
{
"tabWidth": 2,
"printWidth": 120,
"singleQuote": false,
"trailingComma": "es5",
"printWidth": 120,
"overrides": [
{
"files": "*.md",
"options": {
"printWidth": 80,
"proseWrap": "always"
}
},
{
"files": "package.yaml",
"options": {
Expand Down
8 changes: 8 additions & 0 deletions .stan.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Big tuples
# Using tuples of big size (>= 4) can decrease code readability
# In serveral places Stack uses 4-tuples and in one place Stack uses a
# 5-tuple.
[[check]]
id = "STAN-0302"
scope = "all"
type = "Exclude"
25 changes: 25 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#:schema taplo://taplo.toml

include = ["*.toml"]
exclude = []

[formatting]

align_entries = false # Align entries vertically. Entries that have table headers, comments, or blank lines between them are not aligned.(default false)
align_comments = true # Align consecutive comments after entries and items vertically. This applies to comments that are after entries or array items.(default true)
array_trailing_comma = true # Put trailing commas for multiline arrays.(default true)
array_auto_expand = true # Automatically expand arrays to multiple lines (default true)
array_auto_collapse = false # Automatically collapse arrays if they fit in one line.(default true)
compact_arrays = true # Omit whitespace padding inside single-line arrays.(default true)
compact_inline_tables = false # Omit whitespace padding inside inline tables.(default false)
inline_table_expand = true # Expand values (e.g. arrays) inside inline tables.(default true)
compact_entries = false # Omit whitespace around =. (default false)
column_width = 80 # Target maximum column width after which arrays are expanded into new lines.(default 80)
indent_tables = false # Indent subtables if they come in order(default false)
indent_entries = false # Indent entries under tables.(default false)
indent_string = " " # Indentation to use, should be tabs or spaces but technically could be anything. 2 spaces (" ")
trailing_newline = true # Add trailing newline to the source. (default true)
reorder_keys = false # Alphabetically reorder keys that are not separated by blank lines. (default false)
reorder_arrays = false # Alphabetically reorder array values that are not separated by blank lines. (default false)
allowed_blank_lines = 1 # The maximum amount of consecutive blank lines allowed. (default 2)
crlf = false # Use CRLF line endings. (default false)
99 changes: 42 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,79 +13,73 @@

> [!WARNING]
>
> This is an experimental project that is in its early stages of
> development. Both the functionality and API are subject to change at
> any time.
> This is an experimental project that is in its early stages of development.
> Both the functionality and API are subject to change at any time.
>
> It is not recommended to use this in production or any other
> critical environment. Use at your own risk.
> It is not recommended to use this in production or any other critical
> environment. Use at your own risk.

**clompse** is a command-line tool designed to provide a unified
interface to various cloud providers, helping you manage a registry of
your cloud resources.
**clompse** is a command-line tool designed to provide a unified interface to
various cloud providers, helping you manage a registry of your cloud resources.

It consumes a JSON/YAML formatted configuration file that lists
various profiles where each contains a number of cloud provider API
credentials. It then allows you to query and list cloud resources
across these providers. The output can be displayed in tabular format
on the console or exported to a file in CSV or JSON format.
It consumes a JSON/YAML formatted configuration file that lists various profiles
where each contains a number of cloud provider API credentials. It then allows
you to query and list cloud resources across these providers. The output can be
displayed in tabular format on the console or exported to a file in CSV or JSON
format.

Currently, it supports listing cloud servers with their firewall
configurations, object storage buckets, DNS zones, and records for the
following cloud service providers:
Currently, it supports listing cloud servers with their firewall configurations,
object storage buckets, DNS zones, and records for the following cloud service
providers:

1. Amazon Web Services
2. DigitalOcean
3. Hetzner

## Motivation

Using cloud services has become common for many individuals and
organizations. As the number of cloud resources grows, it becomes
increasingly difficult to keep track of them. This tool aims to
provide a unified interface to query and list commonly-used cloud
resources across different cloud providers.
Using cloud services has become common for many individuals and organizations.
As the number of cloud resources grows, it becomes increasingly difficult to
keep track of them. This tool aims to provide a unified interface to query and
list commonly-used cloud resources across different cloud providers.

While there are many tools and SaaS solutions that offer similar or
more advanced functionality, they are often too complex, too
complicated, or too expensive for individual hackers. This tool is a
more humble alternative to such solutions.
While there are many tools and SaaS solutions that offer similar or more
advanced functionality, they are often too complex, too complicated, or too
expensive for individual hackers. This tool is a more humble alternative to such
solutions.

## Non-Motivation

This tool is not intended to be a full-fledged cloud management
tool. It is not a replacement for the cloud providers' own management
consoles or APIs.
This tool is not intended to be a full-fledged cloud management tool. It is not
a replacement for the cloud providers' own management consoles or APIs.

It also does not provide functionality to create, update, or delete
cloud resources, nor is such functionality planned: it is a read-only
interface to cloud resources.
It also does not provide functionality to create, update, or delete cloud
resources, nor is such functionality planned: it is a read-only interface to
cloud resources.

## Challenge

Not all cloud providers offer APIs that list resources as conveniently
as others. Additionally, the exposed properties of similar resources
may differ between providers.
Not all cloud providers offer APIs that list resources as conveniently as
others. Additionally, the exposed properties of similar resources may differ
between providers.

To address this, the tool defines common data types for cloud
resources and maps cloud provider-specific data types to these common
types. It is not always possible to map all properties of a cloud
resource to a common data type. In such cases, the tool will assume
some (hopefully) reasonable defaults or omit such properties
altogether.
To address this, the tool defines common data types for cloud resources and maps
cloud provider-specific data types to these common types. It is not always
possible to map all properties of a cloud resource to a common data type. In
such cases, the tool will assume some (hopefully) reasonable defaults or omit
such properties altogether.

## Installation

Download and install the statically compiled binary for Linux
(x86_64):
Download and install the statically compiled binary for Linux (x86_64):

```sh
curl -Lo /tmp/clompse https://github.com/vst/clompse/releases/latest/download/clompse-static-linux-x86_64
sudo install -m 755 /tmp/clompse /usr/local/bin/clompse
```

Or install it into your `nix` profile (replace `<VERSION>` with the
latest version):
Or install it into your `nix` profile (replace `<VERSION>` with the latest
version):

```sh
nix profile install --file https://github.com/vst/clompse/archive/v<VERSION>.tar.gz
Expand Down Expand Up @@ -163,25 +157,16 @@ Provision Nix shell via `direnv`:
direnv allow
```

Big, long build command for the impatient:
Check, lint, test and build everything with this:

```sh
hpack &&
direnv reload &&
fourmolu -i app/ src/ test/ &&
prettier --write . &&
find . -iname "*.nix" -not -path "*/nix/sources.nix" -print0 | xargs --null nixpkgs-fmt &&
hlint app/ src/ test/ &&
cabal build -O0 &&
cabal run -O0 clompse -- --version &&
cabal v1-test &&
cabal haddock -O0
cabal verify [-c | --clean]
```

## License

Copyright &copy; 2024-2025 Vehbi Sinan Tunalioglu. This work is licensed
under [MIT License].
Copyright &copy; 2024-2025 Vehbi Sinan Tunalioglu. This work is licensed under
[MIT License].

<!-- REFERENCES -->

Expand Down
Loading