Docker Compose #
DataJunction Demo Docker Compose Setup #
The easiest way to try out DJ is to use the dj-demo docker compose setup. This setup will launch and connect a DJ server, a DJRS server, and a jupyter lab instance with a few example notebooks.
Clone the DJ demo repository along with the DJ and DJQS repositories.
git clone git@github.com:DataJunction/dj-demo.git
git clone git@github.com:DataJunction/dj.git
git clone git@github.com:DataJunction/djqs.git
Change into the dj-demo/
directory and start the docker compose environment.
cd dj-demo
docker compose up
A jupyter lab instance is now available at localhost:8888/lab and contains examples in the notebooks/
directory, such as Modeling the Roads Example Database.ipynb
.
Starting Individual DJ Services #
As an alternative to the DJ demo, you can start one or more of the individual services separately and configure them to connect to one another or to other existing instances. One example of why you may do this is if you’re only interested in the SQL generating capabilities, in which case you only need to launch the main DJ service.
DataJunction - Docker Compose #
To start a DJ instance, clone the DJ repository.
git clone git@github.com:DataJunction/dj.git
Start the docker compose environment.
docker compose up
A DJ server is now available and the API docs can be found at localhost:8000. You can
ping the /health/
endpoint to ensure the server is up.
curl "http://localhost:8000/health/" | jq
response
[
{
"name": "database",
"status": "ok"
}
]
DataJunction Query Service - Docker Compose #
By setting QUERY_SERVICE
in a DJ instance’s configuration, you can connect it to a DJQS instance. Queries generated by the DJ instance
will then be executed by the DJQS instance.
To start a DJQS instance, first clone the DJQS repository.
git clone git@github.com:DataJunction/djqs.git
Start the docker compose environment.
docker compose up
A DJQS server is now available and the API docs can be found at localhost:8001.
You only need to launch DJQS if you want to both generate SQL queries and execute them to retrieve data. Generating SQL queries is possible by only launching DJ.
Although it’s interesting to check out the API docs for DJQS, you don’t need to call the DJQS API directly–DJ will call DJQS on your behalf. You can see in the .env file that the local DJ setup is by default configured to connect to a local DJQS instance running on port 8001.
Example Notebooks #
The DJ repository includes notebooks that each contain examples of different ways you can use a DJ server. Once you have DJ running, you can launch a python notebook server
to try them out. If you already have a remote DJ server running, you can connect the example notebooks to it simply by changing the DJ_HOST
, DJ_PORT
and DJ_PROTOCOL
variables at the top of each notebook.
Clone the DJ demo repository.
git clone git@github.com:DataJunction/dj-demo.git
Install jupyter lab.
pip install jupyterlab
Change into the notebooks directory and start a jupyter server.
cd notebooks
jupyter lab