Skip to content

Commit

Permalink
jitsucom-jitsu-{console,rotor}
Browse files Browse the repository at this point in the history
Signed-off-by: Batuhan Apaydin <batuhan.apaydin@chainguard.dev>
  • Loading branch information
developer-guy committed May 8, 2024
1 parent e8793ee commit 3f8df40
Show file tree
Hide file tree
Showing 9 changed files with 301 additions and 0 deletions.
9 changes: 9 additions & 0 deletions generated.tf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions images/jitsucom-jitsu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!--monopod:start-->
# jitsucom-jitsu
| | |
| - | - |
| **OCI Reference** | `cgr.dev/chainguard/jitsucom-jitsu` |


* [View Image in Chainguard Academy](https://edu.chainguard.dev/chainguard/chainguard-images/reference/jitsucom-jitsu/overview/)
* [View Image Catalog](https://console.enforce.dev/images/catalog) for a full list of available tags.
* [Contact Chainguard](https://www.chainguard.dev/chainguard-images) for enterprise support, SLAs, and access to older tags.*

---
<!--monopod:end-->

<!--overview:start-->
Jitsu is an open-source Segment alternative. Fully-scriptable data ingestion engine for modern data teams. Set-up a real-time data pipeline in minutes, not days
<!--overview:end-->

<!--getting:start-->
## Download this Image
The image is available on `cgr.dev`:

```
docker pull cgr.dev/chainguard/jitsucom-jitsu:latest
```
<!--getting:end-->

<!--body:start-->

## Usage

There is no official Helm chart providied for Jitsu, but you can use the following Helm chart to deploy Jitsu on your Kubernetes cluster.

Here is the issue that they discussed: https://github.com/jitsucom/jitsu/issues/880

And here is the Helm chart that you can use: https://github.com/stafftastic/jitsu-chart

which is the Helm chart we used to deploy Jitsu on Kubernetes during the tests.


```yaml
$ helm install jitsu oci://registry-1.docker.io/stafftasticcharts/jitsu -f-<<EOF
console:
image:
repository: cgr.dev/chainguard/jitsucom-jitsu-console
tag: latest
pullPolicy: IfNotPresent
rotor:
image:
repository: cgr.dev/chainguard/jitsucom-jitsu-rotor
tag: latest
pullPolicy: IfNotPresent
EOF
```

<!--body:end-->
25 changes: 25 additions & 0 deletions images/jitsucom-jitsu/configs/console/template.apko.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
contents:
packages: [
"busybox",
]

accounts:
groups:
- groupname: nonroot
gid: 65532
users:
- username: nonroot
uid: 65532
gid: 65532
run-as: 65532

# Currently there are some packages required that are only available in
# the x86_64 variety.
archs:
- x86_64

environment:
NODE_ENV: production

entrypoint:
command: sh -c "/app/docker-start-console.sh"
24 changes: 24 additions & 0 deletions images/jitsucom-jitsu/configs/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
terraform {
required_providers {
apko = { source = "chainguard-dev/apko" }
}
}

variable "extra_packages" {
description = "The additional packages to install"
default = []
}

variable "name" {
description = "The name of the component"
default = "console"
}

data "apko_config" "this" {
config_contents = file("${path.module}/${var.name}/template.apko.yaml")
extra_packages = var.extra_packages
}

output "config" {
value = jsonencode(data.apko_config.this.config)
}
29 changes: 29 additions & 0 deletions images/jitsucom-jitsu/configs/rotor/template.apko.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
contents:
packages: [
"busybox",
]

accounts:
groups:
- groupname: nonroot
gid: 65532
users:
- username: nonroot
uid: 65532
gid: 65532
run-as: 65532

# Currently there are some packages required that are only available in
# the x86_64 variety.
archs:
- x86_64

environment:
NODE_ENV: production

work-dir: /app

entrypoint:
command: /usr/local/bin/docker-entrypoint.sh

cmd: --no-node-snapshot --max-old-space-size=2048 main.js
13 changes: 13 additions & 0 deletions images/jitsucom-jitsu/generated.tf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions images/jitsucom-jitsu/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
terraform {
required_providers {
oci = { source = "chainguard-dev/oci" }
}
}

locals {
components = toset([
"console",
"rotor",
])
}

variable "target_repository" {
description = "The docker repo into which the image and attestations should be published."
}

module "config" {
for_each = local.components
source = "./configs"
name = each.key
extra_packages = ["jitsucom-jitsu-${each.key}"]
}

module "jitsucom-jitsu" {
for_each = local.components
source = "../../tflib/publisher"
name = basename(path.module)
target_repository = "${var.target_repository}-${each.key}"
config = module.config[each.key].config

build-dev = true
main_package = "jitsucom-jitsu-${each.key}"
}

module "test" {
source = "./tests"
digests = { for k, v in module.jitsucom-jitsu : k => v.image_ref }
}

resource "oci_tag" "latest" {
for_each = local.components
depends_on = [module.test]
digest_ref = module.jitsucom-jitsu[each.key].image_ref
tag = "latest"
}

resource "oci_tag" "latest-dev" {
for_each = local.components
depends_on = [module.test]
digest_ref = module.jitsucom-jitsu[each.key].dev_ref
tag = "latest-dev"
}

12 changes: 12 additions & 0 deletions images/jitsucom-jitsu/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: jitsucom-jitsu
image: cgr.dev/chainguard/jitsucom-jitsu
logo: https://storage.googleapis.com/chainguard-academy/logos/jitsucom-jitsu.svg
endoflife: ""
console_summary: ""
short_description: Jitsu is an open-source Segment alternative. Fully-scriptable data ingestion engine for modern data teams. Set-up a real-time data pipeline in minutes, not days
compatibility_notes: ""
readme_file: README.md
upstream_url: https://github.com/jitsucom/jitsu
keywords:
- jitsu
- application
79 changes: 79 additions & 0 deletions images/jitsucom-jitsu/tests/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
terraform {
required_providers {
oci = { source = "chainguard-dev/oci" }
imagetest = { source = "chainguard-dev/imagetest" }
}
}

variable "digests" {
description = "The image digest to run tests over."
type = object({
console = string
rotor = string
})
}

data "oci_string" "ref" {
for_each = var.digests
input = each.value
}

data "imagetest_inventory" "this" {}

resource "imagetest_harness_k3s" "this" {
name = "jitsucom-bulker"
inventory = data.imagetest_inventory.this

sandbox = {
mounts = [
{
source = path.module
destination = "/tests"
}
]
}
}

module "helm" {
source = "../../../tflib/imagetest/helm"

name = "jitsucom-jitsu"
chart = "oci://registry-1.docker.io/stafftasticcharts/jitsu"

values = {
console = {
image = {
repository = data.oci_string.ref["console"].registry_repo
tag = data.oci_string.ref["console"].pseudo_tag
}
}
rotor = {
image = {
repository = data.oci_string.ref["rotor"].registry_repo
tag = data.oci_string.ref["rotor"].pseudo_tag
}
}
tokenGenerator = {
image = {
tag = "1.30.0" # Latest is not exist.
}
}
}
}

resource "imagetest_feature" "basic" {

Check failure on line 64 in images/jitsucom-jitsu/tests/main.tf

View workflow job for this annotation

GitHub Actions / build-the-world (0, jitsucom-jitsu)

failed to test feature

module.jitsucom-jitsu.module.test.imagetest_feature.basic
name = "Basic"
description = "Basic Helm install for bank-vaults"
harness = imagetest_harness_k3s.this

steps = [
{
name = "Helm install"
cmd = module.helm.install_cmd
},
]

labels = {
type = "k8s"
}
}

0 comments on commit 3f8df40

Please sign in to comment.