Sign inSign up

eduard1001171985/flufik

By eduard1001171985

Updated almost 4 years ago

Lightweight RedHat and Debian based package repository service and package builder

Image
0

2.4K

eduard1001171985/flufik repository overview

Flufik repository service:

Flufik repository service container is small, fast, fully written on GO application.

Now enabled feature:

  • Debian/Ubuntu repository services
  • RedHat based repository service
  • Image is rootless

Future updates:

  • home-brew repository service

Variables supported:

  • FLUFIK_DEBUG=0

debugging maybe enabled during provisioning container or during runtime enable for current session

  • FLUFIK_PUBLIC_URL=flufik.com

public url of flufik container

  • FLUFIK_SUPPORT_ARCH=all i386 amd64 arm64

the list of CPU architectures that flufik debian repositories support this variable is only required by Debian repositories the supported values are: all, i386, aarch64 all means packages without a specific architecture requirement values should be separated by a space

  • FLUFIK_SECTIONS=main

the namespaces that logically separate groups of debian packages for example main, dev, beta own values are possible only required by Debian repositories

  • FLUFIK_DISTRO_NAMES=stable

the logical partitions within a section for a Debian based repository

  • FLUFIK_RPM_REPO_NAME=flufik

the global name of the rpm repository, it must be provided

  • FLUFIK_RPM_REPO_SUPPORTED_OSNAME

RedHat based os list - example rhel centos fedora

  • FLUFIK_RPM_REPO_RHEL_SUPPORTED_VERSION

RedHat based version - example 7 8 9 10

  • FLUFIK_RPM_REPO_FEDORA_SUPPORTED_VERSION

Fedora versions - example 33 34 35 36

  • FLUFIK_RPM_REPO_SUPPORTED_ARCH

RedHat based packages support - example noarch aarch64 x86_64 s390x

Launching Flufik

$ docker volume create flufik
# launch the container on host port 8080 with a volume target /data in the container
$ docker run -d --name flufik \
        -p 80:8080 \
        -e FLUFIK_DEBUG=0 -e FLUFIK_PUBLIC_URL=example.com -e FLUFIK_SUPPORT_ARCH=all i386 amd64 arm64 \
        -e FLUFIK_SECTIONS=main -e FLUFIK_DISTRO_NAMES=stable -e FLUFIK_RPM_REPO_NAME=flufik \
        -e FLUFIK_RPM_REPO_SUPPORTED_OSNAME=rhel centos fedora -e FLUFIK_RPM_REPO_RHEL_SUPPORTED_VERSION=7 8 9 10 \
        -e FLUFIK_RPM_REPO_FEDORA_SUPPORTED_VERSION=33 34 35 36 -e FLUFIK_RPM_REPO_SUPPORTED_ARCH=noarch aarch64 x86_64 s390x
        -v flufik:/opt/flufik \
        eduard1001171985/flufik

If you want to use compose, create a docker-compose.yaml file as follows:

version: "3.8"
services:
  flufik:
    image: eduard1001171985/flufik
    container_name: flufik
    ports:
      - "8080:8080"
    environment:
      - FLUFIK_DEBUG=0
      - FLUFIK_PUBLIC_URL=flufik.com
      - FLUFIK_SUPPORT_ARCH=all i386 amd64 arm64
      - FLUFIK_SECTIONS=main
      - FLUFIK_DISTRO_NAMES=focal buster bullseye jammy kinetic
      - FLUFIK_RPM_REPO_NAME=redhat
      - FLUFIK_RPM_REPO_SUPPORTED_OSNAME=rhel centos fedora
      - FLUFIK_RPM_REPO_RHEL_SUPPORTED_VERSION=7 8 9 10
      - FLUFIK_RPM_REPO_FEDORA_SUPPORTED_VERSION=33 34 35 36
      - FLUFIK_RPM_REPO_SUPPORTED_ARCH=noarch aarch64 x86_64 s390x
    networks:
      - flufik
    volumes:
      - flufik:/opt/flufik
volumes:
  flufik:

networks:
  flufik:
    driver: bridge

then to launch the flufik:

$ docker compose up -d

If you want to launch on Kubernetes:

#statefulset.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  annotations: {}
  labels:
    app.kubernetes.io/instance: flufik
    app.kubernetes.io/name: flufik
  name: flufik
