Skip to content
Open
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
147 changes: 147 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Build

on:
push:
branches: [master]
pull_request:
branches: [master]
# release:
# types: [published]
workflow_dispatch:

jobs:
build-linux:
name: Build Linux
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- { name: amd64, target: x86_64-linux-gnu, apt: gcc }
- {
name: arm64,
target: aarch64-linux-gnu,
apt: gcc-aarch64-linux-gnu,
}
- {
name: ppc64le,
target: powerpc64le-linux-gnu,
apt: gcc-powerpc64le-linux-gnu,
}
- {
name: s390x,
target: s390x-linux-gnu,
apt: gcc-s390x-linux-gnu,
}
- {
name: riscv64,
target: riscv64-linux-gnu,
apt: gcc-riscv64-linux-gnu,
}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install cross-compilation toolchain
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.arch.apt }}

- name: Build all & vlmcsdmulti
run: |
if [ "${{ matrix.arch.name }}" = "amd64" ]; then
# Native build for amd64
make clean
make all vlmcsdmulti STRIP=0
else
# Cross-compilation for other architectures
make clean
make all vlmcsdmulti CC=${{ matrix.arch.target }}-gcc STRIP=0
fi

- name: Prepare artifacts
run: |
mkdir -p artifacts/linux-${{ matrix.arch.name }}
cp -r bin artifacts/linux-${{ matrix.arch.name }}
cp -r lib artifacts/linux-${{ matrix.arch.name }}

- name: Upload Linux artifacts
uses: actions/upload-artifact@v4
with:
name: vlmcsd-linux-${{ matrix.arch.name }}
path: artifacts/linux-${{ matrix.arch.name }}/
retention-days: 30

build-windows:
name: Build Windows
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- {
name: amd64,
target: x86_64-w64-mingw32,
apt: gcc-mingw-w64-x86-64,
}
- {
name: x86,
target: i686-w64-mingw32,
apt: gcc-mingw-w64-i686,
}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install MinGW cross-compilation toolchain
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.arch.apt }}

- name: Build all & vlmcsdmulti for Windows
run: |
make clean
make all vlmcsdmulti CC=${{ matrix.arch.target }}-gcc STRIP=0

- name: Prepare artifacts
run: |
mkdir -p artifacts/windows-${{ matrix.arch.name }}
cp -r bin artifacts/windows-${{ matrix.arch.name }}
cp -r lib artifacts/windows-${{ matrix.arch.name }}

- name: Upload Windows artifacts
uses: actions/upload-artifact@v4
with:
name: vlmcsd-windows-${{ matrix.arch.name }}
path: artifacts/windows-${{ matrix.arch.name }}/
retention-days: 30

# release:
# name: Create Release Assets
# runs-on: ubuntu-latest
# needs: [build-linux, build-windows]
# if: github.event_name == 'release'

# steps:
# - name: Download all artifacts
# uses: actions/download-artifact@v4
# with:
# path: artifacts/

# - name: Create release archives
# run: |
# cd artifacts/
# for dir in */; do
# archive_name="${dir%/}.tar.gz"
# tar -czf "../$archive_name" -C "$dir" .
# done
# cd ..
# ls -la *.tar.gz

# - name: Upload release assets
# uses: softprops/action-gh-release@v1
# with:
# files: |
# *.tar.gz
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107 changes: 107 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Build and Publish Docker Image

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
# push:
# branches: [master]
# pull_request:
# branches: [master]
# release:
# types: [published]
workflow_dispatch:

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

jobs:
docker-publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@v3

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
type=sha

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
file: ./.docker/Dockerfile
platforms: >-
linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/riscv64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
6 changes: 3 additions & 3 deletions .systemd/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ mkdir -p /etc/systemd/system
cat <<EOF > /etc/systemd/system/vlmcsd.service
[Unit]
Description=Volume License Management Service
Documentation=https://github.com/tfslabs/vlmcsd
Documentation=https://github.com/tfslabs/vlmcsd/wiki
After=network.target
StartLimitBurst=3
StartLimitIntervalSec=60

[Service]
Type=simple
ExecStart=/usr/bin/vlmcsd -P 1688 -H 26100 -C 1033 -l /var/log/vlmcsd.log -T1 -e -D
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we leave verbose in file logging?

I mean, if each "request" take 1.5Kb, and let the service run for like, a year, I am not sure how big it can be.

Copy link
Member

@anhvlt-2k6 anhvlt-2k6 Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, but you leave comment on the wrong segment. 🥺

Edit:

Well, I confirmed that this is the real issue. I will make a change at the lab later to see if there is any potential information that will be removed from the logging.

ExecStart=/usr/bin/vlmcsd -P 1688 -H 26100 -C 1033 -l /tmp/vlmcsd.log -T1 -v -D
TimeoutStartSec=0
RestartSec=2
Restart=always
Expand All @@ -77,4 +77,4 @@ systemctl daemon-reload
echo "Enabling and starting vlmcsd service..."
systemctl enable --now vlmcsd

echo "Installation complete!"
echo "Installation complete!"
2 changes: 1 addition & 1 deletion src/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ endif
../build/%.o: %.c
ifeq ($(VERBOSE),1)
+$(CC) -x$(COMPILER_LANGUAGE) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(PLATFORMFLAGS) -c $< -o $@
$(CC) -S $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(PLATFORMFLAGS) -o ../build/$*.asm $<
+$(CC) -S $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(PLATFORMFLAGS) -o ../build/$*.asm $<
ifeq ($(DEPENDENCIES),1)
+$(CC) -x$(COMPILER_LANGUAGE) $(PLATFORMFLAGS) $(BASECFLAGS) $(CFLAGS) $(PLATFORMFLAGS) -MM -MF $*.d $< -MT $@
endif
Expand Down
Loading