Skip to content

Commit

Permalink
Update README.ms
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexRuiz7 committed Aug 23, 2024
1 parent b9fa45b commit 7a3f180
Showing 1 changed file with 87 additions and 88 deletions.
175 changes: 87 additions & 88 deletions packaging_scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The names of the packages are managed by the `baptizer.sh` script.

## Build and Assemble in Act

Use Act to run the `build.yml` workflow locally. The `act.input.env` file contains the inputs
Use Act to run the `build.yml` workflow locally. The `act.input.env` file contains the inputs
for the workflow. As the workflow clones the `wazuh-indexer-plugins` repository, the `GITHUB_TOKEN`
is required. You can use the `gh` CLI to authenticate, as seen in the example below.

Expand All @@ -32,7 +32,7 @@ act -j build -W .github/workflows/build.yml --artifact-server-path ./artifacts -

## Build

For local package generation, use the `build.sh` script. Take a look at the `build.yml`
For local package generation, use the `build.sh` script. Take a look at the `build.yml`
workflow file for an example of usage.

```bash
Expand All @@ -52,7 +52,7 @@ act -j build -W .github/workflows/build.yml --artifact-server-path ./artifacts
Using the [Docker environment](../docker):

```console
docker exec -it wi-build_$(<VERSION) bash packaging_scripts/build.sh -a {x64|arm64} -d {rpm|deb|tar}
docker exec -it wi-build_$(<VERSION) bash packaging_scripts/build.sh -a x64 -d tar -n $(bash packaging_scripts/baptizer.sh -a x64 -d tar -m)
```

The generated package is sent to the `wazuh-indexer/artifacts` folder.
Expand All @@ -62,7 +62,6 @@ The generated package is sent to the `wazuh-indexer/artifacts` folder.
**Note:** set the environment variable `TEST=true` to assemble a package with the required plugins only,
speeding up the assembly process.


### TAR

The assembly process for tarballs consists on:
Expand All @@ -82,66 +81,66 @@ For DEB packages, the `assemble.sh` script will perform the following operations

1. Extract the deb package using `ar` and `tar` tools.

> By default, `ar` and `tar` tools expect the package to be in `wazuh-indexer/artifacts/tmp/deb`.
> The script takes care of creating the required folder structure, copying also the min package
> and the Makefile.
Current folder loadout at this stage:

```
artifacts/
|-- dist
| |-- wazuh-indexer-min_4.9.1_amd64.deb
`-- tmp
`-- deb
|-- Makefile
|-- data.tar.gz
|-- debmake_install.sh
|-- etc
|-- usr
|-- var
`-- wazuh-indexer-min_4.9.1_amd64.deb
```

`usr`, `etc` and `var` folders contain `wazuh-indexer` files, extracted from `wazuh-indexer-min-*.deb`.
`Makefile` and the `debmake_install` are copied over from `wazuh-indexer/distribution/packages/src/deb`.
The `wazuh-indexer-performance-analyzer.service` file is also copied from the same folder. It is a dependency of the SPEC file.
> By default, `ar` and `tar` tools expect the package to be in `wazuh-indexer/artifacts/tmp/deb`.
> The script takes care of creating the required folder structure, copying also the min package
> and the Makefile.
Current folder loadout at this stage:

