Skip to content

Commit 921df0e

Browse files
authored
Add, fix and organize documentation (#11)
- Added README.md - Added user_guide.md - Added developer_guide.md - Added change log - Added dependencies.md - Add script for generating dependencies from poetry.lock
1 parent 3729ff6 commit 921df0e

File tree

11 files changed

+400
-27
lines changed

11 files changed

+400
-27
lines changed

README.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Script-Languages-Container-Tool
2+
3+
# Overview
4+
5+
The Script-Languages-Container-Tool (exaslct) is the build tool for the script language container.
6+
You can build, export and upload script-language container from so-called flavors
7+
which are description how to build the script language container. You can find pre-defined flavors
8+
in the [script-languages-release](https://github.com/exasol/script-languages-release) repository.
9+
There we also described how you could customize these flavors to your needs.
10+
11+
## In a Nutshell
12+
13+
### Prerequisites
14+
15+
#### For installation
16+
17+
In order to install this tool, your system needs to provide
18+
the following prerequisites:
19+
20+
* Software
21+
* Linux
22+
* [bash](https://www.gnu.org/software/bash/)
23+
* [coreutils](https://www.gnu.org/software/coreutils/)
24+
* sha512sum
25+
* sed
26+
* [curl](https://curl.se/)
27+
28+
#### For running
29+
30+
In order to use this tool, your system needs to fulfill the following prerequisites:
31+
32+
* Software
33+
* Linux
34+
* [bash](https://www.gnu.org/software/bash/)
35+
* [coreutils](https://www.gnu.org/software/coreutils/)
36+
* readlink with -f option (the readlink version of macOS doesn't support -f)
37+
* dirname
38+
* [Docker](https://docs.docker.com/) >= 17.05
39+
* with support for [multi-stage builds required](https://docs.docker.com/develop/develop-images/multistage-build/)
40+
* host volume mounts need to be allowed
41+
42+
* System Setup
43+
* We recommend at least 50 GB free disk space on the partition
44+
where Docker stores its images, on linux Docker typically stores
45+
the images at /var/lib/docker.
46+
* For the partition where the output directory (default: ./.build_output)
47+
is located we recommend additionally at least 10 GB free disk space.
48+
49+
Further, prerequisites might be necessary for specific tasks. These are listed under the corresponding section.
50+
51+
### Installation
52+
53+
Download the installation and update script via:
54+
55+
```
56+
curl -L -o install_or_update_exaslct.sh https://raw.githubusercontent.com/exasol/script-languages-container-tool/main/installer/install_or_update_exaslct.sh
57+
```
58+
59+
Before you continue with installation, please compute with the following command
60+
the sha512 hash sum of the downloaded file and compare it with its
61+
[checksum file](installer/checksums/install_or_update_exaslct.sh.sha512sum):
62+
63+
```
64+
sha512sum install_or_update_exaslct.sh
65+
```
66+
67+
If the checksums are identical, you can continue with the installation.
68+
Per default, the script installs exaslct into the current working directory.
69+
It creates a script directory `exaslct_scripts` and the symlink `exaslct`
70+
to the starter script. If you want to change the path to the script directory
71+
you can set the environment variable `EXASLCT_INSTALL_DIRECTORY` and
72+
if you want to create the symlink somewhere else you can set `EXASLCT_SYM_LINK_PATH`.
73+
74+
```
75+
bash install_or_update_exaslct.sh [version|git-commit-id|branch|tag]
76+
```
77+
78+
You can use the same script to change the version of your current installation.
79+
You only need to provide a different version, git-commit-id, branch or tag.
80+
81+
### Usage
82+
83+
#### How to build an existing flavor?
84+
85+
Create the language container and export it to the local file system
86+
87+
```bash
88+
./exaslct export --flavor-path=flavors/<flavor-name> --export-path <export-path>
89+
```
90+
91+
or upload it directly into the BucketFS (currently http only, https follows soon)
92+
93+
```bash
94+
./exaslct upload --flavor-path=flavors/<flavor-name> --database-host <hostname-or-ip> --bucketfs-port <port> \
95+
--bucketfs-username w --bucketfs-password <password> --bucketfs-name <bucketfs-name> \
96+
--bucket-name <bucket-name> --path-in-bucket <path/in/bucket>
97+
```
98+
99+
Once it is successfully uploaded, it will print the ALTER SESSION statement
100+
that can be used to activate the script language container in the database.
101+
102+
#### How to activate a script language container in the database
103+
104+
If you uploaded a container manually, you can generate the language activation statement with
105+
106+
```bash
107+
./exaslct generate-language-activation --flavor-path=flavors/<flavor-name> --bucketfs-name <bucketfs-name> \
108+
--bucket-name <bucket-name> --path-in-bucket <path/in/bucket> --container-name <container-name>
109+
```
110+
111+
where \<container-name> is the name of the uploaded archive without its file extension. To activate the language, execute the generated statement in your database session to activate the container for the current session or system wide.
112+
113+
This command will print a SQL statement to activate the language similar to the following one:
114+
115+
```bash
116+
ALTER SESSION SET SCRIPT_LANGUAGES='<LANGUAGE_ALIAS>=localzmq+protobuf:///<bucketfs-name>/<bucket-name>/<path-in-bucket>/<container-name>?lang=<language>#buckets/<bucketfs-name>/<bucket-name>/<path-in-bucket>/<container-name>/exaudf/exaudfclient[_py3]';
117+
```
118+
119+
**Please, refer to the User Guide for more detailed information, how to use exalsct.**
120+
121+
## Features
122+
123+
* Build a script language container as docker images
124+
* Export a script language container as an archive which can be used for extending Exasol UDFs
125+
* Upload a script language container as an archive to the Exasol DB's BucketFS
126+
* Generating the activation command for a script language container
127+
* Can use Docker registries, such as Docker Hub, as a cache to avoid rebuilding image without changes
128+
* Can push Docker images to Docker registries
129+
* Run tests for you container against an Exasol DB (docker-db or external db)
130+
131+
## Table of Contents
132+
133+
### Information for Users
134+
135+
* [User Guide](doc/user_guide/user_guide.md)
136+
* [Changelog](doc/changes/changelog.md)
137+
138+
## Information for Developers
139+
140+
* [Developer Guide](doc/developer_guide/developer_guide.md)
141+
* [Dependencies](doc/dependencies.md)

doc/changes/changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Changes
2+
3+
* [0.1.0](changes_0.1.0.md)

doc/changes/changes_0.1.0.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Script-Languages-Container-Tool 0.1.0, released XXXX-XX-XX
2+
3+
Code name: Extraction from Script-Languages Repository
4+
5+
## Features / Enhancements
6+
7+
- #3: Add installer scripts which download and install the scripts to run exaslct from a prebuild docker container
8+
- #1: Add initial version
9+
10+
## Bug Fixes
11+
12+
- #6: Fix docker repository name in construct_docker_runner_image_name.sh
13+
14+
## Documentation
15+
16+
- #9: Add, fix and organize documentation

doc/dependencies.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!-- @formatter:off -->
2+
# Dependencies
3+
4+
## Compile Dependencies
5+
6+
|Package|Version|
7+
|---|---|
8+
|poetry|1.1.6|
9+
10+
## Runtime Dependencies
11+
12+
|Package|Version|
13+
|---|---|
14+
|Python|>=3.6|
15+
|certifi|2020.12.5|
16+
|chardet|4.0.0|
17+
|click|7.1.2|
18+
|decorator|4.4.2|
19+
|docker|5.0.0|
20+
|docutils|0.17.1|
21+
|exasol-integration-test-docker-environment @ git+https://github.com/exasol/[email protected] |
22+
|gitdb|4.0.7|
23+
|gitpython|3.1.15|
24+
|humanfriendly|9.1|
25+
|idna|2.10|
26+
|importlib-metadata|4.0.1|
27+
|importlib-resources|5.1.2|
28+
|jinja2|2.11.3|
29+
|jsonpickle|2.0.0|
30+
|lockfile|0.12.2|
31+
|luigi|3.0.3|
32+
|markupsafe|1.1.1|
33+
|netaddr|0.8.0|
34+
|networkx|2.5.1|
35+
|pydot|1.4.2|
36+
|pyparsing|2.4.7|
37+
|pyreadline|2.1|
38+
|python-daemon|2.3.0|
39+
|python-dateutil|2.8.1|
40+
|pywin32|227|
41+
|requests|2.25.1|
42+
|simplejson|3.17.2|
43+
|six|1.15.0|
44+
|smmap|4.0.0|
45+
|stopwatch.py|1.0.1|
46+
|tenacity|6.3.1|
47+
|tornado|6.1|
48+
|typing-extensions|3.7.4.3|
49+
|urllib3|1.22|
50+
|websocket-client|0.58.0|
51+
|zipp|3.4.1|

docs/README.md renamed to doc/developer_guide/developer_guide.md

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# EXASLCT (Script Langauge Container Tool)
1+
# Script-Languages-Container-Tool Developer Guide
2+
23
EXASLCT is the build tool for the script language container.
3-
Its usage is described [here](../README.md).
4-
This readme is about the inner working of EXASLCT.
4+
This document is about the inner working of EXASLCT.
55

66
## About the Script Language Containers
77
The Script Language Containers are getting build
88
from several Dockerfiles which depend on each other.
99
These Dockerfiles need to install all necessary
10-
dependencies for the [script client](../src),
10+
dependencies for the [script client](https://github.com/exasol/script-languages/tree/master/exaudfclient/base),
1111
compile the script client and install all necessary dependencies
1212
for the flavor and the customizations of the user.
1313

@@ -21,7 +21,7 @@ It was actual unclear which of the dependencies were essential
2121
and which were not. For some flavors it was impossible to run
2222
the build on travis, because it exceeded the maximum runtime
2323
per job of 50 minutes.
24-
The build system and the test runner were bash script
24+
The build system and the test runner were both bash scripts
2525
which were messy and difficult to maintain.
2626
They worked with background jobs to do things in parallel
2727
which convoluted the logs which made error analysis difficult.
@@ -55,7 +55,7 @@ Most of these tasks produce some kind of output, for example:
5555
- docker image
5656
- a running docker container
5757

58-
Often, other tasks than depend either on the output or
58+
Often, other tasks then depend either on the output, or
5959
the action of one or more other tasks.
6060
These dependencies build a direct acyclic graph of tasks,
6161
also known as workflow.
@@ -73,7 +73,7 @@ but is suitable for other scenarios, too.
7373
Luigi describes tasks as subclasses of Luigi.Task
7474
which implements the following methods:
7575

76-
```python
76+
```
7777
class TaskC(luigi.Task):
7878
7979
def output(self):
@@ -85,20 +85,19 @@ class TaskC(luigi.Task):
8585
8686
def requires(self):
8787
return [TaskA(),TaskB()]
88-
8988
```
9089

91-
Here we describe a TaskC which depends of TaskA and TaskB
92-
defined in the requires() method.
90+
Here we describe a TaskC which depends on TaskA and TaskB
91+
defined in the `requires()` method.
9392
It does something which is specified in the run() method.
94-
Futher, it produces Target() as output.
95-
Luigi provides the dependency resolution, scheduling and parallelisation.
93+
Further, it produces Target() as output.
94+
Luigi provides the dependency resolution, scheduling and parallelization.
9695

97-
Besides this static way of describing the dependencies between tasks,
96+
Besides, this static way of describing the dependencies between tasks,
9897
Luigi also provides so called
9998
[dynamic dependencies](https://luigi.readthedocs.io/en/stable/tasks.html#dynamic-dependencies),
10099
which allow more flexible patterns in special case.
101-
Especially, if the order of execution of dependencies is important or
100+
Especially, if the order of execution of dependencies is important, or
102101
the dependencies depend on some calculation. The dynamic dependencies
103102
allow the implementation of a fork-join pattern.
104103

@@ -109,7 +108,7 @@ stops if any other StoppableTask failed in the workflow.
109108

110109
## Build Steps and their Dependencies
111110

112-
We compose the language container from several different Dockerfiles.
111+
We compose the language container from several Dockerfiles.
113112
Each Dockerfile installs dependencies for one specific purpose.
114113
We also added a separate Dockerfile flavor-customization for user specific changes.
115114
The user specific changes will be merged on filesystem basis
@@ -119,7 +118,7 @@ that could prevent the script client from working properly.
119118

120119
The following graph shows the default build steps and their dependencies.
121120

122-
![](docs/image-dependencies.png)
121+
![](images/image-dependencies.png)
123122

124123
A dependency between build steps can be either a FROM or
125124
COPY dependencies. A FROM dependency means that
@@ -130,7 +129,7 @@ of the source of the arrow.
130129

131130
All steps with the string "build_run" in their name,
132131
either run the build for the script client or
133-
at least inherit from a images which had build it.
132+
at least inherit from an image which had built it.
134133
As such these images contain all necessary tools to rebuild
135134
the script client for debugging purposes.
136135

@@ -178,9 +177,9 @@ class AnalyzeBuildRun(DockerFlavorAnalyzeImageTask):
178177
## How does caching work
179178

180179
Exaslct was built with caching in mind,
181-
because building a flavor might take very long and
180+
because building a flavor might take very long, and
182181
many build steps don't change that often.
183-
Furthermore, a end user most likely only changes the build-step
182+
Furthermore, an end user most likely only changes the build-step
184183
flavor-customization which is designed to have a minimal impact
185184
on all other build steps.
186185

@@ -191,11 +190,11 @@ EXASLCT provides three types of caching:
191190
- file system cache with saved docker images
192191
- docker registry as a remote cache
193192

194-
All caches can work together, the analyzes phase checks
195-
in which cache a images is available.
193+
All caches can work together, the analysis phase checks
194+
in which cache an images is available.
196195
The different type of caches have different precedence
197196
which might you override by command line parameters.
198-
The precedence is derived by how fast is a image available.
197+
The precedence is derived by how fast is an image available.
199198
Docker images managed by the docker daemon are instantaneously available.
200199
Saved docker images on the filesystem follow next,
201200
they need to be loaded by the daemon,
@@ -211,9 +210,9 @@ Responsible for hashing the build context is the `BuildContextHasher`
211210
which uses the `FileDirectoryListHasher`.
212211

213212
The `BuildContextHasher` combines the hash values of all directories,
214-
files and their executable rights of the build context,
213+
files and their executable permissions of the build context,
215214
such as the hash values of all images
216-
the current images depends on and the image changing build arguments
215+
the current images depends on, and the image changing build arguments
217216
to one hash value for the image.
218217

219218
Other build arguments which only influence the resources
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)