|
| 1 | +# Frontend development environments |
| 2 | + |
| 3 | +Install [Docker Desktop][docker-desktop] as per its instructions, available for Windows, Mac |
| 4 | +and Linux (Ubuntu, Debian & Fedora). |
| 5 | +This ensures that the development experience between Linux, Mac and Windows is as |
| 6 | +similar as possible. |
| 7 | + |
| 8 | +> IMPORTANT: be methodic during the installation of Docker Desktop, and proceed |
| 9 | +> step by step as described in their documentation. Make sure that your system |
| 10 | +> meets the system requirements before installing Docker Desktop, and read any |
| 11 | +> post-installation note, specially on Linux: [Differences between |
| 12 | +> Docker Desktop for Linux and Docker Engine][docker-variant]. |
| 13 | +
|
| 14 | +## Pre-requisites |
| 15 | + |
| 16 | +1. Assign resources to [Docker Desktop][docker-desktop]. The requirements for the |
| 17 | + environments are: |
| 18 | + |
| 19 | + - 8 GB of RAM (minimum) |
| 20 | + - 4 cores |
| 21 | + |
| 22 | + The more resources the better ☺ |
| 23 | + |
| 24 | +2. Clone the [wazuh-indexer][wi-repo]. |
| 25 | + |
| 26 | +3. Set up user permissions |
| 27 | + |
| 28 | + The Docker volumes will be created by the internal Docker user, making them |
| 29 | + read-only. To prevent this, a new group named `docker-desktop` and GUID 100999 |
| 30 | + needs to be created, then added to your user and the source code folder: |
| 31 | + |
| 32 | + ```bash |
| 33 | + sudo groupadd -g 100999 docker-desktop |
| 34 | + sudo useradd -u 100999 -g 100999 -M docker-desktop |
| 35 | + sudo chown -R docker-desktop:docker-desktop $WZD_HOME |
| 36 | + sudo usermod -aG docker-desktop $USER |
| 37 | + ``` |
| 38 | + |
| 39 | +## Understanding Docker contexts |
| 40 | + |
| 41 | +Before we begin starting Docker containers, we need to understand the |
| 42 | +differences between Docker Engine and Docker Desktop, more precisely, that the |
| 43 | +use different contexts. |
| 44 | + |
| 45 | +Carefully read these two sections of the Docker documentation: |
| 46 | + |
| 47 | +- [Differences between Docker Desktop for Linux and Docker Engine][docker-variant]. |
| 48 | +- [Switch between Docker Desktop and Docker Engine][docker-context]. |
| 49 | + |
| 50 | +Docker Desktop will change to its context automatically at start, so be sure |
| 51 | +that any existing Docker container using the default context is **stopped** |
| 52 | +before starting Docker Desktop and any of the environments in this folder. |
| 53 | + |
| 54 | +## Starting up the environments |
| 55 | + |
| 56 | +Use the sh script to up the environment. |
| 57 | + |
| 58 | +Example: |
| 59 | + |
| 60 | +```bash |
| 61 | +Usage: ./dev.sh {up|down|stop} [security] |
| 62 | +``` |
| 63 | + |
| 64 | +Once the `wazuh-indexer` container is up, attach a shell to it and run `./gradlew run` |
| 65 | +to start the application. |
| 66 | + |
| 67 | + |
| 68 | +[docker-desktop]: https://docs.docker.com/get-docker |
| 69 | +[docker-variant]: https://docs.docker.com/desktop/install/linux-install/#differences-between-docker-desktop-for-linux-and-docker-engine |
| 70 | +[docker-context]: https://docs.docker.com/desktop/install/linux-install/#context |
| 71 | +[wi-repo]: https://github.com/wazuh/wazuh-indexer |
0 commit comments