Skip to content

Commit

Permalink
feat: add samples for Fedora 39, Rocky Linux 9, CentOS 9
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Sep 2, 2024
1 parent 691d700 commit 521d899
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
workflow_dispatch:

concurrency:
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -30,9 +34,6 @@ jobs:
- name: Test
run: ./sinatra.teb -h

- name: Look around
run: ls -la

- name: Start packaged Sinatra application
run: ./sinatra.teb &
env:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
pull_request:
workflow_dispatch:

concurrency:
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
cancel-in-progress: true

jobs:
test:
runs-on: ${{ matrix.os }}
Expand Down
106 changes: 106 additions & 0 deletions .github/workflows/rhel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Copyright (c) 2024 [Ribose Inc](https://www.ribose.com).
# All rights reserved.
# This file is a part of tamatebako
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

name: RHEL

on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:

concurrency:
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
cancel-in-progress: true

jobs:
create-package:
name: Create tebako package
runs-on: ubuntu-latest
steps:
- name: Checkout sample
uses: actions/checkout@v4

- name: Create tebako package
run: |
docker run -v $PWD:/mnt/w -t ghcr.io/tamatebako/tebako-ubuntu-20.04:latest \
tebako press --root=/mnt/w/sinatra --entry-point=app.rb \
--output=/mnt/w/sinatra-package --Ruby=3.2.5 --patchelf
- name: Upload tebako test packages
uses: actions/upload-artifact@v4
with:
name: sinatra-package
retention-days: 1
path: |
sinatra-package
run-package:
name: Run on ${{ matrix.container }}
runs-on: ubuntu-latest
needs: [ create-package ]
strategy:
fail-fast: false
matrix:
container:
- 'rockylinux:9'
- 'fedora:39'
- 'quay.io/centos/centos:stream9'
container:
image: ${{ matrix.container }}
steps:
- name: Download test packages
uses: actions/download-artifact@v4
with:
name: sinatra-package

- name: Install OpenSSL 1.1
run: |
dnf -y install procps-ng
if [ "${{matrix.container}}" = "rockylinux:9" -o "${{matrix.container}}" = "quay.io/centos/centos:stream9" ] ; then
dnf -y install compat-openssl11
elif [ "${{matrix.container}}" = "fedora:39" ] ; then
dnf -y install openssl1.1
fi
- name: Adjust package permissions
run: chmod +x sinatra-package

- name: Smoke check
run: ./sinatra-package -h

- name: Start packaged Sinatra application
run: ./sinatra-package &
env:
PORT: 4567

- name: Wait for Sinatra to start
run: sleep 10

- name: Place GET request
run: curl http://localhost:4567

- name: End Sinatra application
run: pkill -f sinatra-package
31 changes: 31 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This launches a Sinatra server that responds at:
* http://127.0.0.1:4567
* http://127.0.0.1:4567/api
== Packaging for MacOS
== Prequisites

Before using Tebako, please first setup prerequisites as described in tebako README https://github.com/tamatebako/tebako
Expand Down Expand Up @@ -37,3 +38,33 @@ Note: please do not package "in-place" like
tebako press -e app.rb -o sample.tebako -r ./
----
Tebako includes all files starting from the root folder into package and packaging "in-place" will force endless recursive inclusion of the package into itself.

== Packaging for Ubuntu 20 and Alpine Linux

Packaging for Ubuntu and Alpine Linux employs Tebako Docker containers (https://github.com/tamatebako/tebako-ci-containers) available through ghrc.io.

There are no prerequisites for using these containers.

Packaging is done from inside containers, were the following command is executed:

[source,sh]
----
tebako press -e app.rb -o sinatra.teb -r sinatra -R 3.2.5
----

== Packaging for other RHEL-based distributions
This sample shows hoe to create portable tebako package for GNU Linux distributions.

[source,sh]
----
docker run -v $PWD:/mnt/w -t ghcr.io/tamatebako/tebako-ubuntu-20.04:latest \
tebako press --root=/mnt/w/sinatra --entry-point=app.rb \
--output=/mnt/w/sinatra-package --Ruby=3.2.5 --patchelf
----

Container will mount current directory to /mnt/w and package the application in /mnt/w/sinatra-package
Experimental --patchelf option is used to fix ELF headers in the package to make it portable across different versions of GLIBC.
Please refer to tebako README https://github.com/tamatebako/tebako for more information.

Please note that there is one caveat with this approach. The package will be built against OpenSSL 1.1.1 that needs to be installed at the target system.
If the target system has different version of OpenSSL, the package will not work.

0 comments on commit 521d899

Please sign in to comment.