With this dev container, you can:
- Build Presto and Prestissimo from source
- Run Presto and Prestissimo with different configurations
- Debugging with VS Code or any IDE with ssh support
- Working on UI development
- Develop unit tests with test containers
- Docker or Podman must be installed and running.
This environment can be run on both Linux and macOS.
Run the following command to clone the presto-dev
repository into your local presto
directory, start the dev container and enter the container shell.
# Inside your local presto directory
git clone https://github.com/prestodb/presto-dev.git
# Start the dev container and enter container shell
cd presto-dev
make
In the dev container shell, you can run the following commands to work with source code.
# Build presto (.m2 already cached)
cd /presto
./mvnw clean install -DskipTests
# Run unit tests with test container
start-podman
cd /presto
./mvnw test -pl presto-main -Dtest="com/facebook/presto/server/security/oauth2/**"
# Build prestissimo(make debug or make release)
cd /presto/presto-native-execution
make
# Start presto-ui development server, open http://localhost:8081 in your browser
# Run "start-cluster <cluster profile>" first to start a presto cluster
cd /presto/presto-ui/src
yarn install
yarn serve
When a new presto-dev
image is published, run the following command to pull the latest version.
# Under presto-dev, run this to pull the latest presto-dev image
make pull
Run make
or make shell
in the presto-dev directory to open a new container shell.
All the commands below must be executed inside the container shell.
ls -la /root
# Start presto coordinator and prestissimo worker
start-cluster default
# Start presto single node and prestissimo sidecar
start-cluster sidecar
# Stop cluster
stop-cluster
Use http://localhost:8080 to open the Presto console.
The configuration files are organized within cluster profiles in the clusters/
directory. Each cluster profile contains its own configuration files for Presto coordinator, Presto worker, and/or Prestissimo worker.
Available cluster profiles:
presto
: Presto coordinator and workerprestissimo
: Presto coordinator and Prestissimo workerpresto-single
: Single node Presto serversidecar
: Presto coordinator with worker and Prestissimo worker with sidecar configuration
You can modify the existing configuration files in these profiles or create a new cluster profile based on your specific requirements. To create a new cluster profile:
- Create a new directory under
clusters/
with your profile name - Copy the configuration files from an existing profile
- Modify the configuration files as needed
- Create a
start-cluster
script for your profile
The presto/data is mounted as /opt/presto/data
to persist data between container restarts.
This approach allows you to maintain multiple configuration profiles and easily switch between them using the start-cluster
script.
- Install Remote Development extension.
- Open
Remote Explorer
panel, switch toDev Containers
from the drop down widget on the top. - Open the
/presto
directory in the composed containerpresto-dev
(If importing Maven projects takes a long time, run./mvnw clean
in the/presto
directory andmake clean
in the/presto/presto-native-execution
directory inside the container.). - If
presto/.vscode/launch.json
is not already configured, the file launch.json is copied there automatically. If it is already configured, append the contents of launch.json from this repository to your existingpresto/.vscode/launch.json
. - Install Microsoft Extension Pack for Java and C/C++ Extension Pack in the container.
- Start Presto & Prestissimo in the container.
- After the Java projects are imported, open the Debug panel and select either
Attach to Prestissimo
orAttach to Presto
to start debugging.
VSCodium based IDEs cannot use the Remote Development extension. If your IDE supports remote ssh extension, you can try this:
- Make sure you have generated ssh keys and updated the
authorized_keys
file in your local machine. - Use
make start
to start the container. This will copy your SSH keys from~/.ssh/authorized_keys
to theroot/.ssh
directory insidepresto-dev
. - Add the following entry to your local
~/.ssh/config
file:
Host presto-dev
HostName localhost
Port 2222
User root
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
- Test the ssh connection with
ssh presto-dev
. - Connect to the
presto-dev
SSH server using your IDE.
By default, the root
directory in this repo will be mounted to /root
in the container. Use this root
directory to share your data between your local machine and the container.
By default, the .ccache
, .m2
, and .cache
directories under /root
directory are symbolic links to the image's /opt/cache
directories. These symbolic links will disappear when the container is shut down. To preserve your cache data between container restarts, you need to replace these symbolic links with local directories in the mounted /root
directory.
Run the following command in the shell of dev container:
use-local-cache
This script replaces the symbolic links with actual directories in your local /root
folder, copying the cache data from /opt/cache
. Since the root
directory is mounted into the container, these cache files will be preserved even when the container is removed, significantly improving build performance on subsequent runs.
The development environment includes scripts to help with building and installing Presto and Prestissimo.
- build-and-install: Builds Presto and Prestissimo from source and installs them into
/opt/presto
and/opt/prestissimo
respectively.
build-and-install
This script:
- Builds Presto from source in
/presto
- Builds Prestissimo from source in
/presto/presto-native-execution
- Installs the built binaries to
/opt/presto
and/opt/prestissimo
- Makes the newly built versions available for use
After running this script, you can start the servers with the newly built versions using the cluster management scripts.
The development environment includes scripts to manage Podman containers for testing. Currently it only supports centos based dev container.
- start-podman: Starts rootful podman with sock file
unix:///var/run/docker.sock
to enable running test containers inside the dev container. - stop-podman: Stops the podman service.
# Start podman service
start-podman
# Run your tests that use test containers
cd /presto
./mvnw test -pl presto-main -Dtest="com/facebook/presto/server/security/oauth2/**"
# Stop podman service when done
stop-podman
The start-podman
script enables running test containers inside the dev container by providing a Docker-compatible socket at unix:///var/run/docker.sock
. This allows test frameworks like TestContainers to work properly within the development environment.
The development environment includes scripts to easily start and stop Presto and Prestissimo clusters. These scripts are located in the /root/bin
directory.
- start-cluster: Starts a specific cluster profile (presto, prestissimo, presto-single, or sidecar)
- stop-cluster: Stops all running Presto and Prestissimo servers across all cluster profiles
start-cluster <cluster-profile>
Where <cluster-profile>
is one of the available cluster profiles in the /opt/clusters
directory (e.g., presto, prestissimo, presto-single, sidecar).
Example:
# Start the presto-single cluster
start-cluster presto-single
# Start the prestissimo cluster
start-cluster prestissimo
stop-cluster
This command will stop all running Presto and Prestissimo servers across all cluster profiles.
Each cluster profile has its own configuration and behavior:
- presto: Starts a Presto coordinator and a Presto worker
- prestissimo: Starts a Presto coordinator and a Prestissimo worker
- presto-single: Starts a single node Presto server (coordinator with worker)
- sidecar: Starts a single node Presto coordinator with worker and a Prestissimo worker with sidecar configuration
The logs for Presto servers are available at /opt/presto/data/var/log/server.log
, and the logs for Prestissimo servers are available at /opt/prestissimo/logs/server.log
.