Skip to content

Commit

Permalink
chore: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldtse committed Sep 4, 2024
1 parent 7b48747 commit 0cc2f23
Showing 1 changed file with 79 additions and 26 deletions.
105 changes: 79 additions & 26 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,9 @@ This repository provides sample applications to demonstrate usage of Tebako.

Right now there is only one sample.

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

== Sinatra

Running without Tebako:
Running in standalone mode:

[source,sh]
----
Expand All @@ -25,46 +15,109 @@ $ bundle install
$ bundle exec ruby app.rb
----

Packaging with Tebako:
This launches a Sinatra server that responds at:

* http://127.0.0.1:4567
* http://127.0.0.1:4567/api


=== Packaging for MacOS

Install Tebako according to the
https://github.com/tamatebako/tebako[Tebako README].

Run this:

[source,sh]
----
tebako press -e app.rb -o sample.tebako -r sinatra
----

Note: please do not package "in-place" like
[WARNING]
====
Please do not package "in-place" like:
[source,sh]
----
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
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, Alpine Linux

Packaging for Ubuntu and Alpine Linux employs https://github.com/tamatebako/tebako-ci-containers[Tebako Docker 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:
Packaging from inside the container:

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

== Packaging for Gnu Linux distributions using Ubuntu container
This sample shows hoe to create portable tebako package for GNU Linux distributions.
Packaging from outside the container for Ubuntu:

[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
$ 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
----

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 https://github.com/tamatebako/tebako[tebako README] for more information.
Packaging from outside the container for Alpine:

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


=== Packaging for glibc-based Linux distributions using the Ubuntu container

This sample shows how to create portable tebako package for GNU Linux
distributions, such as Red Hat Enterprise Linux, CentOS, Fedora, Rocky Linux,
etc.

Packaging from outside the container for Ubuntu:

[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
----

This command:

* mounts current directory to `/mnt/w`
* packages the application in `/mnt/w/sinatra-package`
* applies the experimental `--patchelf` option to make it portable across
different versions of GLIBC.

Please refer to https://github.com/tamatebako/tebako[tebako README] for more
information.

Support for glibc forward portable packages is subject to the following caveats:

* The `--patchelf` option is currently experimental

* The `--patchelf` option is only available for the GNU toolchain, not yet for
clang/llvm.

* The package is built against the installed OpenSSL version on the system (e.g.
1.1.1), which needs to be present at the target system. If the target system has
a different version of OpenSSL, the package will not work.

== License

Copyright Ribose.

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.
Licensed under the 2-clause BSD license.

0 comments on commit 0cc2f23

Please sign in to comment.