Skip to content

Commit

Permalink
Update docker/README.md (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexRuiz7 committed Oct 10, 2024
1 parent e0f9a23 commit a7a2051
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 54 deletions.
61 changes: 11 additions & 50 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,19 @@
# Indexer development environments
# Docker environments

Install [Docker Desktop][docker-desktop] as per its instructions, available for Windows, Mac
and Linux (Ubuntu, Debian & Fedora).
This ensures that the development experience between Linux, Mac and Windows is as
similar as possible.

> IMPORTANT: be methodic during the installation of Docker Desktop, and proceed
> step by step as described in their documentation. Make sure that your system
> meets the system requirements before installing Docker Desktop, and read any
> post-installation note, specially on Linux: [Differences between
> Docker Desktop for Linux and Docker Engine][docker-variant].
Multipurpose Docker environments to run, test and build `wazuh-indexer`.

## Pre-requisites

1. Assign resources to [Docker Desktop][docker-desktop]. The requirements for the
environments are:
1. Install [Docker][docker] as per its instructions.

1. Your workstation must meet the minimum hardware requirements:

- 8 GB of RAM (minimum)
- 4 cores

The more resources the better ☺

2. Clone the [wazuh-indexer][wi-repo].

3. Set up user permissions

The Docker volumes will be created by the internal Docker user, making them
read-only. To prevent this, a new group named `docker-desktop` and GUID 100999
needs to be created, then added to your user and the source code folder:

```bash
sudo groupadd -g 100999 docker-desktop
sudo useradd -u 100999 -g 100999 -M docker-desktop
sudo chown -R docker-desktop:docker-desktop $WZD_HOME
sudo usermod -aG docker-desktop $USER
```

## Understanding Docker contexts

Before we begin starting Docker containers, we need to understand the
differences between Docker Engine and Docker Desktop, more precisely, that the
use different contexts.

Carefully read these two sections of the Docker documentation:

- [Differences between Docker Desktop for Linux and Docker Engine][docker-variant].
- [Switch between Docker Desktop and Docker Engine][docker-context].

Docker Desktop will change to its context automatically at start, so be sure
that any existing Docker container using the default context is **stopped**
before starting Docker Desktop and any of the environments in this folder.
1. Clone the [wazuh-indexer][wi-repo].

## Development environments

Expand All @@ -61,27 +25,24 @@ Example:
Usage: ./dev.sh {up|down|stop}
```

Once the `wi-dev:x.y.z` container is up, attach a shell to it and run `./gradlew run`
to start the application.
Once the `wi-dev:x.y.z` container is up, attach a shell to it and run `./gradlew run` to start the application.

## Containers to generate packages

Use the `ci/ci.sh` script to start provisioned containers to generate packages.

```bash
Usage: ./ci.sh {up|down|stop} [ci]
Usage: ./ci.sh {up|down|stop}
```

Refer to [scripts/README.md](../scripts/README.md) for details about how to build packages.
Refer to [packaging_scripts/README.md](../packaging_scripts/README.md) for details about how to build packages.

[docker-desktop]: https://docs.docker.com/get-docker
[docker-variant]: https://docs.docker.com/desktop/install/linux-install/#differences-between-docker-desktop-for-linux-and-docker-engine
[docker-context]: https://docs.docker.com/desktop/install/linux-install/#context
[docker]: https://docs.docker.com/engine/install
[wi-repo]: https://github.com/wazuh/wazuh-indexer

## Building Docker images

The [prod](./prod) folder contains the code to build Docker images. A tarball of `wazuh-indexer` needs to be located at the same level that the Dockerfile. Below there is example of the command needed to build the image. Set the build arguments and the image tag accordingly.
The [prod](./prod) folder contains the code to build Docker images. A tarball of `wazuh-indexer` needs to be located at the same level that the Dockerfile. Below there is an example of the command needed to build the image. Set the build arguments and the image tag accordingly.

```console
docker build --build-arg="VERSION=4.10.0" --build-arg="INDEXER_TAR_NAME=wazuh-indexer-4.10.0-1_linux-x64_cfca84f.tar.gz" --tag=wazuh-indexer:4.10.0 --progress=plain --no-cache .
Expand Down
2 changes: 0 additions & 2 deletions docker/ci/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.9"

services:
# Essentially wi-dev, but doesn't expose port 9200
wi-build:
Expand Down
2 changes: 0 additions & 2 deletions docker/dev/dev.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.9"

services:
wi-dev:
image: wi-dev:${VERSION}
Expand Down

0 comments on commit a7a2051

Please sign in to comment.