spec:
  podManagementPolicy: OrderedReady
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app.kubernetes.io/instance: flufik
      app.kubernetes.io/name: flufik
  serviceName: flufik-svc
  template:
    metadata:
      creationTimestamp: null
      labels:
        app.kubernetes.io/instance: flufik
        app.kubernetes.io/name: flufik
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser: 1000
        runAsGroup: 1000
        fsGroup: 1000
      containers:
        - image: eduard1001171985/flufik
          imagePullPolicy: IfNotPresent
          name: flufik
          env:
            - name: FLUFIK_DEBUG
              value: "0"
            - name: FLUFIK_PUBLIC_URL
              value: "flufik.com"
            - name: FLUFIK_SUPPORT_ARCH
              value: "all i386 amd64 arm64"
            - name: FLUFIK_SECTIONS
              value: "main"
            - name: FLUFIK_DISTRO_NAMES
              value: "focal buster bullseye jammy kinetic"
            - name: FLUFIK_RPM_REPO_NAME
              value: "rpmrepo"
            - name: FLUFIK_RPM_REPO_SUPPORTED_OSNAME
              value: "rhel centos fedora"
            - name: FLUFIK_RPM_REPO_RHEL_SUPPORTED_VERSION
              value: "7 8 9 10"
            - name: FLUFIK_RPM_REPO_FEDORA_SUPPORTED_VERSION
              value: "33 34 35 36"
            - name: FLUFIK_RPM_REPO_SUPPORTED_ARCH
              value: "noarch aarch64 x86_64 s390x"
          ports:
            - containerPort: 8080
              name: registry
              protocol: TCP
          resources: {}
          securityContext: {}
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
            - mountPath: /opt/flufik
              name: flufik-data
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      terminationGracePeriodSeconds: 30
  updateStrategy:
    rollingUpdate:
      partition: 0
    type: RollingUpdate
  volumeClaimTemplates:
    - apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
        creationTimestamp: null
        name: flufik-data
      spec:
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: 10Gi
        volumeMode: Filesystem
#service.yaml
apiVersion: v1
kind: Service
metadata:
  annotations: {}
  labels:
    app.kubernetes.io/instance: flufik
    app.kubernetes.io/name: flufik
  name: flufik-svc
spec:
  ports:
    - name: flufik
      port: 80
      protocol: TCP
      targetPort: 8080
  selector:
    app.kubernetes.io/instance: flufik
    app.kubernetes.io/name: flufik
  sessionAffinity: None
  type: ClusterIP
#ingress.yaml
#if ingress is Traefik
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-production
    kubernetes.io/ingress.class: traefik
  labels:
    app.kubernetes.io/instance: flufik
    app.kubernetes.io/name: flufik
  name: flufik
spec:
  rules:
    - host: flufik.com
      http:
        paths:
          - backend:
              service:
                name: flufik-svc
                port:
                  number: 80
            path: /
            pathType: ImplementationSpecific
  tls:
    - hosts:
        - flufik.com
      secretName: tls-flufik
#if ingress is nginx
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-production
    kubernetes.io/ingress.class: nginx
  labels:
    app.kubernetes.io/instance: flufik
    app.kubernetes.io/name: flufik
  name: flufik
spec:
  rules:
    - host: flufik.com
      http:
        paths:
          - backend:
              service:
                name: flufik-svc
                port:
                  number: 80
            path: /
            pathType: ImplementationSpecific
  tls:
    - hosts:
        - flufik.com
      secretName: tls-flufik

then to launch the flufik:

$ ls
statefulset.yaml
service.yaml
ingress.yaml

$ kubectl create -n <NAMESPACE> -f .

How to use:

INFO: To push packages to flufik service authentication required. Initial admin user is automatically generated with random strong password and stored inside container under /opt/flufik/.flufik/service/initial-user.txt

Get initial admin user credential:

#Docker
docker exec -it flufik /bin/bash

#Kubernetes
$ kubectl exec -it flufik-0 -n <NAMESPACE> /bin/bash

$ cat /opt/flufik/.flufik/service/initial-user.txt

Download flufik latest client from HERE

  1. Upload package
#package for Debian based operating systems
$ flufik push generic -u admin -p <PASSWORD> --apt -f flufik.com -d focal -a amd64 -s main -b flufik_0.4.0-8.ubuntu_amd64.deb

#package for RedHat based operating systems
$ flufik push generic -u admin -p <PASSWORD> --yum -f flufik.com -d rhel -a amd64 --os-version 9 -b flufik-0.3.0-8.el8.x86_64.rpm

3a. Manual use of flufik repository

#For Debian based operating systems
$ wget -qO - https://flufik.com/public/flufik_pub.pgp | sudo apt-key add -
$ echo 'deb https://flufik.com/ stable main' >> /etc/apt/sources.list
$ apt-get update
$ apt-get install flufik

#For RedHat based operating systems
$ sudo sh -c "echo '[flufik]
name=flufik
baseurl=https://flufik.com/flufik
enabled=1
gpgcheck=0
priority=1' > /etc/yum.repos.d/flufik.repo"
$ sudo yum update -y
$ sudo yum install flufik -y

3b. Easy use of flufik repository

$ curl -fsSL https://flufik.com/install/get.sh | bash -s flufik

User management

Create user

#Note: password will be always autogenerated using strong password policy
$ curl -XPOST 'https://flufik.com/user/add/demo/admin' -u 'admin:<PASSWORD>'
Result:
demo user created with authorisation level admin
"Password keep safe: TO@g%r!HF30W56S"

Change user password

#Note: password will be always autogenerated using strong password policy
$ curl -XPOST 'https://flufik.com/user/update/demo' -u 'admin:<PASSWORD>'
Result:
password for user demo updated
"Password updated keep safe: 5l9WC\u0026UnNA%8p6*"

Delete user

#Note: password will be always autogenerated using strong password policy
$ curl -XPOST 'https://flufik.com/user/delete/demo' -u 'admin:<PASSWORD>'
Result:
user demo deleted
"User deleted: demo"

Tag summary

Content type

Image

Digest

sha256:648f2a4e2

Size

83.5 MB

Last updated

almost 4 years ago

docker pull eduard1001171985/flufik