Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Development container for ProxySQL
# Based on: https://github.com/ProxySQL/docker-images/blob/main/build-images/build-ubuntu24/Dockerfile

FROM ubuntu:24.04
LABEL authors="Miro Stauder <miro@sysown.com>"

ENV DEBIAN_FRONTEND=noninteractive

RUN apt update && \
apt full-upgrade -y

# gcc & build tools
RUN apt install -y \
make cmake automake bison flex \
git wget \
gcc g++ \
libtool \
gdb gdbserver \
equivs \
python3 \
zstd \
pkg-config \
sudo

# proxysql build dependencies
RUN apt install -y \
libssl-dev gnutls-dev libgnutls28-dev \
libmysqlclient-dev \
libunwind8 libunwind-dev \
uuid-dev \
libncurses-dev \
libicu-dev \
libevent-dev \
libtirpc-dev

# debug images need valgrind
RUN apt install -y \
valgrind

# mysql client for testing
RUN apt install -y \
mariadb-client

# clean apt cache
RUN apt clean && \
rm -rf /var/cache/apt/* && \
rm -rf /var/lib/apt/lists/*
Comment on lines +9 to +47
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To optimize the Docker image size and build speed, it's a best practice to chain all apt operations into a single RUN command. This avoids creating multiple intermediate layers. Combining apt-get update, apt-get install, and the cleanup steps (apt-get clean, rm) in one layer ensures that the package cache is cleaned up in the same layer it was created, effectively reducing the final image size. I've also added --no-install-recommends which is a common practice to further reduce size.

RUN apt-get update && \
	apt-get full-upgrade -y && \
	apt-get install -y --no-install-recommends \
	# gcc & build tools
	make cmake automake bison flex \
	git wget \
	gcc g++ \
	libtool \
	gdb gdbserver \
	equivs \
	python3 \
	zstd \
	pkg-config \
	sudo \
	# proxysql build dependencies
	libssl-dev gnutls-dev libgnutls28-dev \
	libmysqlclient-dev \
	libunwind8 libunwind-dev \
	uuid-dev \
	libncurses-dev \
	libicu-dev \
	libevent-dev \
	libtirpc-dev \
	# debug images need valgrind
	valgrind \
	# mysql client for testing
	mariadb-client && \
	# clean apt cache
	apt-get clean && \
	rm -rf /var/lib/apt/lists/*

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Though the current version honors original Dockerfile mentioned in CONTRIBUTING.md.
I'll let proxysql team comment if we want to optimize the Dockerfile.


# fetch needed include
RUN wget -q -O /usr/include/mysql/hash.h https://raw.githubusercontent.com/mysql/mysql-server/5.7/include/hash.h
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better reproducibility and to avoid potential issues if the 5.7 tag is ever moved or deleted, it's recommended to pin the downloaded file to a specific commit hash instead of a tag. The tag 5.7 currently points to commit b339a7d72f845a1343355650454457845e63ea37.

RUN wget -q -O /usr/include/mysql/hash.h https://raw.githubusercontent.com/mysql/mysql-server/b339a7d72f845a1343355650454457845e63ea37/include/hash.h


# configure git safe dir
RUN git config --global --add safe.directory '*'

ENV CC=gcc
ENV CXX=g++

RUN ${CXX} --version
15 changes: 15 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "ProxySQL Development",
"dockerComposeFile": "docker-compose.yaml",
"service": "dev",
"workspaceFolder": "/proxysql",
"shutdownAction": "stopCompose",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools"
]
}
}
}
18 changes: 18 additions & 0 deletions .devcontainer/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
services:
dev:
build:
context: .
dockerfile: Dockerfile
volumes:
- ..:/proxysql:cached
working_dir: /proxysql
init: true
command: sleep infinity

mariadb:
image: mariadb:11.4
environment:
MYSQL_ROOT_PASSWORD: root
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The MYSQL_ROOT_PASSWORD is hardcoded in the docker-compose.yaml file. While this is for a local development environment, it's a security risk to commit credentials directly into source control. A better practice is to use environment variable substitution. You can then define the password in a .env file (which should be added to .gitignore) at the project root.

Example .env file:

MYSQL_ROOT_PASSWORD=root

Docker Compose will automatically pick up this file.

      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This follows the existing project convention - all docker-compose files under docker/ use hardcoded MYSQL_ROOT_PASSWORD: root for local dev/test environments.

MYSQL_DATABASE: testdb
ports:
- "3306:3306"
28 changes: 26 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,31 @@ Reference issues: When fixing bugs or implementing requested features, mention t

## Development Setup

ProxySQL provides Docker build images for development. The required packages for building are listed in the Dockerfiles at: https://github.com/ProxySQL/docker-images/tree/main/build-images
### Using Dev Container (Recommended)

The easiest way to set up a development environment is using the included [dev container](https://containers.dev/):

**With a compatible IDE:**

Many IDEs support dev containers natively or via extensions. Simply open the repository and follow your IDE's prompts to reopen in the container.

**With Docker Compose:**
```bash
# Start the dev container and MariaDB
docker compose -f .devcontainer/docker-compose.yaml up -d

# Go into dev container shell
docker compose -f .devcontainer/docker-compose.yaml exec dev bash

# Build ProxySQL
make
```

The MariaDB service is available at hostname `mariadb` for testing.

### Manual Setup

If you prefer to set up your environment manually, the required packages for building are listed in the Dockerfiles at: https://github.com/ProxySQL/docker-images/tree/main/build-images

For example, to see packages needed for Ubuntu 24.04, check: https://github.com/ProxySQL/docker-images/blob/main/build-images/build-ubuntu24/Dockerfile
Comment on lines +43 to 45
Copy link
Copy Markdown

@coderabbitai coderabbitai bot Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Convert bare URL to markdown link for consistency.

Line 43 uses a bare URL while line 45 uses proper markdown link syntax. Per markdownlint (MD034), bare URLs should be avoided.

Suggested fix
-If you prefer to set up your environment manually, the required packages for building are listed in the Dockerfiles at: https://github.com/ProxySQL/docker-images/tree/main/build-images
+If you prefer to set up your environment manually, the required packages for building are listed in the Dockerfiles at: [ProxySQL/docker-images/build-images](https://github.com/ProxySQL/docker-images/tree/main/build-images)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
If you prefer to set up your environment manually, the required packages for building are listed in the Dockerfiles at: https://github.com/ProxySQL/docker-images/tree/main/build-images
For example, to see packages needed for Ubuntu 24.04, check: https://github.com/ProxySQL/docker-images/blob/main/build-images/build-ubuntu24/Dockerfile
If you prefer to set up your environment manually, the required packages for building are listed in the Dockerfiles at: [ProxySQL/docker-images/build-images](https://github.com/ProxySQL/docker-images/tree/main/build-images)
For example, to see packages needed for Ubuntu 24.04, check: https://github.com/ProxySQL/docker-images/blob/main/build-images/build-ubuntu24/Dockerfile
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

43-43: Bare URL used

(MD034, no-bare-urls)


45-45: Bare URL used

(MD034, no-bare-urls)

🤖 Prompt for AI Agents
In @CONTRIBUTING.md around lines 43 - 45, Replace the bare URL on the first
sentence with a markdown link to match the style used on the next line: change
the plain https://github.com/ProxySQL/docker-images/tree/main/build-images to a
markdown link like [ProxySQL docker-images
build-images](https://github.com/ProxySQL/docker-images/tree/main/build-images)
in CONTRIBUTING.md so both references use consistent markdown link syntax and
satisfy markdownlint MD034.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a valid style nitpick. However, the existing CONTRIBUTING.md (before our changes) already had bare URLs in this section - we just moved them under a new "Manual Setup" heading.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rophy, that's a fair point! Since these bare URLs pre-existed your changes and you're just reorganizing the content, it makes sense that you wouldn't want to mix style fixes with functional changes in this PR.

If you'd like to address the markdownlint warnings, it could be done in a separate cleanup PR, but it's certainly not required for this dev container addition.


Expand Down Expand Up @@ -100,4 +124,4 @@ By contributing to ProxySQL, you agree that your contributions will be licensed

---

Thank you for helping make ProxySQL better!
Thank you for helping make ProxySQL better!