rbe-tebako 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.clang-format +4 -0
- data/Brewfile +23 -0
- data/CMakeLists.txt +464 -0
- data/CODE_OF_CONDUCT.adoc +128 -0
- data/CONTRIBUTING.adoc +294 -0
- data/Gemfile +31 -0
- data/INSTALLATION.adoc +233 -0
- data/LICENSE.md +33 -0
- data/README.adoc +1363 -0
- data/Rakefile +35 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/cmake/copy_dir.cmake +29 -0
- data/common.env +5 -0
- data/exe/rbe-tebako +32 -0
- data/exe/rbe-tebako-packager +77 -0
- data/include/tebako/tebako-fs.h +43 -0
- data/include/tebako/tebako-main.h +42 -0
- data/include/tebako/tebako-prism.h +51 -0
- data/lib/rbe-tebako.rb +6 -0
- data/lib/tebako/build_helpers.rb +77 -0
- data/lib/tebako/cache_manager.rb +112 -0
- data/lib/tebako/cli.rb +220 -0
- data/lib/tebako/cli_helpers.rb +165 -0
- data/lib/tebako/codegen.rb +252 -0
- data/lib/tebako/deploy_helper.rb +258 -0
- data/lib/tebako/error.rb +70 -0
- data/lib/tebako/options_manager.rb +338 -0
- data/lib/tebako/package_descriptor.rb +143 -0
- data/lib/tebako/packager/pass1_patch.rb +266 -0
- data/lib/tebako/packager/pass1a_patch.rb +55 -0
- data/lib/tebako/packager/pass2_patch.rb +140 -0
- data/lib/tebako/packager/pass2_patch_crt.rb +46 -0
- data/lib/tebako/packager/pass2msys_patch.rb +190 -0
- data/lib/tebako/packager/patch.rb +54 -0
- data/lib/tebako/packager/patch_buildsystem.rb +124 -0
- data/lib/tebako/packager/patch_helpers.rb +109 -0
- data/lib/tebako/packager/patch_libraries.rb +188 -0
- data/lib/tebako/packager/patch_literals.rb +275 -0
- data/lib/tebako/packager/patch_main.rb +93 -0
- data/lib/tebako/packager/rubygems_patch.rb +83 -0
- data/lib/tebako/packager.rb +210 -0
- data/lib/tebako/packager_lite.rb +78 -0
- data/lib/tebako/ruby_builder.rb +71 -0
- data/lib/tebako/ruby_version.rb +206 -0
- data/lib/tebako/scenario_manager.rb +251 -0
- data/lib/tebako/stripper.rb +135 -0
- data/lib/tebako/version.rb +30 -0
- data/lib/tebako.rb +34 -0
- data/src/tebako-main.cpp +168 -0
- data/tools/.gitattributes +4 -0
- data/tools/.github/workflows/build-containers.yml +190 -0
- data/tools/.github/workflows/lint.yml +41 -0
- data/tools/.github/workflows/test.yml +331 -0
- data/tools/.gitignore +1 -0
- data/tools/README.md +49 -0
- data/tools/ci-scripts/arm-brew-install.sh +43 -0
- data/tools/ci-scripts/arm-brew-setup.sh +33 -0
- data/tools/ci-scripts/level-up.sh +35 -0
- data/tools/ci-scripts/patch-fbthrift.sh +94 -0
- data/tools/ci-scripts/patch-folly.sh +551 -0
- data/tools/ci-scripts/patch-glog.sh +57 -0
- data/tools/ci-scripts/patch-zstd.sh +57 -0
- data/tools/ci-scripts/tools.sh +63 -0
- data/tools/ci-scripts/x86-brew-install.sh +43 -0
- data/tools/ci-scripts/x86-brew-setup.sh +33 -0
- data/tools/cmake-scripts/def-external-project.cmake +96 -0
- data/tools/cmake-scripts/macos-environment.cmake +91 -0
- data/tools/cmake-scripts/msys-environment.cmake +78 -0
- data/tools/cmake-scripts/setup-libarchive.cmake +93 -0
- data/tools/cmake-scripts/setup-libfmt.cmake +61 -0
- data/tools/cmake-scripts/setup-libhowardhinnerdate.cmake +55 -0
- data/tools/cmake-scripts/setup-libutfcpp.cmake +56 -0
- data/tools/cmake-scripts/version.cmake +162 -0
- data/tools/docker/alpine-3.17-dev.Dockerfile +49 -0
- data/tools/docker/tools/tools.sh +66 -0
- data/tools/docker/ubuntu-20.04-dev.Dockerfile +51 -0
- data/tools/dwarfs-test-helper/CMakeLists.txt +34 -0
- data/tools/include/pro-statvfs.h +57 -0
- data/tools/tests/cmake/CMakeLists.txt +81 -0
- data/tools/tests/setup-libfmt/CMakeLists.txt +35 -0
- data/tools/tests/setup-libhowardhinnerdate/CMakeLists.txt +35 -0
- data/tools/tests/setup-librachive/CMakeLists.txt +35 -0
- data/tools/tests/setup-libutfcpp/CMakeLists.txt +36 -0
- data/tools/tests/setup-openssl/CMakeLists.txt +36 -0
- metadata +312 -0
data/README.adoc
ADDED
|
@@ -0,0 +1,1363 @@
|
|
|
1
|
+
= Tebako: An advanced image packager for interpretive languages
|
|
2
|
+
|
|
3
|
+
.Continuous Integration Status
|
|
4
|
+
[cols="1,1,3"]
|
|
5
|
+
|===
|
|
6
|
+
|*Platform Tests* |Architecture |Status
|
|
7
|
+
|
|
8
|
+
|Ubuntu
|
|
9
|
+
|amd64 + arm64 | image:https://github.com/tamatebako/tebako/actions/workflows/ubuntu.yml/badge.svg["Ubuntu amd64", link="https://github.com/tamatebako/tebako/actions/workflows/ubuntu.yml"]
|
|
10
|
+
|
|
11
|
+
|Alpine
|
|
12
|
+
|amd64 + arm64 |image:https://github.com/tamatebako/tebako/actions/workflows/alpine.yml/badge.svg["Alpine", link="https://github.com/tamatebako/tebako/actions/workflows/alpine.yml"]
|
|
13
|
+
|
|
14
|
+
|macOS
|
|
15
|
+
|amd64 + arm64
|
|
16
|
+
|image:https://github.com/tamatebako/tebako/actions/workflows/macos.yml/badge.svg["macOS amd64 + arm64", link="https://github.com/tamatebako/tebako/actions/workflows/macos.yml"]
|
|
17
|
+
|
|
18
|
+
|Windows MSYS2
|
|
19
|
+
|amd64 |image:https://github.com/tamatebako/tebako/actions/workflows/windows-msys.yml/badge.svg["Windows MSYS2", link="https://github.com/tamatebako/tebako/actions/workflows/windows-msys.yml"]
|
|
20
|
+
|
|
21
|
+
3+|*Tools Tests*
|
|
22
|
+
|
|
23
|
+
|Tebako containers
|
|
24
|
+
| |image:https://github.com/tamatebako/tebako-ci-containers/actions/workflows/build-containers.yml/badge.svg["Tebako containers", link="https://github.com/tamatebako/tebako-ci-containers/actions/workflows/build-containers.yml"]
|
|
25
|
+
|
|
26
|
+
|Runtimes
|
|
27
|
+
| |image:https://github.com/tamatebako/tebako-runtime-ruby/actions/workflows/build-runtime-packages.yml/badge.svg["Ruby runtimes", link="https://github.com/tamatebako/tebako-runtime-ruby/actions/workflows/build-runtime-packages.yml"]
|
|
28
|
+
|
|
29
|
+
3+|*Quality*
|
|
30
|
+
|
|
31
|
+
|Lint and RSpec
|
|
32
|
+
| |image:https://github.com/tamatebako/tebako/actions/workflows/lint-and-rspec.yml/badge.svg["Lint and RSpec", link="https://github.com/tamatebako/tebako/actions/workflows/lint-and-rspec.yml"]
|
|
33
|
+
|
|
34
|
+
|Code Coverage
|
|
35
|
+
| |image:https://codecov.io/gh/tamatebako/tebako/graph/badge.svg?token=XD3emQ5qsY["Tebako CLI RSpec coverage", link="https://codecov.io/gh/tamatebako/tebako"]
|
|
36
|
+
|
|
37
|
+
3+|*Info*
|
|
38
|
+
|Gem
|
|
39
|
+
| |image:https://img.shields.io/gem/v/tebako.svg["Version", link="https://rubygems.org/gems/tebako"]
|
|
40
|
+
|===
|
|
41
|
+
|
|
42
|
+
== Purpose
|
|
43
|
+
|
|
44
|
+
Tebako is an advanced executable packager designed for applications written in
|
|
45
|
+
interpretive languages.
|
|
46
|
+
|
|
47
|
+
It simplifies distribution and deployment by packaging your entire project with
|
|
48
|
+
a bundled runtime into a single, performant, executable binary.
|
|
49
|
+
|
|
50
|
+
== Architecture
|
|
51
|
+
|
|
52
|
+
A Tebako package is effectively a self-executing container-in-a-file.
|
|
53
|
+
|
|
54
|
+
The package contains the following components:
|
|
55
|
+
|
|
56
|
+
* An on-file filesystem (OFFS) containing all the project files and
|
|
57
|
+
dependencies in DwarFS format ("application")
|
|
58
|
+
|
|
59
|
+
* A runtime environment that includes the the necessary libraries and interpreters,
|
|
60
|
+
with patched filesystem calls that redirect access of project files to the
|
|
61
|
+
on-file filesystem ("runtime")
|
|
62
|
+
|
|
63
|
+
Tebako is capable to create a single file that contains both runtime and
|
|
64
|
+
application or place runtime and application to separate files. In the latter
|
|
65
|
+
case the runtime can be used with different applications or versions of the same
|
|
66
|
+
application.
|
|
67
|
+
|
|
68
|
+
Please refer to `mode` option below that controls Tebako output.
|
|
69
|
+
|
|
70
|
+
== Supported runtimes, platforms and architectures
|
|
71
|
+
|
|
72
|
+
Tebako artifacts can be built and executed on the following platforms and
|
|
73
|
+
architectures.
|
|
74
|
+
|
|
75
|
+
.Supported platforms and architectures
|
|
76
|
+
[cols="3", options="header"]
|
|
77
|
+
|===
|
|
78
|
+
| Platform and version | Architectures | Build system
|
|
79
|
+
|
|
80
|
+
3+| **Linux**
|
|
81
|
+
| Ubuntu 20.04 | amd64, aarch64 | gcc/g+\+: 10; clang/clang++: 12
|
|
82
|
+
| Ubuntu 22.04 | amd64, aarch64 | gcc/g+\+: 10; clang/clang++: 12
|
|
83
|
+
| Ubuntu 24.04 | amd64, aarch64 | gcc/g+\+: 10; clang/clang++: 12
|
|
84
|
+
| Alpine 3.17 | amd64 | gcc/g+\+: default; clang/clang++: default
|
|
85
|
+
|
|
86
|
+
3+| **macOS**
|
|
87
|
+
| macOS 14 (Sonoma) | amd64, arm64 | tested agains xcode: [15.0.1, 15.4]
|
|
88
|
+
| macOS 15 (Sequoia) | amd64, arm64 | tested agains xcode: [16.1]
|
|
89
|
+
|
|
90
|
+
3+| **Windows**
|
|
91
|
+
| Windows 10 | amd64 | MinGW ucrt64
|
|
92
|
+
| Windows 11 | amd64 | MinGW ucrt64
|
|
93
|
+
| Windows Server 2019 | amd64 | MinGW ucrt64
|
|
94
|
+
| Windows Server 2022 | amd64 | MinGW ucrt64
|
|
95
|
+
|
|
96
|
+
|===
|
|
97
|
+
|
|
98
|
+
[NOTE]
|
|
99
|
+
====
|
|
100
|
+
Windows build caveats:
|
|
101
|
+
|
|
102
|
+
* Tebako may face errors related to CMake path length limitations
|
|
103
|
+
(https://gitlab.kitware.com/cmake/cmake/-/issues/25936).
|
|
104
|
+
This error may affect not Tebako itself but the gems that need to be package and
|
|
105
|
+
use CMake to build native extensions.
|
|
106
|
+
There is no workaround for this issue as it looks like is a limitation of the
|
|
107
|
+
manifest used to build CMake executable.
|
|
108
|
+
|
|
109
|
+
* MSys strip utility creates broken executable when Tebako image is processed.
|
|
110
|
+
Linking with `-s` flag produces unusable executables as well.
|
|
111
|
+
Until this issue (https://github.com/tamatebako/tebako/issues/172) is resolved
|
|
112
|
+
we plan to produce a Windows executable with debug information unstripped. You
|
|
113
|
+
can opt to run `strip -S` manually, it most cases it works.
|
|
114
|
+
|
|
115
|
+
MacOS build caveats:
|
|
116
|
+
|
|
117
|
+
* We saw `clang` compiler segmentation fault when packaging of very large
|
|
118
|
+
projects with XCode 14.3.1. This issue is not reproducible with XCode 15.0.1 or
|
|
119
|
+
higher.
|
|
120
|
+
====
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
.Supported Ruby versions
|
|
124
|
+
[cols="2", options="header"]
|
|
125
|
+
|===
|
|
126
|
+
| Ruby version | Supported platforms
|
|
127
|
+
|
|
128
|
+
| 3.2.11 | Linux, macOS, Windows
|
|
129
|
+
| 3.3.11 | Linux, macOS, Windows
|
|
130
|
+
| 3.4.10 | Linux, macOS, Windows
|
|
131
|
+
| 4.0.6 | Linux, macOS, Windows
|
|
132
|
+
|
|
133
|
+
|===
|
|
134
|
+
|
|
135
|
+
NOTE: Support for Ruby 2.7.x, 3.0.x, and 3.1.x has been dropped. Tebako
|
|
136
|
+
packages the latest patch release of each supported line (3.2 through 4.0).
|
|
137
|
+
|
|
138
|
+
NOTE: Our goal is to support all maintained Ruby releases, including minor versions.
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
== Package portability
|
|
142
|
+
|
|
143
|
+
=== General
|
|
144
|
+
|
|
145
|
+
Tebako packages are designed to be "forward portable" across different operating
|
|
146
|
+
systems and architectures to allow for easy distribution and deployment.
|
|
147
|
+
|
|
148
|
+
Forward portability means that a package created on a specific platform can be
|
|
149
|
+
executed on a newer version of the same platform.
|
|
150
|
+
|
|
151
|
+
=== macOS
|
|
152
|
+
|
|
153
|
+
macOS packages are forward portable across different macOS versions.
|
|
154
|
+
|
|
155
|
+
[example]
|
|
156
|
+
A Tebako executable package built on macOS 13 (Ventura) can be executed on
|
|
157
|
+
macOS 14 (Sonoma), but not vice versa.
|
|
158
|
+
|
|
159
|
+
macOS packages compiled on `x86_64` can be run on Apple M (ARM64/aarch64)
|
|
160
|
+
systems.
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
=== Linux distributions using `musl`
|
|
164
|
+
|
|
165
|
+
Packages built for the
|
|
166
|
+
https://musl.libc.org[`musl` implementation of the C standard library]
|
|
167
|
+
(such as https://alpinelinux.org[Alpine Linux]) are forward portable.
|
|
168
|
+
|
|
169
|
+
[example]
|
|
170
|
+
A Tebako executable package built on Alpine 3.17 can be executed on Alpine 3.19.
|
|
171
|
+
|
|
172
|
+
Usage of the
|
|
173
|
+
https://github.com/tamatebako/tebako-ci-containers[Tebako Docker containers] for
|
|
174
|
+
packaging is encouraged since it eliminates the effort needed for toolchain
|
|
175
|
+
setup and configuration.
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
=== Linux distributions using `glibc`
|
|
179
|
+
|
|
180
|
+
Packages built for the
|
|
181
|
+
https://sourceware.org/glibc[`glibc` implementation of the C standard library]
|
|
182
|
+
are forward portable if the `--patchelf` experimental option is enabled.
|
|
183
|
+
|
|
184
|
+
The `--patchelf` option allows these packages to be portable to Linux GNU
|
|
185
|
+
distributions with GLIBC version 2.31 and above.
|
|
186
|
+
|
|
187
|
+
[example]
|
|
188
|
+
A Tebako executable package built on Ubuntu 20.04 with `--patchelf` option can
|
|
189
|
+
be executed on Rocky Linux 9.
|
|
190
|
+
|
|
191
|
+
Usage of the
|
|
192
|
+
https://github.com/tamatebako/tebako-ci-containers[Tebako Docker containers] for
|
|
193
|
+
packaging is encouraged since it eliminates the effort needed for toolchain
|
|
194
|
+
setup and configuration.
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
.Minimum versions of GLIBC Linux distributions that support Tebako packages with forward portability
|
|
198
|
+
[cols="3", options="header"]
|
|
199
|
+
|===
|
|
200
|
+
| Distribution | Minimal supported version | GLIBC version
|
|
201
|
+
|
|
202
|
+
| Ubuntu | 20.04 (Focal Fossa) | GLIBC 2.31
|
|
203
|
+
| Debian | 11 (Bullseye) | GLIBC 2.31
|
|
204
|
+
| Rocky Linux | 9 | GLIBC 2.34
|
|
205
|
+
| Fedora | 33 | GLIBC 2.32
|
|
206
|
+
| CentOS | 9 | GLIBC 2.34
|
|
207
|
+
| Red Hat Enterprise Linux (RHEL) | 9 | GLIBC 2.34
|
|
208
|
+
| Oracle Linux | 9 | GLIBC 2.34
|
|
209
|
+
|
|
210
|
+
|===
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
== Future plans
|
|
214
|
+
|
|
215
|
+
* Downloading new DwarFS images to be stored in the local home directory
|
|
216
|
+
* Allowing loading multiple DwarFS images in a stacked way
|
|
217
|
+
* Supporting a COW mechanism that the newly written files are stored
|
|
218
|
+
in a separate image that can be loaded on top of the read-only file systems.
|
|
219
|
+
|
|
220
|
+
== FAQ
|
|
221
|
+
|
|
222
|
+
=== Why use Tebako?
|
|
223
|
+
|
|
224
|
+
Tebako is particularly useful for developers who need to:
|
|
225
|
+
|
|
226
|
+
* Distribute applications without requiring users to have specific runtimes installed.
|
|
227
|
+
* Simplify the deployment process by packaging all dependencies into one binary.
|
|
228
|
+
* Ensure consistency across different environments by using a single executable.
|
|
229
|
+
* Flexibility to support different runtime versions on the user's machine.
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
=== How do I know I need Tebako?
|
|
233
|
+
|
|
234
|
+
You might need Tebako if you:
|
|
235
|
+
|
|
236
|
+
* Want to package your application into a single, self-contained binary.
|
|
237
|
+
* Want to avoid the complexities of managing runtime environments on target machines.
|
|
238
|
+
* Distribute software to environments where installing runtimes and their dependencies is challenging.
|
|
239
|
+
* Require a streamlined way to deliver applications to end-users.
|
|
240
|
+
* Need to ensure that your application runs consistently across different environments and architectures.
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
=== What is DwarFS?
|
|
244
|
+
|
|
245
|
+
https://github.com/mhx/dwarfs[DwarFS] is a fast, high compression read-only
|
|
246
|
+
user-land file system designed for efficient storage and access of large
|
|
247
|
+
collections of files.
|
|
248
|
+
|
|
249
|
+
It is used by Tebako to package applications into a compact and efficient format.
|
|
250
|
+
|
|
251
|
+
Tebako uses https://github.com/tamatebako/libdwarfs[libdwarfs], the library
|
|
252
|
+
form of https://github.com/mhx/dwarfs[DwarFS], developed for the Tebako project.
|
|
253
|
+
|
|
254
|
+
=== When is Tebako better than comparable solutions?
|
|
255
|
+
|
|
256
|
+
Tebako offers several advantages over comparable solutions for supported
|
|
257
|
+
interpretive languages.
|
|
258
|
+
|
|
259
|
+
They are listed in order of the degree of virtualization below.
|
|
260
|
+
|
|
261
|
+
Tebako stands out by providing a lightweight runtime bundling approach that
|
|
262
|
+
simplifies distribution and deployment while offering flexibility and
|
|
263
|
+
efficiency.
|
|
264
|
+
|
|
265
|
+
It eliminates the need for users to have specific runtimes installed and ensures
|
|
266
|
+
consistency across different environments.
|
|
267
|
+
|
|
268
|
+
With Tebako, you can package your entire project with a bundled runtime into a
|
|
269
|
+
single, performant, executable binary.
|
|
270
|
+
|
|
271
|
+
[cols="a,3a,3a"]
|
|
272
|
+
|===
|
|
273
|
+
| Solution | Pros | Cons
|
|
274
|
+
|
|
275
|
+
| Virtual machines (VMs)
|
|
276
|
+
|
|
|
277
|
+
- Provides full isolation and compatibility across environments
|
|
278
|
+
|
|
|
279
|
+
- Requires a separate VM installation for each application
|
|
280
|
+
- Heavy resource consumption for virtualization
|
|
281
|
+
|
|
282
|
+
| Docker
|
|
283
|
+
|
|
|
284
|
+
- Provides portable containers
|
|
285
|
+
- Isolates entire applications and their dependencies
|
|
286
|
+
- Supports easy deployment and scalability
|
|
287
|
+
|
|
|
288
|
+
- Requires Docker installation and management
|
|
289
|
+
- Requires administrative rights on machine
|
|
290
|
+
- Containerization overhead
|
|
291
|
+
|
|
292
|
+
| *Tebako*
|
|
293
|
+
|
|
|
294
|
+
- Packages all files and dependencies into a single binary
|
|
295
|
+
- Supports multiple operating systems and architectures
|
|
296
|
+
- Provides efficient packaging and execution with DwarFS
|
|
297
|
+
- Offers security features like signing on macOS
|
|
298
|
+
- Simplifies distribution and deployment
|
|
299
|
+
- Native running speed
|
|
300
|
+
|
|
|
301
|
+
- Initial packaging time longer than Ruby gems
|
|
302
|
+
- Minor runtime overhead
|
|
303
|
+
|
|
304
|
+
| Ruby Gems
|
|
305
|
+
|
|
|
306
|
+
- Easy installation of Ruby libraries
|
|
307
|
+
- Provides user-side version control and dependency management
|
|
308
|
+
|
|
|
309
|
+
- Requires Ruby installation and gem management
|
|
310
|
+
- Runtime execution dependent on the user's installed Ruby version and gems
|
|
311
|
+
|
|
312
|
+
|===
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
== Installation
|
|
316
|
+
|
|
317
|
+
=== General
|
|
318
|
+
|
|
319
|
+
Tebako installation is only required for packaging applications.
|
|
320
|
+
|
|
321
|
+
Users who run packaged applications do not need to install anything.
|
|
322
|
+
|
|
323
|
+
Tebako can be used for packaging in two ways:
|
|
324
|
+
|
|
325
|
+
* Through the link:https://github.com/tamatebako/tebako-ci-containers[Tebako CI docker containers]
|
|
326
|
+
* Through local installation
|
|
327
|
+
|
|
328
|
+
Installation for both GNU and musl Linux distributions may heavily depend on the OS version,
|
|
329
|
+
so we recommend using link:https://github.com/tamatebako/tebako-ci-containers[Tebako CI docker containers]
|
|
330
|
+
for Linux packaging.
|
|
331
|
+
|
|
332
|
+
=== Local installation
|
|
333
|
+
|
|
334
|
+
To use Tebako on macOS or Windows, you need to install it locally.
|
|
335
|
+
|
|
336
|
+
On Linux, there may be cases where Docker is not suitable for your needs, such as:
|
|
337
|
+
|
|
338
|
+
1. Administrative privileges: Running Docker requires administrative privileges,
|
|
339
|
+
which may not be available to all users on their machines.
|
|
340
|
+
|
|
341
|
+
2. Performance impact: Docker introduces performance overhead due to
|
|
342
|
+
containerization. This can be a concern when packaging complex
|
|
343
|
+
applications that require significant memory resources.
|
|
344
|
+
|
|
345
|
+
In such cases, you can choose to install Tebako locally on Linux as well.
|
|
346
|
+
|
|
347
|
+
Please refer to the separate document link:INSTALLATION.adoc[INSTALLATION.adoc]
|
|
348
|
+
for instructions on how to install Tebako.
|
|
349
|
+
|
|
350
|
+
== Usage
|
|
351
|
+
|
|
352
|
+
=== Command-line interface
|
|
353
|
+
|
|
354
|
+
Tebako works by packaging your project into a single executable binary that
|
|
355
|
+
includes all the necessary dependencies.
|
|
356
|
+
|
|
357
|
+
You interact with Tebako through its command-line interface (CLI),
|
|
358
|
+
which provides the following commands:
|
|
359
|
+
|
|
360
|
+
Basic use:
|
|
361
|
+
|
|
362
|
+
`press`::
|
|
363
|
+
Packages a project into a single executable binary.
|
|
364
|
+
See <<press>> section for details.
|
|
365
|
+
|
|
366
|
+
Advanced use:
|
|
367
|
+
|
|
368
|
+
`setup`::
|
|
369
|
+
Runs post-install setup and creates the Tebako packaging environment.
|
|
370
|
+
See <<setup>> section for details.
|
|
371
|
+
|
|
372
|
+
`clean`::
|
|
373
|
+
Removes Tebako artifacts.
|
|
374
|
+
See <<clean>> section for details.
|
|
375
|
+
|
|
376
|
+
`clean_ruby`::
|
|
377
|
+
Removes Tebako Ruby artifacts.
|
|
378
|
+
See <<clean_ruby>> section for details.
|
|
379
|
+
|
|
380
|
+
`hash`::
|
|
381
|
+
Calculates the Tebako script hash for use as a cache key in CI/CD environments.
|
|
382
|
+
See <<hash>> section for details.
|
|
383
|
+
|
|
384
|
+
`help`::
|
|
385
|
+
Displays the help message.
|
|
386
|
+
|
|
387
|
+
== Packaging
|
|
388
|
+
|
|
389
|
+
=== Commands
|
|
390
|
+
|
|
391
|
+
Tebako provides several commands to manage the packaging and deployment process.
|
|
392
|
+
|
|
393
|
+
==== Press
|
|
394
|
+
|
|
395
|
+
This command "presses" a Ruby project using the Tebako components built in the Tebako
|
|
396
|
+
root folder (`<tebako-root-folder>`).
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
[NOTE]
|
|
400
|
+
====
|
|
401
|
+
The first invocation of the `press` command can take up to an hour as it sets up
|
|
402
|
+
the packaging environment and collects the required dependencies. Subsequent
|
|
403
|
+
invocations are much faster.
|
|
404
|
+
====
|
|
405
|
+
|
|
406
|
+
Upon the next invocation, Tebako will use previously created packaging
|
|
407
|
+
environment. The press process itself takes minutes.
|
|
408
|
+
|
|
409
|
+
You can manage setup of packaging environment manually; please refer to
|
|
410
|
+
description of setup and clean commands below.
|
|
411
|
+
|
|
412
|
+
[source,sh]
|
|
413
|
+
----
|
|
414
|
+
tebako press \
|
|
415
|
+
-e|--entry-point=<entry-point> \
|
|
416
|
+
-r|--root=<project-root-folder> \
|
|
417
|
+
[-p|--prefix=<tebako-root-folder>] \
|
|
418
|
+
[-R|--Ruby=<ruby-version>] \
|
|
419
|
+
[-o|--output=<packaged-file-name>] \
|
|
420
|
+
[-l|--log-level=<error|warn|debug|trace>] \
|
|
421
|
+
[-c|--cwd=<package-current-working-directory>] \
|
|
422
|
+
[-D|--devmode] \
|
|
423
|
+
[-P|--patchelf] \
|
|
424
|
+
[-m|--mode=<bundle|both|application|runtime>] \
|
|
425
|
+
[-u|--ref=<runtime-reference>] \
|
|
426
|
+
[-t|--tebafile=<path-to-tebafile>]
|
|
427
|
+
----
|
|
428
|
+
|
|
429
|
+
Where:
|
|
430
|
+
|
|
431
|
+
`--entry-point=<entry-point>`::
|
|
432
|
+
an executable file (binary executable or script) that shall be started when
|
|
433
|
+
packaged file is called. This parameter is not required if the operation mode is `runtime`.
|
|
434
|
+
|
|
435
|
+
`--prefix=<tebako-root-folder>`::
|
|
436
|
+
the Tebako root folder (see details: <<root-folder-selection>>)
|
|
437
|
+
|
|
438
|
+
`--Ruby=<ruby-version>`::
|
|
439
|
+
this parameter defines Ruby version that will be packaged (optional, defaults to
|
|
440
|
+
`4.0.6`)
|
|
441
|
+
|
|
442
|
+
`--root=<project-root-folder>`::
|
|
443
|
+
a folder at the host source file system where project files are located.
|
|
444
|
+
This parameter is not required if the operation mode is `runtime`.
|
|
445
|
+
|
|
446
|
+
`--output=<packaged-file-name>`::
|
|
447
|
+
(optional)
|
|
448
|
+
the output file name.
|
|
449
|
+
+
|
|
450
|
+
On Windows, the output file is automatically appended the `.exe` extension.
|
|
451
|
+
|
|
452
|
+
** If the `-o` option is not specified:
|
|
453
|
+
|
|
454
|
+
*** in `runtime` mode, the runtime package is created at `tebako-runtime`.
|
|
455
|
+
*** in `application` mode, the application package is created at `<current-folder>/<entry-point-base-name>`.
|
|
456
|
+
*** in `bundle` mode, the bundled package is created at `<current-folder>/<entry-point-base-name>`.
|
|
457
|
+
*** in `both` mode, the runtime package is created at `<current-folder>/<entry-point-base-name>`,
|
|
458
|
+
and the application package is created at `<current-folder>/<entry-point-base-name>.tebako`.
|
|
459
|
+
|
|
460
|
+
** If the `-o` option is specified:
|
|
461
|
+
|
|
462
|
+
*** in `runtime` mode, the runtime package is named according to the `-o` option.
|
|
463
|
+
*** in `application` mode, the application package is named according to the `-o` option.
|
|
464
|
+
*** in `bundle` mode, the bundled package is named according to the `-o` option.
|
|
465
|
+
*** in `both` mode, the runtime package is named according to the `-o` option,
|
|
466
|
+
and the application package is named according to the `-o` option with the `.tebako` extension.
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
`--log-level=<error|warn|debug|trace>`::
|
|
470
|
+
(optional, defaults to `error`)
|
|
471
|
+
logging level for the Tebako built-in memory filesystem driver.
|
|
472
|
+
|
|
473
|
+
`--cwd=<package-current-working-directory>`::
|
|
474
|
+
(optional)
|
|
475
|
+
A folder within Tebako memfs where the packaged application will start. This
|
|
476
|
+
folder should be specified relative to the memfs root.
|
|
477
|
+
+
|
|
478
|
+
If not provided, the application will start within the current folder of the
|
|
479
|
+
host (i.e., at `$PWD`).
|
|
480
|
+
+
|
|
481
|
+
This argument is required because it is not possible to change the directory to
|
|
482
|
+
a memfs folder until the package is started, as opposed to any host folder that
|
|
483
|
+
can be set as the current directory before Tebako package invocation. Tebako
|
|
484
|
+
saves the original working directory in a global Ruby variable
|
|
485
|
+
`$tebako_original_pwd`.
|
|
486
|
+
|
|
487
|
+
`--devmode`:: flag that activates development mode, in which Tebako's cache and
|
|
488
|
+
packaging consistency checks are relaxed.
|
|
489
|
+
|
|
490
|
+
`--patchelf`::
|
|
491
|
+
Allows forward-compatibility of Tebako packages with Linux GNU distributions.
|
|
492
|
+
+
|
|
493
|
+
Specifically, this is a flag that removes a reference to the `GLIBC_PRIVATE`
|
|
494
|
+
version of `libpthread` from a Tebako package. This allows Linux GNU packages
|
|
495
|
+
to run against versions of `libpthread` that differ from the version used for
|
|
496
|
+
packaging.
|
|
497
|
+
+
|
|
498
|
+
NOTE: This option only works on GNU Linux only.
|
|
499
|
+
+
|
|
500
|
+
[example]
|
|
501
|
+
For example, a package created at Ubuntu 20 system can be used on Ubuntu 22.
|
|
502
|
+
+
|
|
503
|
+
NOTE: The feature is exeprimental, we may consider another approach in the future.
|
|
504
|
+
|
|
505
|
+
`--mode=<mode>`::
|
|
506
|
+
(optional, defaults to `bundle`)
|
|
507
|
+
Package output mode, determines whether the runtime and/or application are
|
|
508
|
+
to be separately packaged.
|
|
509
|
+
|
|
510
|
+
`bundle`::: Create a single package bundling both the runtime and application. The output file is named according to the `-o` option.
|
|
511
|
+
`both`::: Create separate packages for the runtime and application. Outputs two separate files: one for the runtime at the location specified at the `-o {filename}` and one for the application at `{filename}.package`.
|
|
512
|
+
`application`::: Create the application package only. The output file is named according to the `-o` option.
|
|
513
|
+
`runtime`::: Create the runtime package only. The output file is named according to the `-o` option.
|
|
514
|
+
|
|
515
|
+
More information on the `mode` option is available in the <<Tebako runtime and application packages. Splitting and bundling.>> section.
|
|
516
|
+
|
|
517
|
+
`--ref`::
|
|
518
|
+
(optional)
|
|
519
|
+
Defaults to `tebako-runtime`.
|
|
520
|
+
When a Tebako application package is created on Windows, it is linked against a
|
|
521
|
+
Tebako runtime file name. The `ref` parameter allows to specify the name of the
|
|
522
|
+
runtime file.
|
|
523
|
+
+
|
|
524
|
+
NOTE: The `--ref` option specifies the name of the runtime -- the runtime file
|
|
525
|
+
can be recreated or changed but not renamed.
|
|
526
|
+
|
|
527
|
+
`--tebafile=<path>`::
|
|
528
|
+
the tebako configuration file (optional, defaults to `$PWD/.tebako.yml`).
|
|
529
|
+
Please refer to the separate section below for description of the tebafile.
|
|
530
|
+
+
|
|
531
|
+
NOTE: Development mode is *not intended for production use* and should only be
|
|
532
|
+
used during development.
|
|
533
|
+
+
|
|
534
|
+
NOTE: `--entry-point` and `--project-root-folder` are required parameters and may be
|
|
535
|
+
provided either via command-line or in the tebafile.
|
|
536
|
+
|
|
537
|
+
[example]
|
|
538
|
+
====
|
|
539
|
+
[source,sh]
|
|
540
|
+
----
|
|
541
|
+
tebako press \
|
|
542
|
+
--root='~/projects/myproject' \
|
|
543
|
+
--entry=start.rb \
|
|
544
|
+
--output=/temp/myproject.tebako
|
|
545
|
+
----
|
|
546
|
+
====
|
|
547
|
+
|
|
548
|
+
==== Setup
|
|
549
|
+
|
|
550
|
+
Tebako requires post-install setup after gem installation .
|
|
551
|
+
Post-intall setup is called automatically during the first packaging.
|
|
552
|
+
There is no need run setup manually unless you need pristine Tebako
|
|
553
|
+
packaging environment to implement caching strategy.
|
|
554
|
+
We recommended to build cache based on `tebako setup` output. Building cache
|
|
555
|
+
based on `tebako press` may create inconsistent environment upon restore.
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
Setup collects required packages, builds the and creates packaging environment. This
|
|
559
|
+
is a lengthy task that can take significant time, up to 1 hour.
|
|
560
|
+
|
|
561
|
+
Tebako supports several configurations at a single system given that their root
|
|
562
|
+
directories differ and multiple Ruby versions within single configuration
|
|
563
|
+
|
|
564
|
+
[source,sh]
|
|
565
|
+
----
|
|
566
|
+
$ tebako setup \
|
|
567
|
+
[-p|--prefix=<tebako-root-folder>] \
|
|
568
|
+
[-R|--Ruby=<ruby-version>] \
|
|
569
|
+
[-D|--devmode] \
|
|
570
|
+
[-t|--tebafile=<path-to-tebafile>]
|
|
571
|
+
----
|
|
572
|
+
|
|
573
|
+
Where:
|
|
574
|
+
|
|
575
|
+
`--prefix=<tebako-root-folder>`:: the Tebako root folder (see details: <<root-folder-selection>>)
|
|
576
|
+
|
|
577
|
+
`--Ruby=<ruby-version>`::
|
|
578
|
+
parameter defines package Ruby version (optional).
|
|
579
|
+
This version is used in conjunction with requirements from the `Gemfile` as
|
|
580
|
+
explained below in <<ruby-and-bundler-versions>>.
|
|
581
|
+
|
|
582
|
+
`--tebafile=<path>`::
|
|
583
|
+
the tebako configuration file (optional, defaults to `$PWD/.tebako.yml`).
|
|
584
|
+
Please refer to the separate section below for tebafile description.
|
|
585
|
+
|
|
586
|
+
`--devmode`:: flag activates development mode, in which Tebako's cache and packaging consistency checks are relaxed.
|
|
587
|
+
Please note that this mode is not intended for production use and should only be used during development.
|
|
588
|
+
|
|
589
|
+
==== Clean
|
|
590
|
+
|
|
591
|
+
This command cleans up all Tebako artifacts in the specified prefix directory.
|
|
592
|
+
|
|
593
|
+
NOTE: These artifacts are created by the `setup` and `press` commands.
|
|
594
|
+
Normally you do not need to do it since tebako packager optimizes artifacts lifecycle on its own.
|
|
595
|
+
|
|
596
|
+
[source,sh]
|
|
597
|
+
----
|
|
598
|
+
$ tebako clean \
|
|
599
|
+
[-p|--prefix=<tebako-root-folder>] \
|
|
600
|
+
[-t|--tebafile=<path-to-tebafile>]
|
|
601
|
+
----
|
|
602
|
+
|
|
603
|
+
Where:
|
|
604
|
+
|
|
605
|
+
`--prefix=<tebako-root-folder>`:: the Tebako root folder (see details: <<root-folder-selection>>)
|
|
606
|
+
|
|
607
|
+
`--tebafile=<path>`::
|
|
608
|
+
the tebako configuration file (optional, defaults to `$PWD/.tebako.yml`).
|
|
609
|
+
Please refer to the separate section below for tebafile description.
|
|
610
|
+
|
|
611
|
+
[example]
|
|
612
|
+
====
|
|
613
|
+
[source,sh]
|
|
614
|
+
----
|
|
615
|
+
tebako clean --prefix='~/.tebako'
|
|
616
|
+
----
|
|
617
|
+
====
|
|
618
|
+
|
|
619
|
+
<<clean_ruby>>
|
|
620
|
+
==== Clean Ruby
|
|
621
|
+
|
|
622
|
+
This command cleans up only the Ruby artifacts from the specified prefix
|
|
623
|
+
directory.
|
|
624
|
+
|
|
625
|
+
NOTE: These artifacts are created by the `setup` and `press` commands.
|
|
626
|
+
Normally you do not need to do it, since Tebako packager optimizes artifacts
|
|
627
|
+
lifecycle on its own.
|
|
628
|
+
|
|
629
|
+
NOTE: Compiled DwarFS libraries are not cleaned.
|
|
630
|
+
|
|
631
|
+
[source,sh]
|
|
632
|
+
----
|
|
633
|
+
$ tebako clean_ruby
|
|
634
|
+
[-p|--prefix=<tebako-root-folder>] \
|
|
635
|
+
[-R|--Ruby=<ruby-version>] \
|
|
636
|
+
[-t|--tebafile=<path-to-tebafile>]
|
|
637
|
+
|
|
638
|
+
----
|
|
639
|
+
|
|
640
|
+
Where:
|
|
641
|
+
|
|
642
|
+
`--prefix=<tebako-root-folder>`::
|
|
643
|
+
the Tebako setup folder (optional, defaults to current folder)
|
|
644
|
+
|
|
645
|
+
`--Ruby=<ruby-version>`::
|
|
646
|
+
(optional, cleans all versions by default)
|
|
647
|
+
defines Ruby version that will be cleaned.
|
|
648
|
+
|
|
649
|
+
`--tebafile=<path>`::
|
|
650
|
+
the tebako configuration file (optional, defaults to `$PWD/.tebako.yml`).
|
|
651
|
+
Please refer to the separate section below for tebafile description.
|
|
652
|
+
|
|
653
|
+
[example]
|
|
654
|
+
====
|
|
655
|
+
[source,sh]
|
|
656
|
+
----
|
|
657
|
+
tebako clean_ruby --prefix='~/.tebako'
|
|
658
|
+
----
|
|
659
|
+
====
|
|
660
|
+
|
|
661
|
+
<<hash>>
|
|
662
|
+
==== Build script hash
|
|
663
|
+
|
|
664
|
+
This command outputs a hash value for the Tebako build script, which can be used
|
|
665
|
+
as a cache key in CI/CD pipelines.
|
|
666
|
+
|
|
667
|
+
[source,sh]
|
|
668
|
+
----
|
|
669
|
+
$ tebako hash
|
|
670
|
+
----
|
|
671
|
+
|
|
672
|
+
=== Using Docker
|
|
673
|
+
|
|
674
|
+
==== General
|
|
675
|
+
|
|
676
|
+
If you have Docker installed and available, the easiest way to run Tebako is
|
|
677
|
+
through the official Docker containers.
|
|
678
|
+
|
|
679
|
+
Docker containers with preinstalled Tebako packaging environments for Ubuntu and
|
|
680
|
+
Alpine Linux are available at
|
|
681
|
+
https://github.com/tamatebako/tebako-ci-containers[tebako-ci-containers].
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
==== Pull the container
|
|
685
|
+
|
|
686
|
+
Pull the Tebako container image.
|
|
687
|
+
|
|
688
|
+
[source,sh]
|
|
689
|
+
----
|
|
690
|
+
docker pull ghcr.io/tamatebako/tebako-<container_tag>:latest
|
|
691
|
+
----
|
|
692
|
+
|
|
693
|
+
`<container_tag>`:: is the desired image tag (e.g., `ubuntu-20.04` or `alpine-3.17`).
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
==== Running Tebako commands in the container
|
|
697
|
+
|
|
698
|
+
Simply prefix the Tebako command with `docker run` and the container image.
|
|
699
|
+
|
|
700
|
+
[source,sh]
|
|
701
|
+
----
|
|
702
|
+
docker run -v <application_folder>:/mnt/w \
|
|
703
|
+
-t ghcr.io/tamatebako/tebako-<container_tag>:latest \
|
|
704
|
+
tebako {command} {parameters}
|
|
705
|
+
----
|
|
706
|
+
|
|
707
|
+
==== Packaging from outside the container
|
|
708
|
+
|
|
709
|
+
To package your application from outside the container, just run a single Docker
|
|
710
|
+
command.
|
|
711
|
+
|
|
712
|
+
This command mounts the application folder into the container and runs the
|
|
713
|
+
`tebako press` command, specifying the application root, entry point, output
|
|
714
|
+
location, and Ruby version.
|
|
715
|
+
|
|
716
|
+
[source,sh]
|
|
717
|
+
----
|
|
718
|
+
docker run -v <application_folder>:/mnt/w \
|
|
719
|
+
-t ghcr.io/tamatebako/tebako-<container_tag>:latest \
|
|
720
|
+
tebako press <tebako-press-parameters>
|
|
721
|
+
----
|
|
722
|
+
|
|
723
|
+
`<application_folder>`:: is the path to your application folder.
|
|
724
|
+
|
|
725
|
+
`<container_tag>`:: is the desired image tag (e.g., `ubuntu-20.04` or `alpine-3.17`).
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
[example]
|
|
729
|
+
====
|
|
730
|
+
Assume that you have a Ruby application in the `fontist` folder of the current
|
|
731
|
+
directory.
|
|
732
|
+
|
|
733
|
+
You can package it to `./fontist-package` using the following command:
|
|
734
|
+
|
|
735
|
+
[source,sh]
|
|
736
|
+
----
|
|
737
|
+
docker run -v $PWD:/mnt/w \
|
|
738
|
+
-t ghcr.io/tamatebako/tebako-ubuntu-20.04:latest \
|
|
739
|
+
tebako press --root=/mnt/w/fontist --entry-point=fontist --output=/mnt/w/fontist-package --Ruby=3.2.11
|
|
740
|
+
----
|
|
741
|
+
====
|
|
742
|
+
|
|
743
|
+
==== Packaging from inside the container
|
|
744
|
+
|
|
745
|
+
It is also possible to package an application from inside the Tebako container.
|
|
746
|
+
|
|
747
|
+
Start and enter the container interactively.
|
|
748
|
+
|
|
749
|
+
[source,sh]
|
|
750
|
+
----
|
|
751
|
+
docker run -it --rm -v <application_folder>:/mnt/w \
|
|
752
|
+
ghcr.io/tamatebako/tebako-<container_tag>:latest bash
|
|
753
|
+
----
|
|
754
|
+
|
|
755
|
+
`<application_folder>`:: is the path to your application folder.
|
|
756
|
+
|
|
757
|
+
`<container_tag>`:: is the desired image tag (e.g., `ubuntu-20.04` or `alpine-3.17`).
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
Once inside, run the `tebako press` command:
|
|
761
|
+
|
|
762
|
+
[source,sh]
|
|
763
|
+
----
|
|
764
|
+
tebako press <tebako press parameters>
|
|
765
|
+
----
|
|
766
|
+
|
|
767
|
+
[example]
|
|
768
|
+
====
|
|
769
|
+
Assume that you have a Ruby application in the `fontist` folder of the current
|
|
770
|
+
directory.
|
|
771
|
+
|
|
772
|
+
You can package it to `./fontist-package` using the following command:
|
|
773
|
+
|
|
774
|
+
[source,sh]
|
|
775
|
+
----
|
|
776
|
+
$ docker run -it --rm -v $PWD:/mnt/w ghcr.io/tamatebako/tebako-<container_tag>:latest bash
|
|
777
|
+
|
|
778
|
+
# Inside the container:
|
|
779
|
+
$ tebako press --root=/mnt/w/fontist --entry-point=fontist --output=/mnt/w/fontist-package --Ruby=3.2.11
|
|
780
|
+
----
|
|
781
|
+
====
|
|
782
|
+
|
|
783
|
+
=== Tebako configuration file
|
|
784
|
+
|
|
785
|
+
It is possible to provide all or some options for the `tebako
|
|
786
|
+
{setup | press | clean | clean_ruby}` commands via a Tebako configuration file
|
|
787
|
+
('tebafile').
|
|
788
|
+
|
|
789
|
+
Tebafile is a YAML file with a single key `options`. The options are the same as
|
|
790
|
+
long names for the command line.
|
|
791
|
+
|
|
792
|
+
For example, for the prefix option:
|
|
793
|
+
|
|
794
|
+
[source]
|
|
795
|
+
----
|
|
796
|
+
-p|--prefix=<tebako-root-folder>
|
|
797
|
+
----
|
|
798
|
+
the key in the YAML file would be 'prefix'.
|
|
799
|
+
|
|
800
|
+
.Example tebafile that sets values for prefix and Ruby options
|
|
801
|
+
[example]
|
|
802
|
+
====
|
|
803
|
+
This is an example tebafile that sets values for prefix and Ruby options:
|
|
804
|
+
|
|
805
|
+
[source,yaml]
|
|
806
|
+
----
|
|
807
|
+
options:
|
|
808
|
+
prefix: /tmp/tebako
|
|
809
|
+
Ruby: 3.2.11
|
|
810
|
+
----
|
|
811
|
+
====
|
|
812
|
+
|
|
813
|
+
[[root-folder-selection]]
|
|
814
|
+
=== Tebako root folder (aka prefix) selection
|
|
815
|
+
|
|
816
|
+
The Tebako prefix determines the base directory for the tebako packaging environment. It contain build artifacts for
|
|
817
|
+
Tebako run-time, libraries and other components and is an essential part of configuring how Tebako operates within your system.
|
|
818
|
+
|
|
819
|
+
The selection of the Tebako prefix follows a specific order of precedence to
|
|
820
|
+
ensure flexibility and ease of use as described in the next section.
|
|
821
|
+
|
|
822
|
+
Please do not use Tebako prefix under your application root (`--root` parameter). It is not an error
|
|
823
|
+
but it will cause Tebako to place all build-time artifacts to tebako package dramatically increasing its size.
|
|
824
|
+
You do not need it unless under very special circumstances like tebako packaging tebako itself.
|
|
825
|
+
|
|
826
|
+
=== Options preference order
|
|
827
|
+
|
|
828
|
+
Tebako supports several methods to set options. The table below show preference order and limitations for specific options.
|
|
829
|
+
samller order means higher proirity.
|
|
830
|
+
|
|
831
|
+
[cols="4", options="header"]
|
|
832
|
+
|===
|
|
833
|
+
| Order | Mode | Option source | Applicability
|
|
834
|
+
|
|
835
|
+
| 1 | All | Command-line | All options
|
|
836
|
+
| 2 | All |Tebako configuration file | All option except `--tebafile` (you can not specify new tebafile in a tebafile)
|
|
837
|
+
.2+| 3 .2+| All .2+| Environment variable | TEBAKO_PREFIX to set `--prefix` option
|
|
838
|
+
| LG_VADDR to set `--with-lg-vaddr` jemalloc parameter
|
|
839
|
+
.2+| 4 | `runtime` | Tebako defaults | All options except `--entry-point` and `--root` that are mandatory
|
|
840
|
+
| `bundle`, `both`, `application` | Tebako defaults | All options
|
|
841
|
+
|
|
842
|
+
|===
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
=== Exit codes
|
|
846
|
+
|
|
847
|
+
The Tebako CLI exits with different exit codes to indicate the status of the
|
|
848
|
+
operation. The following table lists the possible exit codes and their meanings.
|
|
849
|
+
|
|
850
|
+
.Tebako CLI exit codes
|
|
851
|
+
[cols="a,a"]
|
|
852
|
+
|===
|
|
853
|
+
| Code | Condition
|
|
854
|
+
|
|
855
|
+
| 0 | No error
|
|
856
|
+
| 1 | Invalid command line
|
|
857
|
+
| 101 | 'tebako setup' configure step failed
|
|
858
|
+
| 102 | 'tebako setup' build step failed
|
|
859
|
+
| 103 | 'tebako press' configure step failed
|
|
860
|
+
| 104 | 'tebako press' build step failed
|
|
861
|
+
| 105 | Failed to map MSys path to Windows
|
|
862
|
+
| 106 | Entry point does not exist or is not accessible
|
|
863
|
+
| 107 | Project root does not exist or is not accessible
|
|
864
|
+
| 108 | Package working directory does not exist
|
|
865
|
+
| 109 | Invalid Ruby version format
|
|
866
|
+
| 110 | Ruby version is not supported
|
|
867
|
+
| 111 | Ruby version is not supported on Windows
|
|
868
|
+
| 112 | OS is not supported
|
|
869
|
+
| 113 | Path to root shall be absolute. Relative path is not allowed
|
|
870
|
+
| 114 | Entry point is not within the project root
|
|
871
|
+
| 115 | Failed to load Gemfile
|
|
872
|
+
| 116 | Ruby version does not satify Gemfile requirements
|
|
873
|
+
|===
|
|
874
|
+
|
|
875
|
+
[[ruby-and-bundler-versions]]
|
|
876
|
+
== Ruby and bundler versions selection
|
|
877
|
+
|
|
878
|
+
During packaging tebako creates its own Ruby execution environment that is independent from the host Ruby environment.
|
|
879
|
+
The version of Ruby that is used in the package is defined by the combination of the `--Ruby` option and ruby requirement
|
|
880
|
+
specified in Gemfile.
|
|
881
|
+
|
|
882
|
+
.Package Ruby version selection rules
|
|
883
|
+
[cols="3", options="header"]
|
|
884
|
+
|===
|
|
885
|
+
| Gemfile requirement
|
|
886
|
+
| `--Ruby` option given
|
|
887
|
+
| `--Ruby` option absent
|
|
888
|
+
|
|
889
|
+
| *Specified*
|
|
890
|
+
| The version specified by `--Ruby` option if it is supported and satisfies Gemfile requirement; error otherwise
|
|
891
|
+
| The minimal supported Ruby version that satisfies Gemfile requirement; error otherwise
|
|
892
|
+
| *Not specified*
|
|
893
|
+
| The version specified by `--Ruby` option if it is supported; error otherwise | Default Tebako Ruby version (4.0.6).
|
|
894
|
+
|
|
895
|
+
|===
|
|
896
|
+
|
|
897
|
+
When bundler is used to package the application, the version of bundler that is used is determined by the Ruby version
|
|
898
|
+
and the bundler version requirements specified in the Gemfile.
|
|
899
|
+
|
|
900
|
+
.Package bundler version selection rules
|
|
901
|
+
[cols="2", options="header"]
|
|
902
|
+
|===
|
|
903
|
+
| Gemfile requirement
|
|
904
|
+
| Bundler version (Ruby 3.2 and above)
|
|
905
|
+
|
|
906
|
+
| *Specified*
|
|
907
|
+
| The maximum version that meets Gemfile requirement if it is >= 2.4.22 ; error otherwise
|
|
908
|
+
| *Not specified*
|
|
909
|
+
| Default bundler version for this version of Ruby.
|
|
910
|
+
|
|
911
|
+
|===
|
|
912
|
+
|
|
913
|
+
== Packaging scenarios
|
|
914
|
+
|
|
915
|
+
There are two common methods for distributing a Ruby application:
|
|
916
|
+
|
|
917
|
+
* Copying the entire directory tree of the application to the target system.
|
|
918
|
+
* Creating a Ruby gem from the application and publishing or distributing it
|
|
919
|
+
as a gem.
|
|
920
|
+
|
|
921
|
+
Tebako supports both methods, but with an important distinction: during
|
|
922
|
+
packaging, it does not deploy the application to the target system. Instead,
|
|
923
|
+
it places it in a pristine Ruby environment that functions as an in-memory
|
|
924
|
+
filesystem ("memfs").
|
|
925
|
+
|
|
926
|
+
Regardless of the packaging scenario, Tebako requires two inputs:
|
|
927
|
+
|
|
928
|
+
* A root folder containing the application to be packaged.
|
|
929
|
+
* An entry point — a Ruby file that will be executed when the packaged
|
|
930
|
+
application starts.
|
|
931
|
+
|
|
932
|
+
The appropriate packaging scenario is determined by the contents of the
|
|
933
|
+
root folder:
|
|
934
|
+
|
|
935
|
+
[cols="3", options="header"]
|
|
936
|
+
|===
|
|
937
|
+
| #
|
|
938
|
+
| Conditions
|
|
939
|
+
| Scenario Description
|
|
940
|
+
|
|
941
|
+
| 1
|
|
942
|
+
| No `Gemfile`, `.gemspec`, or `.gem` files
|
|
943
|
+
| <<1-simple-script,Simple Script>>
|
|
944
|
+
|
|
945
|
+
| 2
|
|
946
|
+
| `Gemfile` present, no `.gemspec` files
|
|
947
|
+
| <<2-bundled-project, Bundled Project>>
|
|
948
|
+
|
|
949
|
+
| 3
|
|
950
|
+
| `.gemspec` present, no `Gemfile`
|
|
951
|
+
| <<3-gem, Gem>>
|
|
952
|
+
|
|
953
|
+
| 4
|
|
954
|
+
| Both `.gemspec` and `Gemfile` present
|
|
955
|
+
| <<4-bundled-gem, Bundled Gem>>
|
|
956
|
+
|
|
957
|
+
| 5
|
|
958
|
+
| `.gem` files present, no `Gemfile` or `.gemspec`
|
|
959
|
+
| <<5-prebuilt-gem, Prebuilt Gem>>
|
|
960
|
+
|
|
961
|
+
|===
|
|
962
|
+
|
|
963
|
+
=== 1. Simple Script
|
|
964
|
+
If the root folder does not contain a `Gemfile`, `.gemspec`, or `.gem`
|
|
965
|
+
files, Tebako treats the application as a simple script.
|
|
966
|
+
|
|
967
|
+
In this case:
|
|
968
|
+
|
|
969
|
+
* The entire root folder (including subdirectories) is copied to
|
|
970
|
+
`<memfs root>/local`.
|
|
971
|
+
* On startup, Tebako executes `<memfs root>/local/<entry point>`.
|
|
972
|
+
|
|
973
|
+
=== 2. Bundled Project
|
|
974
|
+
If the root folder contains a `Gemfile` but no `.gemspec` files, the
|
|
975
|
+
application is considered a bundled project. This is common for Rails or
|
|
976
|
+
Sinatra projects.
|
|
977
|
+
|
|
978
|
+
In this scenario, Tebako:
|
|
979
|
+
|
|
980
|
+
* Runs `bundle install` using the provided `Gemfile` within the pristine
|
|
981
|
+
Ruby environment.
|
|
982
|
+
* Copies the root folder and all subdirectories to `<memfs root>/local`.
|
|
983
|
+
* Executes `<memfs root>/local/<entry point>` on startup.
|
|
984
|
+
|
|
985
|
+
=== 3. Gem
|
|
986
|
+
If the root folder contains a `.gemspec` file but no `Gemfile`, Tebako
|
|
987
|
+
assumes it is packaging a gem.
|
|
988
|
+
|
|
989
|
+
In this case:
|
|
990
|
+
|
|
991
|
+
* Tebako runs the following commands within the pristine Ruby environment:
|
|
992
|
+
|
|
993
|
+
[source,sh]
|
|
994
|
+
----
|
|
995
|
+
gem build
|
|
996
|
+
gem install
|
|
997
|
+
----
|
|
998
|
+
|
|
999
|
+
* The entry point is assumed to be one of the gem’s executables, placed in
|
|
1000
|
+
the binary folder during installation. Within Tebako’s in-memory
|
|
1001
|
+
filesystem, this folder is `<memfs root>/bin`.
|
|
1002
|
+
* On startup, Tebako executes `<memfs root>/bin/<entry point>`.
|
|
1003
|
+
|
|
1004
|
+
NOTE: Multiple `.gemspec` files in the root folder are not supported.
|
|
1005
|
+
|
|
1006
|
+
=== 4. Bundled Gem
|
|
1007
|
+
If the root folder contains both a `.gemspec` file and a `Gemfile`, Tebako
|
|
1008
|
+
assumes it is packaging a bundled gem.
|
|
1009
|
+
|
|
1010
|
+
In this case:
|
|
1011
|
+
|
|
1012
|
+
* Tebako runs the following commands within the pristine Ruby environment:
|
|
1013
|
+
|
|
1014
|
+
[source,sh]
|
|
1015
|
+
----
|
|
1016
|
+
bundle install
|
|
1017
|
+
bundle exec gem build
|
|
1018
|
+
bundle exec gem install
|
|
1019
|
+
----
|
|
1020
|
+
|
|
1021
|
+
* The entry point follows the same logic as in the Gem Packaging scenario
|
|
1022
|
+
(`<memfs root>/bin/<entry point>`).
|
|
1023
|
+
|
|
1024
|
+
NOTE: Multiple `.gemspec` files in the root folder are not supported.
|
|
1025
|
+
|
|
1026
|
+
=== 5. Prebuilt Gem
|
|
1027
|
+
If the root folder contains `.gem` files but no `Gemfile` or `.gemspec`,
|
|
1028
|
+
Tebako assumes it is packaging prebuilt gems.
|
|
1029
|
+
|
|
1030
|
+
In this case:
|
|
1031
|
+
|
|
1032
|
+
* Tebako runs `gem install` for all `.gem` files in the root folder, in
|
|
1033
|
+
a random order.
|
|
1034
|
+
* The entry point follows the same logic as in the Gem Packaging scenario
|
|
1035
|
+
(`<memfs root>/bin/<entry point>`).
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
== Tebako runtime and application packages. Splitting and bundling.
|
|
1039
|
+
|
|
1040
|
+
=== General
|
|
1041
|
+
|
|
1042
|
+
Tebako provides a method either to create a single bundle package that contains Ruby run-time and the application or create separate
|
|
1043
|
+
reusable runtime package and application package that can be deployed without a runtime.
|
|
1044
|
+
|
|
1045
|
+
=== Creating a bundle package
|
|
1046
|
+
|
|
1047
|
+
Tebako provides a method to create and manage a bundle package, which simplifies
|
|
1048
|
+
the process of packaging dependencies along with the application.
|
|
1049
|
+
|
|
1050
|
+
[source,sh]
|
|
1051
|
+
----
|
|
1052
|
+
$ tebako bundle create -o <bundle-package> -r <project-root-folder> [-R <ruby-version>]
|
|
1053
|
+
----
|
|
1054
|
+
|
|
1055
|
+
To run the bundle package, use the following command:
|
|
1056
|
+
|
|
1057
|
+
[source,sh]
|
|
1058
|
+
----
|
|
1059
|
+
$ <bundle-package>
|
|
1060
|
+
----
|
|
1061
|
+
|
|
1062
|
+
[example]
|
|
1063
|
+
====
|
|
1064
|
+
[source,sh]
|
|
1065
|
+
----
|
|
1066
|
+
$ tebako bundle create -o myproject-bundle -r ~/projects/myproject -R 3.4.10
|
|
1067
|
+
# => creates `myproject-bundle`, a bundle package for Ruby 3.4.10
|
|
1068
|
+
$ myproject-bundle
|
|
1069
|
+
# => runs the bundle package
|
|
1070
|
+
----
|
|
1071
|
+
====
|
|
1072
|
+
|
|
1073
|
+
=== Creating separate runtime and application packages
|
|
1074
|
+
|
|
1075
|
+
Tebako allows creating separate runtime and application packages that can be used
|
|
1076
|
+
to run a Tebako application package.
|
|
1077
|
+
|
|
1078
|
+
[source,sh]
|
|
1079
|
+
----
|
|
1080
|
+
$ tebako press -m both \
|
|
1081
|
+
-o <tebako-runtime-package> \
|
|
1082
|
+
-e <entry-point> \
|
|
1083
|
+
-r <project-root-folder> \
|
|
1084
|
+
[-R <ruby-version>]
|
|
1085
|
+
----
|
|
1086
|
+
|
|
1087
|
+
The resulting packages will be generated in the current directory as:
|
|
1088
|
+
|
|
1089
|
+
* Tebako runtime package at the `-o` location, i.e. `<tebako-runtime-package>`.
|
|
1090
|
+
* Tebako application package. The name of the application package will be the
|
|
1091
|
+
same as the runtime package with the `.package` extension.
|
|
1092
|
+
|
|
1093
|
+
|
|
1094
|
+
=== Creating a Tebako runtime package
|
|
1095
|
+
|
|
1096
|
+
Tebako allows creating a Tebako runtime package that can be used to run a Tebako
|
|
1097
|
+
application package.
|
|
1098
|
+
|
|
1099
|
+
[source,sh]
|
|
1100
|
+
----
|
|
1101
|
+
$ tebako press -m runtime -o <tebako-runtime-package> [-R <ruby-version>]
|
|
1102
|
+
----
|
|
1103
|
+
|
|
1104
|
+
[example]
|
|
1105
|
+
====
|
|
1106
|
+
[source,sh]
|
|
1107
|
+
----
|
|
1108
|
+
$ tebako press -o tebako-ruby-3.4.10 -R 3.4.10
|
|
1109
|
+
# => creates `tebako-ruby-3.4.10`, a Tebako runtime package for Ruby 3.4.10
|
|
1110
|
+
----
|
|
1111
|
+
====
|
|
1112
|
+
|
|
1113
|
+
=== Creating a Tebako application package
|
|
1114
|
+
|
|
1115
|
+
Tebako allows creating a Tebako application package that can be run with a
|
|
1116
|
+
Tebako runtime package.
|
|
1117
|
+
|
|
1118
|
+
[source,sh]
|
|
1119
|
+
----
|
|
1120
|
+
$ tebako press -m application \
|
|
1121
|
+
-o <tebako-application-package> \
|
|
1122
|
+
-e <entry-point> \
|
|
1123
|
+
-r <project-root-folder> \
|
|
1124
|
+
[-R <ruby-version>]
|
|
1125
|
+
----
|
|
1126
|
+
|
|
1127
|
+
[example]
|
|
1128
|
+
====
|
|
1129
|
+
[source,sh]
|
|
1130
|
+
----
|
|
1131
|
+
$ tebako press -m application \
|
|
1132
|
+
-o tebako-application-package \
|
|
1133
|
+
-e start.rb \
|
|
1134
|
+
-r ~/projects/myproject \
|
|
1135
|
+
-R 3.4.10
|
|
1136
|
+
# => creates `tebako-application-package`, a Tebako application package for Ruby 3.4.10
|
|
1137
|
+
----
|
|
1138
|
+
====
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
=== Running Tebako application using a Tebako runtime (`--tebako-run` option)
|
|
1142
|
+
|
|
1143
|
+
The Tebako application package can be executed by a Tebako runtime package.
|
|
1144
|
+
|
|
1145
|
+
[source,sh]
|
|
1146
|
+
----
|
|
1147
|
+
$ <tebako-runtime-package> --tebako-run [<tebako-application-package>]
|
|
1148
|
+
----
|
|
1149
|
+
|
|
1150
|
+
Where,
|
|
1151
|
+
|
|
1152
|
+
`<tebako-runtime-package>`::
|
|
1153
|
+
The Tebako runtime package file created using in `runtime` or `both` mode.
|
|
1154
|
+
|
|
1155
|
+
`<tebako-application-package>`::
|
|
1156
|
+
The Tebako application package created in `application` or `both` mode.
|
|
1157
|
+
|
|
1158
|
+
[example]
|
|
1159
|
+
====
|
|
1160
|
+
Given a Ruby application at `hello.rb`:
|
|
1161
|
+
|
|
1162
|
+
[source,Ruby]
|
|
1163
|
+
----
|
|
1164
|
+
puts "Hello, #{ARGV[0]}!"
|
|
1165
|
+
----
|
|
1166
|
+
|
|
1167
|
+
Create separate runtime and application packages:
|
|
1168
|
+
|
|
1169
|
+
[source,sh]
|
|
1170
|
+
----
|
|
1171
|
+
tebako press -m runtime -o tebako-runtime-package
|
|
1172
|
+
tebako press -m application -o tebako-application-package -e hello.rb -r test
|
|
1173
|
+
----
|
|
1174
|
+
|
|
1175
|
+
Run the application using the pre-packaged runtime:
|
|
1176
|
+
|
|
1177
|
+
[source,sh]
|
|
1178
|
+
----
|
|
1179
|
+
tebako-runtime-package --tebako-run tebako-application-package Maxim
|
|
1180
|
+
----
|
|
1181
|
+
|
|
1182
|
+
The expected output is:
|
|
1183
|
+
|
|
1184
|
+
[source]
|
|
1185
|
+
----
|
|
1186
|
+
Hello, Maxim!
|
|
1187
|
+
----
|
|
1188
|
+
====
|
|
1189
|
+
|
|
1190
|
+
== Packaging Ruby Gems with Post-Installation Requirements
|
|
1191
|
+
|
|
1192
|
+
Unlike the traditional approach to Ruby program distribution, Tebako is designed with a clear separation between the build and
|
|
1193
|
+
target environments. We assume that a Tebako package created in the build environment should remain independent of it and run unchanged
|
|
1194
|
+
in the target environment.
|
|
1195
|
+
|
|
1196
|
+
While this approach is appealing, it imposes certain limitations on some Ruby gems, including Tebako itself. Specifically, gems that
|
|
1197
|
+
require a post-installation setup step often establish a strong dependency on the target environment. This setup might involve installing
|
|
1198
|
+
native libraries, linking to existing system components, or otherwise relying on the target system’s configuration.
|
|
1199
|
+
|
|
1200
|
+
To be packaged by Tebako, gems that require post-installation setup must meet two additional requirements:
|
|
1201
|
+
|
|
1202
|
+
1. *Ability to run post-installation setup from a read-only filesystem, outside the gem installation folder.*
|
|
1203
|
+
For example, Tebako uses the location specified by the `prefix` parameter to create any necessary files during post-installation.
|
|
1204
|
+
|
|
1205
|
+
2. *Automatic execution of the post-installation setup when required.*
|
|
1206
|
+
For instance, when the `tebako press` command is executed, it first checks whether `tebako setup` has been run and triggers it if necessary.
|
|
1207
|
+
|
|
1208
|
+
By adhering to these principles, gems that require post-installation setup will not only be compatible with Tebako but will also provide a more
|
|
1209
|
+
robust and consistent runtime experience, allowing them to run seamlessly across different environments.
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
== Run-time options
|
|
1213
|
+
|
|
1214
|
+
=== General
|
|
1215
|
+
|
|
1216
|
+
Generally, Tebako packages pass command line options to the packaged application.
|
|
1217
|
+
|
|
1218
|
+
[example]
|
|
1219
|
+
====
|
|
1220
|
+
For example, if the package was created with the following command
|
|
1221
|
+
|
|
1222
|
+
[source,sh]
|
|
1223
|
+
----
|
|
1224
|
+
tebako press \
|
|
1225
|
+
--root='~/projects/myproject' \
|
|
1226
|
+
--entry=start.rb \
|
|
1227
|
+
--output=/temp/myproject.tebako
|
|
1228
|
+
----
|
|
1229
|
+
running
|
|
1230
|
+
|
|
1231
|
+
[source,sh]
|
|
1232
|
+
----
|
|
1233
|
+
/temp/myproject.tebako --option --parameter value
|
|
1234
|
+
----
|
|
1235
|
+
|
|
1236
|
+
will be translated by Tebako bootstrap code to
|
|
1237
|
+
|
|
1238
|
+
[source,sh]
|
|
1239
|
+
----
|
|
1240
|
+
myproject --option --parameter value
|
|
1241
|
+
----
|
|
1242
|
+
====
|
|
1243
|
+
|
|
1244
|
+
However, there are several command-line parameters that are intercepted and processed
|
|
1245
|
+
by Tebako bootstrap code as described below.
|
|
1246
|
+
|
|
1247
|
+
|
|
1248
|
+
=== Image extraction (`--tebako-extract` option)
|
|
1249
|
+
|
|
1250
|
+
Tebako provides an option to extract its DwarFS filesystem from a package to
|
|
1251
|
+
a local folder for verification or examination.
|
|
1252
|
+
|
|
1253
|
+
[source,sh]
|
|
1254
|
+
----
|
|
1255
|
+
$ <tebako-packaged-executable> --tebako-extract [<root folder for extracted filesystem>]
|
|
1256
|
+
----
|
|
1257
|
+
|
|
1258
|
+
Where,
|
|
1259
|
+
|
|
1260
|
+
`<root folder for extracted filesystem>`::
|
|
1261
|
+
The root folder for the extracted filesystem (optional, defaults to `source_filesystem`)
|
|
1262
|
+
|
|
1263
|
+
[example]
|
|
1264
|
+
====
|
|
1265
|
+
Extracting Tebako content from the `metanorma` package:
|
|
1266
|
+
|
|
1267
|
+
[source,sh]
|
|
1268
|
+
----
|
|
1269
|
+
metanorma --tebako-extract temp-image
|
|
1270
|
+
----
|
|
1271
|
+
====
|
|
1272
|
+
|
|
1273
|
+
The `--tebako-extract` option actually runs the following Ruby script:
|
|
1274
|
+
|
|
1275
|
+
[source,ruby]
|
|
1276
|
+
----
|
|
1277
|
+
require 'fileutils'
|
|
1278
|
+
FileUtils.copy_entry '<in-memory filesystem root>', ARGV[2] || 'source_filesystem'
|
|
1279
|
+
----
|
|
1280
|
+
|
|
1281
|
+
=== Mounting host folder to Tebako memfs (`--tebako-mount` option)
|
|
1282
|
+
|
|
1283
|
+
Some programs unconditionally use folders located under the application root,
|
|
1284
|
+
and when processed by Tebako or similar tools, these folders are included in the
|
|
1285
|
+
packaging.
|
|
1286
|
+
|
|
1287
|
+
[example]
|
|
1288
|
+
====
|
|
1289
|
+
Rails, for example, does not provide a configuration option to change where
|
|
1290
|
+
it expects the `tmp` folder to be.
|
|
1291
|
+
|
|
1292
|
+
The location is hardcoded in multiple places within the Rails codebase, residing
|
|
1293
|
+
under the application root, and as a result, it gets included in the read-only
|
|
1294
|
+
Tebako memfs.
|
|
1295
|
+
|
|
1296
|
+
Although patches have been proposed (e.g.,
|
|
1297
|
+
https://github.com/rails/rails/issues/39583), there is currently no way to
|
|
1298
|
+
change the paths for temporary files, caches, and sockets.
|
|
1299
|
+
====
|
|
1300
|
+
|
|
1301
|
+
To address this inevitable limitation for Ruby applications,
|
|
1302
|
+
Tebako provides an option to mount a host folder to the memfs tree.
|
|
1303
|
+
|
|
1304
|
+
When using Tebako, be aware of how your application's directory structure is packaged,
|
|
1305
|
+
as this affects which paths may need mounting.
|
|
1306
|
+
|
|
1307
|
+
You can use the `--tebako-extract` option described earlier to better understand
|
|
1308
|
+
your application's file structure before deciding which folders to mount.
|
|
1309
|
+
|
|
1310
|
+
[example]
|
|
1311
|
+
====
|
|
1312
|
+
The following command starts a `rails.tebako` package with `$PWD/tmp` mounted as
|
|
1313
|
+
`local/tmp` in the memfs.
|
|
1314
|
+
|
|
1315
|
+
Any remaining command-line parameters are passed to the application.
|
|
1316
|
+
|
|
1317
|
+
[source,sh]
|
|
1318
|
+
----
|
|
1319
|
+
rails.tebako --tebako-mount local/tmp:$PWD/tmp server
|
|
1320
|
+
----
|
|
1321
|
+
====
|
|
1322
|
+
|
|
1323
|
+
The `--tebako-mount` option has the following syntax:
|
|
1324
|
+
|
|
1325
|
+
[source,sh]
|
|
1326
|
+
----
|
|
1327
|
+
--tebako-mount <memfs path>:<host path>
|
|
1328
|
+
----
|
|
1329
|
+
|
|
1330
|
+
The `--tebako-mount` option can be repeated multiple times to mount more than
|
|
1331
|
+
one object. The `memfs path` is relative to the memfs root, and it is
|
|
1332
|
+
recommended to use absolute paths for host objects. Both directories and files
|
|
1333
|
+
can be mounted in this way. Tebako allows you to overlay host directories on existing memfs objects,
|
|
1334
|
+
providing a flexible solution for handling read-write requirements in packaged applications.
|
|
1335
|
+
|
|
1336
|
+
== Trivia: origin of name
|
|
1337
|
+
|
|
1338
|
+
"tamatebako" (玉手箱) is the treasure box given to Urashima Taro in the Ryugu,
|
|
1339
|
+
for which he was asked not to open if he wished to return. He opened the box
|
|
1340
|
+
upon the shock from his return that three hundred years has passed. Apparently
|
|
1341
|
+
what was stored in the box was his age.
|
|
1342
|
+
|
|
1343
|
+
This packager was made to store Ruby and its gems, and therefore named after
|
|
1344
|
+
the said treasure box (storing gems inside a treasure box).
|
|
1345
|
+
|
|
1346
|
+
Since "tamatebako" is rather long for the non-Japanese speaker, we use "tebako"
|
|
1347
|
+
(手箱, also "tehako") instead, the generic term for a personal box.
|
|
1348
|
+
|
|
1349
|
+
== Contributing
|
|
1350
|
+
|
|
1351
|
+
We welcome contributions!
|
|
1352
|
+
|
|
1353
|
+
Please see our link:CONTRIBUTING.adoc[contribution guidelines] and our
|
|
1354
|
+
link:CODE_OF_CONDUCT.adoc[code of conduct] for more information,.
|
|
1355
|
+
|
|
1356
|
+
NOTE: Our guidelines are aligned with the contribution guidelines from the RNP project.
|
|
1357
|
+
|
|
1358
|
+
== License
|
|
1359
|
+
|
|
1360
|
+
Copyright Ribose. All rights reserved.
|
|
1361
|
+
|
|
1362
|
+
Tebako is released under the BSD 2-Clause License. See the
|
|
1363
|
+
link:LICENSE.md[LICENSE.md] file for details.
|