src/postgres/third-party-extensions/documentdb/docs/v1/get-started.md
Step 1: Clone the DocumentDB repo.
git clone https://github.com/microsoft/documentdb.git
Step 2: Create the docker image. Navigate to cloned repo.
docker build . -f .devcontainer/Dockerfile -t documentdb
Note: Validate using docker image ls
Step 3: Run the Image as a container
docker run -v $(pwd):/home/documentdb/code -it documentdb /bin/bash
cd code
(Aligns local location with docker image created, allows de-duplicating cloning repo again within image).
Note: Validate container is running docker container ls
Step 4: Build & Deploy the binaries
make
Note: Run in case of an unsuccessful build git config --global --add safe.directory /home/documentdb/code within image.
sudo make install
Note: To run backend postgresql tests after installing you can run make check.
You are all set to work with DocumentDB.
You can use a prebuilt docker image for DocumentDB instead of building it from source. Follow these steps:
Pull the prebuilt image directly from the Microsoft Container Registry:
docker pull mcr.microsoft.com/cosmosdb/ubuntu/documentdb-oss:22.04-PG16-AMD64-0.103.0
To run the prebuilt image, use one of the following commands:
docker run -dt mcr.microsoft.com/cosmosdb/ubuntu/documentdb-oss:22.04-PG16-AMD64-0.103.0
docker run -p 127.0.0.1:9712:9712 -dt mcr.microsoft.com/cosmosdb/ubuntu/documentdb-oss:22.04-PG16-AMD64-0.103.0 -e
This will start the container and map port 9712 from the container to the host.
Step 1: Run start_oss_server.sh to initialize the DocumentDB server and manage dependencies.
./scripts/start_oss_server.sh
Or logging into the container if using prebuild image
docker exec -it <container-id> bash
Step 2: Connect to psql shell
psql -p 9712 -d postgres
Connect to psql shell
psql -h localhost --port 9712 -d postgres -U documentdb