```
artifacts/
|-- dist
| |-- wazuh-indexer-min_4.9.1_amd64.deb
`-- tmp
`-- deb
|-- Makefile
|-- data.tar.gz
|-- debmake_install.sh
|-- etc
|-- usr
|-- var
`-- wazuh-indexer-min_4.9.1_amd64.deb
```

`usr`, `etc` and `var` folders contain `wazuh-indexer` files, extracted from `wazuh-indexer-min-*.deb`.
`Makefile` and the `debmake_install` are copied over from `wazuh-indexer/distribution/packages/src/deb`.
The `wazuh-indexer-performance-analyzer.service` file is also copied from the same folder. It is a dependency of the SPEC file.

2. Install the plugins using the `opensearch-plugin` CLI tool.
3. Set up configuration files.

> Included in `min-package`. Default files are overwritten.
> Included in `min-package`. Default files are overwritten.
4. Bundle a DEB file with `debmake` and the `Makefile`.

> `debmake` and other dependencies can be installed using the `provision.sh` script.
> The script is invoked by the GitHub Workflow.
Current folder loadout at this stage:

```
artifacts/
|-- artifact_name.txt
|-- dist
| |-- wazuh-indexer-min_4.9.1_amd64.deb
| `-- wazuh-indexer_4.9.1_amd64.deb
`-- tmp
`-- deb
|-- Makefile
|-- data.tar.gz
|-- debmake_install.sh
|-- etc
|-- usr
|-- var
|-- wazuh-indexer-min_4.9.1_amd64.deb
`-- debian/
| -- control
| -- copyright
| -- rules
| -- preinst
| -- prerm
| -- postinst
```
> `debmake` and other dependencies can be installed using the `provision.sh` script.
> The script is invoked by the GitHub Workflow.
Current folder loadout at this stage:

```
artifacts/
|-- artifact_name.txt
|-- dist
| |-- wazuh-indexer-min_4.9.1_amd64.deb
| `-- wazuh-indexer_4.9.1_amd64.deb
`-- tmp
`-- deb
|-- Makefile
|-- data.tar.gz
|-- debmake_install.sh
|-- etc
|-- usr
|-- var
|-- wazuh-indexer-min_4.9.1_amd64.deb
`-- debian/
| -- control
| -- copyright
| -- rules
| -- preinst
| -- prerm
| -- postinst
```

#### Running in Docker

Expand All @@ -152,7 +151,7 @@ Pre-requisites:
- Using the [Docker environment](../docker):

```console
docker exec -it wi-assemble_$(<VERSION) bash packaging_scripts/assemble.sh -a x64 -d deb
docker exec -it wi-assemble_$(<VERSION) bash packaging_scripts/assemble.sh -a x64 -d deb -r 1
```

### RPM
Expand All @@ -165,45 +164,45 @@ The script will:

1. Extract the RPM package using `rpm2cpio` and `cpio` tools.

> By default, `rpm2cpio` and `cpio` tools expect the package to be in `wazuh-indexer/artifacts/tmp/rpm`.The script takes care of creating the required folder structure, copying also the min package and the SPEC file.
> By default, `rpm2cpio` and `cpio` tools expect the package to be in `wazuh-indexer/artifacts/tmp/rpm`. The script takes care of creating the required folder structure, copying also the min package and the SPEC file.
Current folder loadout at this stage:
Current folder loadout at this stage:

```
/rpm/$ARCH
/etc
/usr
/var
wazuh-indexer-min-*.rpm
wazuh-indexer.rpm.spec
```
```
/rpm/$ARCH
/etc
/usr
/var
wazuh-indexer-min-*.rpm
wazuh-indexer.rpm.spec
```

`usr`, `etc` and `var` folders contain `wazuh-indexer` files, extracted from `wazuh-indexer-min-*.rpm`.
`wazuh-indexer.rpm.spec` is copied over from `wazuh-indexer/distribution/packages/src/rpm/wazuh-indexer.rpm.spec`.
The `wazuh-indexer-performance-analyzer.service` file is also copied from the same folder. It is a dependency of the SPEC file.
`usr`, `etc` and `var` folders contain `wazuh-indexer` files, extracted from `wazuh-indexer-min-*.rpm`.
`wazuh-indexer.rpm.spec` is copied over from `wazuh-indexer/distribution/packages/src/rpm/wazuh-indexer.rpm.spec`.
The `wazuh-indexer-performance-analyzer.service` file is also copied from the same folder. It is a dependency of the SPEC file.

2. Install the plugins using the `opensearch-plugin` CLI tool.
3. Set up configuration files.

> Included in `min-package`. Default files are overwritten.
> Included in `min-package`. Default files are overwritten.
4. Bundle an RPM file with `rpmbuild` and the SPEC file `wazuh-indexer.rpm.spec`.

> `rpmbuild` is part of the `rpm` OS package.
> `rpmbuild` is part of the `rpm` OS package.
> `rpmbuild` is invoked from `wazuh-indexer/artifacts/tmp/rpm`. It creates the {BUILD,RPMS,SOURCES,SRPMS,SPECS,TMP} folders and applies the rules in the SPEC file. If successful, `rpmbuild` will generate the package in the `RPMS/` folder. The script will copy it to `wazuh-indexer/artifacts/dist` and clean: remove the `tmp\` folder and its contents.
> `rpmbuild` is invoked from `wazuh-indexer/artifacts/tmp/rpm`. It creates the {BUILD,RPMS,SOURCES,SRPMS,SPECS,TMP} folders and applies the rules in the SPEC file. If successful, `rpmbuild` will generate the package in the `RPMS/` folder. The script will copy it to `wazuh-indexer/artifacts/dist` and clean: remove the `tmp\` folder and its contents.
Current folder loadout at this stage:
Current folder loadout at this stage:

```
/rpm/$ARCH
/{BUILD,RPMS,SOURCES,SRPMS,SPECS,TMP}
/etc
/usr
/var
wazuh-indexer-min-*.rpm
wazuh-indexer.rpm.spec
```
```
/rpm/$ARCH
/{BUILD,RPMS,SOURCES,SRPMS,SPECS,TMP}
/etc
/usr
/var
wazuh-indexer-min-*.rpm
wazuh-indexer.rpm.spec
```

#### Running in Docker

Expand All @@ -214,7 +213,7 @@ Pre-requisites:
- Using the [Docker environment](../docker):

```console
docker exec -it wi-assemble_$(<VERSION) bash packaging_scripts/assemble.sh -a x64 -d rpm
docker exec -it wi-assemble_$(<VERSION) bash packaging_scripts/assemble.sh -a x64 -d rpm -r 1
```

## Bash scripts reference
Expand All @@ -234,7 +233,7 @@ scripts:
name: the name of the package to be generated.
outputs:
package: minimal wazuh-indexer package for the required distribution.

- file: assemble.sh
description: |
bundles the wazuh-indexer package generated in by build.sh with plugins,
Expand All @@ -245,10 +244,10 @@ scripts:
revision: revision number. 0 by default.
outputs:
package: wazuh-indexer package.

- file: provision.sh
description: Provision script for the assembly of DEB packages.

- file: baptizer.sh
description: generate the wazuh-indexer package name depending on the parameters.
inputs:
Expand Down

0 comments on commit 7a3f180

Please sign in to comment.