diff --git a/tests/siege/Dockerfile b/tests/siege/Dockerfile new file mode 100644 index 0000000..48502b7 --- /dev/null +++ b/tests/siege/Dockerfile @@ -0,0 +1,19 @@ +FROM ubuntu:latest + +# Update packages and install necessary tools +RUN apt-get update && \ + apt-get install -y \ + build-essential \ + # Includes g++ and make + git \ + curl \ + vim \ + siege \ + # Optional, for editing inside the container + && rm -rf /var/lib/apt/lists/* + +# Set the working directory inside the container +WORKDIR /app + +# Default command or entrypoint +CMD ["bash"] diff --git a/tests/siege/siege.md b/tests/siege/siege.md new file mode 100644 index 0000000..1aef126 --- /dev/null +++ b/tests/siege/siege.md @@ -0,0 +1,39 @@ +# Test Webserv with Siege in a Docker Environment + +## 1. Build the Docker Image + +Use the Dockerfile in this folder. + +From the **root** directory build the Docker image: + +```bash +docker build -t ubuntu-siege -f tests/siege/Dockerfile . +``` + +## 2. Start the first interactive session + +1. Run Siege interactively within the container, use: + +```bash +docker run --name ubuntu-siege-session --rm -it -v "$(pwd):/app" ubuntu-siege /bin/bash + +``` + +## 3. Compile the webserver + + `make re` + +### 4. Start a second interactive section + +```bash +docker exec -it ubuntu-siege-session /bin/bash +``` + +### 5. Stress test the webserv + + +Inside the container, you can execute commands like: + +```bash +siege -c10 -d5 -t1M http://localhost:80 +```