artifacts

by joaquinito2051

Helm chartv8.0.0-latest

A Helm chart for the Punch Artifacts

About this chart

Punch Artifacts Server

The Punch Artifacts Server includes a Restful API and a UI to manage artifacts like parsers, pex, custom node, or generic binaries.

Configuration

Kubernetes configuration

Image

ConfigurationDescriptionDefault value
image.nameThe Artifacts docker imageghcr.io/punchplatform/artifacts-server:7.0.1-SNAPSHOT
image.policyThe Kubernetes image pull policyIfNotPresent
image.secretSecret name to pull docker imageadmin-secret

Ingress

ConfigurationDescriptionDefault value
ingress.enabledEnable Artifacts access from outsidetrue
ingress.urlExternal URL of the artifactsartifacts.dpsc

Artifacts configuration

Server

server:
  port: 4245


web:
  enabled: true

application:
    tenant:
      name: mytenant
#    roles:
#      ROLE_USER:
#        - UPLOAD_ARTIFACTS
#      ROLE_ADMIN:
#        - UPLOAD_ARTIFACTS
#        - DELETE_ARTIFACTS
ConfigurationDescriptionDefault value
server.portPort of the Restful API server4245
web.enabledEnable UItrue
application.tenant.nameTenant to use, used as index prefix for ES and bucket for S3mytenant
application.rolesRole to use see OAUTH section bellow
application.file_sizeMaximum artifact size

Metadata

Elasticsearch metadata

You can use Elasticsearch backend for metadata.

metadata:
  elasticsearch:
    hosts:
      - http://elasticsearch.doc-store:9200
    index_name: artifacts-metadata
    credentials:
      user: <user>
      password: <password>
      # token: <token>
      # token_type: <token_type>
    # ssl_enabled: true
    # ssl_hostname_verification: false
    # ssl_insecure: false
    # You can uses same SSL/TLS configuration like ElasticOutput/ElasticInput nodes, and ES metrics
ConfigurationDescriptionDefault value
metadata.elasticsearch.hostshostshttp://elasticsearch.doc-store:9200
metadata.elasticsearch.index_nameelasticsearch indexartifacts-metadata
metadata.elasticsearch.credentials.userelasticsearch user
metadata.elasticsearch.credentials.userelasticsearch password
metadata.elasticsearch.credentials.tokenelasticsearch token value
metadata.elasticsearch.credentials.token_typeelasticsearch token type

!!! info

Remember to put elasticsearch mapping first! Where you couldn't list the artifacts available.

Configmap metadata

You can use Configmap backend for metadata.

configmap:
  apiUrl: <kubernetes API URL>
ConfigurationDescriptionDefault value
metadata.configmap.apiUrlKubernetes API URL

Filesystem metadata

You can use Filesystem backend for metadata.

metadata:
  file: /tmp/artifacts/metadata
ConfigurationDescriptionDefault value
metadata.fileFilepath where metadata are saved/tmp/artifacts/metadata

Data

Minio data

You can use Minio (S3) backend for data.

data:
  minio:
    host: http://s3.object-store:9000
    access_key: minio
    secret_key: K@st2020*
ConfigurationDescriptionDefault value
data.minio.hosthostnamehttp://s3.object-store:9000
data.minio.access_keyusername / access keyminio
data.minio.secret_keypassword / secret keyK@st2020*

!!! info

Remember to create the S3 bucket (corresponding to tenant.name) before! Where you couldn't upload artifacts.

Filesystem backend

You can use Filesystem backend for data.

data:
  file: /tmp/artifacts/data
ConfigurationDescriptionDefault value
data.fileFilepath where data are saved/tmp/artifacts/data

OAuth2

Artifact server can be secured with OAUTH, for example with keycloak.

Setup OAUTH provider

Configuration bellow is default configuration used by SpringBoot using OAUTH. You can configure others providers and registrations reading official SpringBoot documentation.

# Add this configuration in application.yml
spring:
  security:
    enabled: true
    oauth2:
      client:
        provider:
          keycloak:
            authorization-uri: http://localhost:8080/auth/realms/ArtifactServerRealm/protocol/openid-connect/auth
            token-uri: http://localhost:8080/auth/realms/ArtifactServerRealm/protocol/openid-connect/token
            user-info-uri: http://localhost:8080/auth/realms/ArtifactServerRealm/protocol/openid-connect/userinfo
            jwk-set-uri: http://localhost:8080/auth/realms/ArtifactServerRealm/protocol/openid-connect/certs
            user-name-attribute: preferred_username
        registration:
          keycloak:
            client-id: login-app
            provider: keycloak
            scope: openid
            redirect-uri: http://localhost:4245/login/oauth2/code/keycloak
            client-authentication-method: basic
            authorization-grant-type: authorization_code

Bind roles with permissions

Keycloak can be used to provide roles. You can map provider roles (keycloak) to permissions and create full customizable application roles.

permissiondescription
UPLOAD_ARTIFACTSPermission to allow upload artifacts
DELETE_ARTIFACTSPermission to allow delete artifacts

For example, if you use keycloak with USER and ADMIN roles you can configure artifact server like this:

application:
  roles:
    ROLE_USER: # <= keycloak roles are prefixed by "ROLE_" in JWT 
      UPLOAD_ARTIFACTS
    ROLE_ADMIN: # <= keycloak roles are prefixed by "ROLE_" in JWT
      UPLOAD_ARTIFACTS
      DELETE_ARTIFACTS

Deploy artifacts with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has artifacts on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartartifacts is pinned at v8.0.0-latest in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply