diff --git a/README.md b/README.md index f296da89..f9f4ca43 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,78 @@ instructions for local setup and deployment. In the case of Windows, all the commands outlined in this file should be run inside the Linux VM terminal, which hosts Docker, rather than in native Windows terminals (e.g., CMD or PowerShell). For instance, if Docker is used with WSL, the commands should be executed inside the WSL terminal. +To launch WSL: Press `Win + R`, type `wsl`, and hit `Enter`. + +### Git Repository Checkout + +WSL commands run in the linux context. +Therefore, you must check out / git clone this repository via the WSL terminal +to prevent Git from automatically converting newlines in bash scripts (`\n`) to Windows-style newlines (`\r\n`), +which could cause unexpected errors while parsing and running the scripts. + +### External Docker images + +If you are running the below commands on Windows, replace `image: bitnami/etcd` in `gateway/local/docker-compose.yml` +to `image: bitnamilegacy/etcd`. + +### Install Homebrew and java inside WSL + +#### Install curl: +```bash + sudo apt update + sudo apt install -y build-essential curl file git +``` + +#### Install Homebrew: +```bash + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +``` + +Add brew to your shell +```bash + echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.bashrc + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" +``` + +Restart your WSL shell or run: +```bash + source ~/.bashrc +``` + +Verify: +```bash + brew --version +``` + +#### Install java: +```bash + brew update + brew install openjdk@17 + brew link --force --overwrite openjdk@17 +``` + +### Docker Resource Management + +If heavy automation scripts (such as `publish-all.sh`) become unresponsive or "hang", +it typically indicates that Docker has reached the default resource ceiling allocated by Windows. + +You can adjust these settings by creating or editing a global configuration file on your Windows host. + +To do so, navigate to your Windows user profile folder by entering `%USERPROFILE%` in the File Explorer address bar. + +Open or create a file named `.wslconfig`. +Add or update the following section: + +``` +[wsl2] +memory=80% +swap=4GB +``` + +For the changes to take effect - stop WSL using the `wsl --shutdown` command, and start `wsl` again. + +--- + ## Local Setup As a prerequisite, ensure that you have StreamX CLI installed in latest preview version: @@ -21,10 +93,11 @@ As a prerequisite, ensure that you have StreamX CLI installed in latest preview brew upgrade streamx-dev/preview-tap/streamx brew install streamx-dev/preview-tap/streamx ``` -Publishing requires also `yq` and `envsubst` commands. To install these run: +Running apisix gateway requires also `yq`, `jq` and `envsubst` commands. To install these run: ```shell brew install yq - brew install gettext + brew install jq + brew install envsubst ``` 1. **Start StreamX** diff --git a/gateway/local/docker-compose.yaml b/gateway/local/docker-compose.yml similarity index 95% rename from gateway/local/docker-compose.yaml rename to gateway/local/docker-compose.yml index e6c0cb66..e5c35c27 100644 --- a/gateway/local/docker-compose.yaml +++ b/gateway/local/docker-compose.yml @@ -22,7 +22,7 @@ services: image: apache/apisix:${APISIX_IMAGE_TAG:-3.11.0-debian} restart: always volumes: - - ./apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:rw + - ./config.yaml:/usr/local/apisix/conf/config.yaml:rw depends_on: - etcd ##network_mode: host